0
0
Fork 0

Merge branch 'dev' into 6898-supplierMigration

This commit is contained in:
Carlos Satorres 2024-07-03 10:44:11 +00:00
commit f6af1415c2
46 changed files with 860 additions and 1443 deletions

View File

@ -10,6 +10,7 @@ import VnPaginate from 'components/ui/VnPaginate.vue';
import VnConfirm from 'components/ui/VnConfirm.vue'; import VnConfirm from 'components/ui/VnConfirm.vue';
import SkeletonTable from 'components/ui/SkeletonTable.vue'; import SkeletonTable from 'components/ui/SkeletonTable.vue';
import { tMobile } from 'src/composables/tMobile'; import { tMobile } from 'src/composables/tMobile';
import VnSubToolbar from './ui/VnSubToolbar.vue';
const { push } = useRouter(); const { push } = useRouter();
const quasar = useQuasar(); const quasar = useQuasar();
@ -67,7 +68,7 @@ const $props = defineProps({
default: '', default: '',
description: 'It is used for redirect on click "save and continue"', description: 'It is used for redirect on click "save and continue"',
}, },
hasSubtoolbar: { hasSubToolbar: {
type: Boolean, type: Boolean,
default: true, default: true,
}, },
@ -313,8 +314,11 @@ watch(formUrl, async () => {
></slot> ></slot>
</template> </template>
</VnPaginate> </VnPaginate>
<SkeletonTable v-if="!formData" :columns="$attrs.columns?.length" /> <SkeletonTable
<Teleport to="#st-actions" v-if="stateStore?.isSubToolbarShown() && hasSubtoolbar"> v-if="!formData && $attrs.autoLoad"
:columns="$attrs.columns?.length"
/>
<Teleport to="#st-actions" v-if="stateStore?.isSubToolbarShown() && hasSubToolbar">
<QBtnGroup push style="column-gap: 10px"> <QBtnGroup push style="column-gap: 10px">
<slot name="moreBeforeActions" /> <slot name="moreBeforeActions" />
<QBtn <QBtn

View File

@ -21,7 +21,7 @@ const itemComputed = computed(() => {
</script> </script>
<template> <template>
<QItem <QItem
active-class="bg-hover" active-class="bg-vn-hover"
class="min-height" class="min-height"
:to="{ name: itemComputed.name }" :to="{ name: itemComputed.name }"
clickable clickable

View File

@ -46,6 +46,7 @@ const defaultComponents = {
component: markRaw(VnInput), component: markRaw(VnInput),
attrs: { attrs: {
disable: !$props.isEditable, disable: !$props.isEditable,
class: 'fit',
}, },
forceAttrs: { forceAttrs: {
label: $props.showLabel && $props.column.label, label: $props.showLabel && $props.column.label,
@ -55,6 +56,7 @@ const defaultComponents = {
component: markRaw(VnInput), component: markRaw(VnInput),
attrs: { attrs: {
disable: !$props.isEditable, disable: !$props.isEditable,
class: 'fit',
}, },
forceAttrs: { forceAttrs: {
label: $props.showLabel && $props.column.label, label: $props.showLabel && $props.column.label,
@ -66,6 +68,7 @@ const defaultComponents = {
readonly: true, readonly: true,
disable: !$props.isEditable, disable: !$props.isEditable,
style: 'min-width: 125px', style: 'min-width: 125px',
class: 'fit',
}, },
forceAttrs: { forceAttrs: {
label: $props.showLabel && $props.column.label, label: $props.showLabel && $props.column.label,
@ -77,7 +80,7 @@ const defaultComponents = {
const defaultAttrs = { const defaultAttrs = {
disable: !$props.isEditable, disable: !$props.isEditable,
'model-value': Boolean(prop), 'model-value': Boolean(prop),
class: 'no-padding', class: 'no-padding fit',
}; };
if (typeof prop == 'number') { if (typeof prop == 'number') {
@ -94,6 +97,7 @@ const defaultComponents = {
component: markRaw(VnSelect), component: markRaw(VnSelect),
attrs: { attrs: {
disable: !$props.isEditable, disable: !$props.isEditable,
class: 'fit',
}, },
forceAttrs: { forceAttrs: {
label: $props.showLabel && $props.column.label, label: $props.showLabel && $props.column.label,
@ -134,7 +138,7 @@ const col = computed(() => {
const components = computed(() => $props.components ?? defaultComponents); const components = computed(() => $props.components ?? defaultComponents);
</script> </script>
<template> <template>
<div class="row no-wrap fit"> <div class="row no-wrap">
<VnComponent <VnComponent
v-if="col.before" v-if="col.before"
:prop="col.before" :prop="col.before"

View File

@ -40,7 +40,7 @@ const enterEvent = {
const defaultAttrs = { const defaultAttrs = {
filled: !$props.showTitle, filled: !$props.showTitle,
class: 'q-px-sm q-pb-xs q-pt-none', class: 'q-px-sm q-pb-xs q-pt-none fit',
dense: true, dense: true,
}; };
@ -92,7 +92,7 @@ const components = {
event: updateEvent, event: updateEvent,
attrs: { attrs: {
dense: true, dense: true,
class: $props.showTitle ? 'q-py-sm q-mt-md' : 'q-px-md q-py-xs', class: $props.showTitle ? 'q-py-sm q-mt-md' : 'q-px-md q-py-xs fit',
'toggle-indeterminate': true, 'toggle-indeterminate': true,
}, },
forceAttrs, forceAttrs,
@ -101,7 +101,7 @@ const components = {
component: markRaw(VnSelect), component: markRaw(VnSelect),
event: updateEvent, event: updateEvent,
attrs: { attrs: {
class: 'q-px-md q-pb-xs q-pt-none', class: 'q-px-md q-pb-xs q-pt-none fit',
dense: true, dense: true,
filled: !$props.showTitle, filled: !$props.showTitle,
}, },

View File

@ -59,10 +59,14 @@ const $props = defineProps({
type: Boolean, type: Boolean,
default: false, default: false,
}, },
hasSubtoolbar: { hasSubToolbar: {
type: Boolean, type: Boolean,
default: true, default: true,
}, },
disableOption: {
type: Object,
default: () => ({ card: false, table: false }),
},
}); });
const { t } = useI18n(); const { t } = useI18n();
const stateStore = useStateStore(); const stateStore = useStateStore();
@ -84,11 +88,13 @@ const tableModes = [
icon: 'view_column', icon: 'view_column',
title: t('table view'), title: t('table view'),
value: TABLE_MODE, value: TABLE_MODE,
disable: $props.disableOption?.table,
}, },
{ {
icon: 'grid_view', icon: 'grid_view',
title: t('grid view'), title: t('grid view'),
value: DEFAULT_MODE, value: DEFAULT_MODE,
disable: $props.disableOption?.card,
}, },
]; ];
@ -232,7 +238,7 @@ defineExpose({
:search-url="searchUrl" :search-url="searchUrl"
:disable-infinite-scroll="mode == TABLE_MODE" :disable-infinite-scroll="mode == TABLE_MODE"
@save-changes="reload" @save-changes="reload"
:has-subtoolbar="$attrs['hasSubtoolbar'] ?? isEditable" :has-sub-toolbar="$attrs['hasSubToolbar'] ?? isEditable"
> >
<template <template
v-for="(_, slotName) in $slots" v-for="(_, slotName) in $slots"
@ -418,9 +424,9 @@ defineExpose({
> >
<VnLv <VnLv
:label=" :label="
!col.component && !col.component && col.label
col.label && ? `${col.label}:`
`${col.label}:` : ''
" "
> >
<template #value> <template #value>

View File

@ -12,7 +12,7 @@ const $props = defineProps({
default: () => {}, default: () => {},
}, },
value: { value: {
type: [Object, Number, String], type: [Object, Number, String, Boolean],
default: () => {}, default: () => {},
}, },
}); });
@ -54,7 +54,6 @@ function toValueAttrs(attrs) {
v-bind="mix(toComponent).attrs" v-bind="mix(toComponent).attrs"
v-on="mix(toComponent).event ?? {}" v-on="mix(toComponent).event ?? {}"
v-model="model" v-model="model"
class="fit"
/> />
</span> </span>
</template> </template>

View File

@ -131,3 +131,13 @@ watch(
</QInput> </QInput>
</div> </div>
</template> </template>
<style lang="scss">
.vn-input-date.q-field--standard.q-field--readonly .q-field__control:before {
border-bottom-style: solid;
}
.vn-input-date.q-field--outlined.q-field--readonly .q-field__control:before {
border-style: solid;
}
</style>

View File

@ -111,3 +111,12 @@ watch(
</QInput> </QInput>
</div> </div>
</template> </template>
<style lang="scss">
.vn-input-time.q-field--standard.q-field--readonly .q-field__control:before {
border-bottom-style: solid;
}
.vn-input-time.q-field--outlined.q-field--readonly .q-field__control:before {
border-style: solid;
}
</style>

View File

@ -49,6 +49,7 @@ const filter = {
'changedModelId', 'changedModelId',
'changedModelValue', 'changedModelValue',
'description', 'description',
'summaryId',
], ],
include: [ include: [
{ {
@ -459,12 +460,12 @@ onUnmounted(() => {
:style="{ :style="{
backgroundColor: useColor(modelLog.model), backgroundColor: useColor(modelLog.model),
}" }"
:title="modelLog.model" :title="`${modelLog.model} #${modelLog.id}`"
> >
{{ t(modelLog.modelI18n) }} {{ t(modelLog.modelI18n) }}
</QChip> </QChip>
<span class="model-id" v-if="modelLog.id" <span class="model-id" v-if="modelLog.summaryId"
>#{{ modelLog.id }}</span >#{{ modelLog.summaryId }}</span
> >
<span class="model-value" :title="modelLog.showValue"> <span class="model-value" :title="modelLog.showValue">
{{ modelLog.showValue }} {{ modelLog.showValue }}

View File

@ -1,6 +1,7 @@
<script setup> <script setup>
import { onMounted, onUnmounted, ref } from 'vue'; import { onMounted, onBeforeUnmount, ref, nextTick } from 'vue';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
const stateStore = useStateStore(); const stateStore = useStateStore();
const actions = ref(null); const actions = ref(null);
const data = ref(null); const data = ref(null);
@ -24,9 +25,7 @@ onMounted(() => {
if (data.value) observer.observe(data.value, opts); if (data.value) observer.observe(data.value, opts);
}); });
onUnmounted(() => { onBeforeUnmount(() => stateStore.toggleSubToolbar());
stateStore.toggleSubToolbar();
});
</script> </script>
<template> <template>

View File

@ -19,7 +19,6 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
onMounted(() => { onMounted(() => {
setOptions(); setOptions();
store.skip = 0; store.skip = 0;
const query = route.query; const query = route.query;
const searchUrl = store.searchUrl; const searchUrl = store.searchUrl;
if (query[searchUrl]) { if (query[searchUrl]) {

View File

@ -5,6 +5,7 @@
body.body--light { body.body--light {
--font-color: black; --font-color: black;
--vn-section-color: #e0e0e0; --vn-section-color: #e0e0e0;
--vn-section-hover-color: #b9b9b9;
--vn-page-color: #ffffff; --vn-page-color: #ffffff;
--vn-text-color: var(--font-color); --vn-text-color: var(--font-color);
--vn-label-color: #5f5f5f; --vn-label-color: #5f5f5f;
@ -19,6 +20,7 @@ body.body--light {
body.body--dark { body.body--dark {
--vn-page-color: #222; --vn-page-color: #222;
--vn-section-color: #3d3d3d; --vn-section-color: #3d3d3d;
--vn-section-hover-color: #747474;
--vn-text-color: white; --vn-text-color: white;
--vn-label-color: #a8a8a8; --vn-label-color: #a8a8a8;
--vn-accent-color: #424242; --vn-accent-color: #424242;
@ -71,8 +73,9 @@ select:-webkit-autofill {
.bg-vn-section-color { .bg-vn-section-color {
background-color: var(--vn-section-color); background-color: var(--vn-section-color);
} }
.bg-hover {
background-color: #666666; .bg-vn-hover {
background-color: var(--vn-section-hover-color);
} }
.color-vn-label { .color-vn-label {
@ -183,8 +186,6 @@ select:-webkit-autofill {
justify-content: center; justify-content: center;
} }
/* q-notification row items-stretch q-notification--standard bg-negative text-white */
.q-card, .q-card,
.q-table, .q-table,
.q-table__bottom, .q-table__bottom,

View File

@ -90,6 +90,7 @@ globals:
send: Send send: Send
code: Code code: Code
pageTitles: pageTitles:
logIn: Login
summary: Summary summary: Summary
basicData: Basic data basicData: Basic data
log: Logs log: Logs
@ -263,8 +264,6 @@ login:
loginError: Invalid username or password loginError: Invalid username or password
fieldRequired: This field is required fieldRequired: This field is required
twoFactorRequired: Two-factor verification required twoFactorRequired: Two-factor verification required
pageTitles:
logIn: Login
twoFactor: twoFactor:
code: Code code: Code
validate: Validate validate: Validate
@ -418,6 +417,18 @@ entry:
booked: Booked booked: Booked
confirmed: Confirmed confirmed: Confirmed
ordered: Ordered ordered: Ordered
tableVisibleColumns:
id: Id
reference: Reference
created: Creation
supplierFk: Supplier
isBooked: Booked
isConfirmed: Confirmed
isOrdered: Ordered
companyFk: Company
travelFk: Travel
isExcludedFromAvailable: Inventory
isRaid: Raid
summary: summary:
commission: Commission commission: Commission
currency: Currency currency: Currency
@ -493,34 +504,37 @@ entry:
landed: Landed landed: Landed
warehouseOut: Warehouse Out warehouseOut: Warehouse Out
latestBuys: latestBuys:
picture: Picture tableVisibleColumns:
itemFk: Item ID image: Picture
packing: Packing itemFk: Item ID
grouping: Grouping packing: Packing
quantity: Quantity grouping: Grouping
size: Size quantity: Quantity
tags: Tags size: Size
type: Type tags: Tags
intrastat: Intrastat type: Type
origin: Origin intrastat: Intrastat
weightByPiece: Weight/Piece origin: Origin
isActive: Active weightByPiece: Weight/Piece
family: Family isActive: Active
entryFk: Entry family: Family
buyingValue: Buying value entryFk: Entry
freightValue: Freight value buyingValue: Buying value
comissionValue: Commission value freightValue: Freight value
description: Description comissionValue: Commission value
packageValue: Package value description: Description
isIgnored: Is ignored packageValue: Package value
price2: Grouping isIgnored: Is ignored
price3: Packing price2: Grouping
minPrice: Min price3: Packing
ektFk: Ekt minPrice: Min
weight: Weight ektFk: Ekt
packagingFk: Package weight: Weight
packingOut: Package out packagingFk: Package
landing: Landing packingOut: Package out
landing: Landing
isExcludedFromAvailable: Es inventory
isRaid: Raid
ticket: ticket:
pageTitles: pageTitles:
tickets: Tickets tickets: Tickets
@ -1012,6 +1026,19 @@ wagon:
maxWagonHeight: 'The maximum height of the wagon is ' maxWagonHeight: 'The maximum height of the wagon is '
uncompleteTrays: There are incomplete trays uncompleteTrays: There are incomplete trays
route: route:
pageTitles:
agency: Agency List
routes: Routes
cmrsList: CMRs list
RouteList: List
routeCreate: New route
basicData: Basic Data
summary: Summary
RouteRoadmap: Roadmaps
RouteRoadmapCreate: Create roadmap
tickets: Tickets
log: Log
autonomous: Autonomous
cmr: cmr:
list: list:
results: results results: results
@ -1138,6 +1165,16 @@ supplier:
date: Date date: Date
reference: Reference reference: Reference
travel: travel:
travelList:
tableVisibleColumns:
id: Id
ref: Reference
agency: Agency
shipped: Shipped
landed: Landed
warehouseIn: Warehouse in
warehouseOut: Warehouse out
totalEntries: Total entries
summary: summary:
confirmed: Confirmed confirmed: Confirmed
entryId: Entry Id entryId: Entry Id

View File

@ -90,6 +90,7 @@ globals:
send: Enviar send: Enviar
code: Código code: Código
pageTitles: pageTitles:
logIn: Inicio de sesión
summary: Resumen summary: Resumen
basicData: Datos básicos basicData: Datos básicos
log: Historial log: Historial
@ -264,8 +265,6 @@ login:
loginError: Nombre de usuario o contraseña incorrectos loginError: Nombre de usuario o contraseña incorrectos
fieldRequired: Este campo es obligatorio fieldRequired: Este campo es obligatorio
twoFactorRequired: Verificación de doble factor requerida twoFactorRequired: Verificación de doble factor requerida
pageTitles:
logIn: Inicio de sesión
twoFactor: twoFactor:
code: Código code: Código
validate: Validar validate: Validar
@ -416,6 +415,18 @@ entry:
booked: Asentado booked: Asentado
confirmed: Confirmado confirmed: Confirmado
ordered: Pedida ordered: Pedida
tableVisibleColumns:
id: Id
reference: Referencia
created: Creación
supplierFk: Proveedor
isBooked: Asentado
isConfirmed: Confirmado
isOrdered: Pedida
companyFk: Empresa
travelFk: Envio
isExcludedFromAvailable: Inventario
isRaid: Redada
summary: summary:
commission: Comisión commission: Comisión
currency: Moneda currency: Moneda
@ -491,34 +502,37 @@ entry:
landed: F. entrega landed: F. entrega
warehouseOut: Alm. salida warehouseOut: Alm. salida
latestBuys: latestBuys:
picture: Foto tableVisibleColumns:
itemFk: ID Artículo image: Foto
packing: Packing itemFk: Id Artículo
grouping: Grouping packing: packing
quantity: Cantidad grouping: Grouping
size: Medida quantity: Cantidad
tags: Etiquetas size: Medida
type: Tipo tags: Etiquetas
intrastat: Intrastat type: Tipo
origin: Origen intrastat: Intrastat
weightByPiece: Peso (gramos)/tallo origin: Origen
isActive: Activo weightByPiece: Peso (gramos)/tallo
family: Familia isActive: Activo
entryFk: Entrada family: Familia
buyingValue: Coste entryFk: Entrada
freightValue: Porte buyingValue: Coste
comissionValue: Comisión freightValue: Porte
description: Descripción comissionValue: Comisión
packageValue: Embalaje description: Descripción
isIgnored: Ignorado packageValue: Embalaje
price2: Grouping isIgnored: Ignorado
price3: Packing price2: Grouping
minPrice: Min price3: Packing
ektFk: Ekt minPrice: Min
weight: Peso ektFk: Ekt
packagingFk: Embalaje weight: Peso
packingOut: Embalaje envíos packagingFk: Embalaje
landing: Llegada packingOut: Embalaje envíos
landing: Llegada
isExcludedFromAvailable: Es inventario
isRaid: Redada
ticket: ticket:
pageTitles: pageTitles:
tickets: Tickets tickets: Tickets
@ -1002,7 +1016,7 @@ route:
list: list:
results: resultados results: resultados
cmrFk: Id CMR cmrFk: Id CMR
hasCmrDms: Adjuntado en gestdoc hasCmrDms: Gestdoc
'true': 'true':
'false': 'No' 'false': 'No'
ticketFk: Id ticket ticketFk: Id ticket
@ -1124,6 +1138,16 @@ supplier:
date: Fecha date: Fecha
reference: Referencia reference: Referencia
travel: travel:
travelList:
tableVisibleColumns:
id: Id
ref: Referencia
agency: Agencia
shipped: Enviado
landed: Llegada
warehouseIn: Almacén de salida
warehouseOut: Almacén de entrada
totalEntries: Total de entradas
summary: summary:
confirmed: Confirmado confirmed: Confirmado
entryId: Id entrada entryId: Id entrada

View File

@ -1,72 +0,0 @@
<script setup>
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import CardList from 'src/components/ui/CardList.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const router = useRouter();
function navigate(id) {
router.push({ path: `/agency/${id}` });
}
function exprBuilder(param, value) {
if (!value) return;
if (param !== 'search') return;
if (!isNaN(value)) return { id: value };
return { name: { like: `%${value}%` } };
}
</script>
<template>
<VnSearchbar
:info="t('You can search by name')"
:label="t('Search agency')"
data-key="AgencyList"
url="Agencies"
/>
<QPage class="column items-center q-pa-md">
<div class="vn-card-list">
<VnPaginate
data-key="AgencyList"
url="Agencies"
order="name"
:expr-builder="exprBuilder"
>
<template #body="{ rows }">
<CardList
:id="row.id"
:key="row.id"
:title="row.name"
@click="navigate(row.id)"
v-for="row of rows"
>
<template #list-items>
<QCheckbox
:label="t('isOwn')"
v-model="row.isOwn"
:disable="true"
/>
<QCheckbox
:label="t('isAnyVolumeAllowed')"
v-model="row.isAnyVolumeAllowed"
:disable="true"
/>
</template>
</CardList>
</template>
</VnPaginate>
</div>
</QPage>
</template>
<i18n>
es:
isOwn: Tiene propietario
isAnyVolumeAllowed: Permite cualquier volumen
Search agency: Buscar agencia
You can search by name: Puedes buscar por nombre
en:
isOwn: Has owner
isAnyVolumeAllowed: Allows any volume
</i18n>

View File

@ -69,7 +69,7 @@ const filterOptions = {
<template #form="{ data, validate, filter }"> <template #form="{ data, validate, filter }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<VnInput <VnInput
:label="t('Comercial name')" :label="t('globals.name')"
:rules="validate('client.socialName')" :rules="validate('client.socialName')"
autofocus autofocus
clearable clearable

View File

@ -73,7 +73,7 @@ const creditWarning = computed(() => {
:text="t('customer.summary.basicData')" :text="t('customer.summary.basicData')"
/> />
<VnLv :label="t('customer.summary.customerId')" :value="entity.id" /> <VnLv :label="t('customer.summary.customerId')" :value="entity.id" />
<VnLv :label="t('customer.summary.name')" :value="entity.name" /> <VnLv :label="t('globals.name')" :value="entity.name" />
<VnLv :label="t('customer.summary.contact')" :value="entity.contact" /> <VnLv :label="t('customer.summary.contact')" :value="entity.contact" />
<VnLv :value="entity.phone"> <VnLv :value="entity.phone">
<template #label> <template #label>

View File

@ -38,7 +38,7 @@ const columns = computed(() => [
}, },
{ {
align: 'left', align: 'left',
label: t('customer.extendedList.tableVisibleColumns.name'), label: t('globals.name'),
name: 'name', name: 'name',
isTitle: true, isTitle: true,
create: true, create: true,
@ -408,6 +408,7 @@ function handleLocation(data, location) {
default-mode="table" default-mode="table"
redirect="customer" redirect="customer"
auto-load auto-load
:disable-option="{ card: true }"
> >
<template #more-create-dialog="{ data }"> <template #more-create-dialog="{ data }">
<VnLocation <VnLocation

View File

@ -11,8 +11,6 @@ import { toDate, toCurrency } from 'src/filters';
import { getUrl } from 'src/composables/getUrl'; import { getUrl } from 'src/composables/getUrl';
import axios from 'axios'; import axios from 'axios';
onUpdated(() => summaryRef.value.fetch());
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();

View File

@ -1,759 +1,200 @@
<script setup> <script setup>
import { onMounted, ref, computed, reactive, onUnmounted } from 'vue'; import { onMounted, ref, computed, reactive, onUnmounted } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import FetchedTags from 'components/ui/FetchedTags.vue';
import EntryDescriptorProxy from './Card/EntryDescriptorProxy.vue';
import TableVisibleColumns from 'src/components/common/TableVisibleColumns.vue';
import EditTableCellValueForm from 'src/components/EditTableCellValueForm.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import EntryLatestBuysFilter from './EntryLatestBuysFilter.vue';
import ItemDescriptorProxy from '../Item/Card/ItemDescriptorProxy.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { useStateStore } from 'stores/useStateStore';
import { toDate, toCurrency } from 'src/filters';
// import { useSession } from 'composables/useSession';
import { dashIfEmpty } from 'src/filters';
import { useArrayData } from 'composables/useArrayData';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
import VnImg from 'src/components/ui/VnImg.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import EntryLatestBuysFilter from './EntryLatestBuysFilter.vue';
const router = useRouter(); import { useStateStore } from 'stores/useStateStore';
// const { getTokenMultimedia } = useSession();
// const token = getTokenMultimedia();
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
import { toDate } from 'src/filters';
import VnImg from 'src/components/ui/VnImg.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const rowsFetchDataRef = ref(null); const columns = [
const itemTypesOptions = ref([]);
const originsOptions = ref([]);
const itemFamiliesOptions = ref([]);
const intrastatOptions = ref([]);
const packagingsOptions = ref([]);
const editTableCellDialogRef = ref(null);
const visibleColumns = ref([]);
const allColumnNames = ref([]);
const exprBuilder = (param, value) => {
switch (param) {
case 'id':
case 'size':
case 'weightByPiece':
case 'isActive':
case 'family':
case 'minPrice':
case 'packingOut':
return { [`i.${param}`]: value };
case 'name':
case 'description':
return { [`i.${param}`]: { like: `%${value}%` } };
case 'code':
return { 'it.code': value };
case 'intrastat':
return { 'intr.description': value };
case 'origin':
return { 'ori.code': value };
case 'landing':
return { [`lb.${param}`]: value };
case 'packing':
case 'grouping':
case 'quantity':
case 'entryFk':
case 'buyingValue':
case 'freightValue':
case 'comissionValue':
case 'packageValue':
case 'isIgnored':
case 'price2':
case 'price3':
case 'ektFk':
case 'weight':
case 'packagingFk':
return { [`b.${param}`]: value };
}
};
const params = reactive({});
const arrayData = useArrayData('EntryLatestBuys', {
url: 'Buys/latestBuysFilter',
order: ['itemFk DESC'],
exprBuilder: exprBuilder,
});
const store = arrayData.store;
const rows = computed(() => store.data);
const rowsSelected = ref([]);
const getInputEvents = (col) => {
return col.columnFilter.type === 'select'
? { 'update:modelValue': () => applyColumnFilter(col) }
: {
'keyup.enter': () => applyColumnFilter(col),
};
};
const columns = computed(() => [
{ {
label: t('entry.latestBuys.picture'), align: 'center',
name: 'picture', label: t('entry.latestBuys.tableVisibleColumns.image'),
align: 'left', name: 'image',
columnField: {
component: VnImg,
attrs: (id) => {
return {
id,
width: '50px',
};
},
},
columnFilter: false,
}, },
{ {
label: t('entry.latestBuys.itemFk'), align: 'left',
label: t('entry.latestBuys.tableVisibleColumns.itemFk'),
name: 'itemFk', name: 'itemFk',
field: 'itemFk', isTitle: true,
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
}, },
{ {
label: t('entry.latestBuys.packing'), align: 'left',
field: 'packing', label: t('entry.latestBuys.tableVisibleColumns.packing'),
name: 'packing', name: 'packing',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => dashIfEmpty(val),
}, },
{ {
label: t('entry.latestBuys.grouping'), align: 'left',
field: 'grouping', label: t('entry.latestBuys.tableVisibleColumns.grouping'),
name: 'grouping', name: 'grouping',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => dashIfEmpty(val),
}, },
{ {
label: t('entry.latestBuys.quantity'), align: 'left',
field: 'quantity', label: t('entry.latestBuys.tableVisibleColumns.quantity'),
name: 'quantity', name: 'quantity',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
}, },
{ {
label: t('entry.latestBuys.description'), align: 'left',
field: 'description', label: t('entry.latestBuys.tableVisibleColumns.description'),
name: 'description', name: 'description',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => dashIfEmpty(val),
}, },
{ {
label: t('entry.latestBuys.size'), align: 'left',
field: 'size', label: t('entry.latestBuys.tableVisibleColumns.size'),
name: 'size', name: 'size',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
}, },
{ {
label: t('entry.latestBuys.tags'), align: 'left',
label: t('entry.latestBuys.tableVisibleColumns.tags'),
name: 'tags', name: 'tags',
align: 'left',
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
}, },
{ {
label: t('entry.latestBuys.type'), align: 'left',
field: 'code', label: t('entry.latestBuys.tableVisibleColumns.type'),
name: 'type', name: 'type',
align: 'left',
sortable: true,
columnFilter: {
component: VnSelect,
type: 'select',
filterValue: null,
event: getInputEvents,
attrs: {
options: itemTypesOptions.value,
'option-value': 'code',
'option-label': 'code',
dense: true,
},
},
}, },
{ {
label: t('entry.latestBuys.intrastat'), align: 'left',
field: 'intrastat', label: t('entry.latestBuys.tableVisibleColumns.intrastat'),
name: 'intrastat', name: 'intrastat',
align: 'left',
sortable: true,
columnFilter: {
component: VnSelect,
type: 'select',
filterValue: null,
event: getInputEvents,
attrs: {
options: intrastatOptions.value,
'option-value': 'description',
'option-label': 'description',
dense: true,
},
},
}, },
{ {
label: t('entry.latestBuys.origin'), align: 'left',
field: 'origin', label: t('entry.latestBuys.tableVisibleColumns.origin'),
name: 'origin', name: 'origin',
align: 'left',
sortable: true,
columnFilter: {
component: VnSelect,
type: 'select',
filterValue: null,
event: getInputEvents,
attrs: {
options: originsOptions.value,
'option-value': 'code',
'option-label': 'code',
dense: true,
},
},
}, },
{ {
label: t('entry.latestBuys.weightByPiece'), align: 'left',
field: 'weightByPiece', label: t('entry.latestBuys.tableVisibleColumns.weightByPiece'),
name: 'weightByPiece', name: 'weightByPiece',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => dashIfEmpty(val),
}, },
{ {
label: t('entry.latestBuys.isActive'), align: 'left',
field: 'isActive', label: t('entry.latestBuys.tableVisibleColumns.isActive'),
name: 'isActive', name: 'isActive',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
}, },
{ {
label: t('entry.latestBuys.family'), align: 'left',
field: 'family', label: t('entry.latestBuys.tableVisibleColumns.family'),
name: 'family', name: 'family',
align: 'left',
sortable: true,
columnFilter: {
component: VnSelect,
type: 'select',
filterValue: null,
event: getInputEvents,
attrs: {
options: itemFamiliesOptions.value,
'option-value': 'code',
'option-label': 'code',
dense: true,
},
},
}, },
{ {
label: t('entry.latestBuys.entryFk'), align: 'left',
field: 'entryFk', label: t('entry.latestBuys.tableVisibleColumns.entryFk'),
name: 'entryFk', name: 'entryFk',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
}, },
{ {
label: t('entry.latestBuys.buyingValue'), align: 'left',
field: 'buyingValue', label: t('entry.latestBuys.tableVisibleColumns.buyingValue'),
name: 'buyingValue', name: 'buyingValue',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => toCurrency(val),
}, },
{ {
label: t('entry.latestBuys.freightValue'), align: 'left',
field: 'freightValue', label: t('entry.latestBuys.tableVisibleColumns.freightValue'),
name: 'freightValue', name: 'freightValue',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => toCurrency(val),
}, },
{ {
label: t('entry.latestBuys.comissionValue'), align: 'left',
field: 'comissionValue', label: t('entry.latestBuys.tableVisibleColumns.comissionValue'),
name: 'comissionValue', name: 'comissionValue',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => toCurrency(val),
}, },
{ {
label: t('entry.latestBuys.packageValue'), align: 'left',
field: 'packageValue', label: t('entry.latestBuys.tableVisibleColumns.packageValue'),
name: 'packageValue', name: 'packageValue',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => toCurrency(val),
}, },
{ {
label: t('entry.latestBuys.isIgnored'), align: 'left',
field: 'isIgnored', label: t('entry.latestBuys.tableVisibleColumns.isIgnored'),
name: 'isIgnored', name: 'isIgnored',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
}, },
{ {
label: t('entry.latestBuys.price2'), align: 'left',
field: 'price2', label: t('entry.latestBuys.tableVisibleColumns.price2'),
name: 'price2', name: 'price2',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => toCurrency(val),
}, },
{ {
label: t('entry.latestBuys.price3'), align: 'left',
field: 'price3', label: t('entry.latestBuys.tableVisibleColumns.price3'),
name: 'price3', name: 'price3',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => toCurrency(val),
}, },
{ {
label: t('entry.latestBuys.minPrice'), align: 'left',
field: 'minPrice', label: t('entry.latestBuys.tableVisibleColumns.minPrice'),
name: 'minPrice', name: 'minPrice',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => toCurrency(val),
}, },
{ {
label: t('entry.latestBuys.ektFk'), align: 'left',
field: 'ektFk', label: t('entry.latestBuys.tableVisibleColumns.ektFk'),
name: 'ektFk', name: 'ektFk',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => dashIfEmpty(val),
}, },
{ {
label: t('entry.latestBuys.weight'), align: 'left',
field: 'weight', label: t('entry.latestBuys.tableVisibleColumns.weight'),
name: 'weight', name: 'weight',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
}, },
{ {
label: t('entry.latestBuys.packagingFk'), align: 'left',
field: 'packagingFk', label: t('entry.latestBuys.tableVisibleColumns.packagingFk'),
name: 'packagingFk', name: 'packagingFk',
align: 'left',
sortable: true,
columnFilter: {
component: VnSelect,
type: 'select',
filterValue: null,
event: getInputEvents,
attrs: {
options: packagingsOptions.value,
'option-value': 'id',
'option-label': 'id',
dense: true,
},
},
}, },
{ {
label: t('entry.latestBuys.packingOut'), align: 'left',
field: 'packingOut', label: t('entry.latestBuys.tableVisibleColumns.packingOut'),
name: 'packingOut', name: 'packingOut',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => dashIfEmpty(val),
}, },
{ {
label: t('entry.latestBuys.landing'),
field: 'landing',
name: 'landing',
align: 'left', align: 'left',
sortable: true, label: t('entry.latestBuys.tableVisibleColumns.landing'),
columnFilter: { name: 'landing',
component: VnInput, component: 'date',
type: 'text', columnField: {
filterValue: null, component: null,
event: getInputEvents,
attrs: {
dense: true,
},
}, },
format: (val) => toDate(val), format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landing)),
}, },
]);
const editTableCellFormFieldsOptions = [
{ field: 'packing', label: t('entry.latestBuys.packing') },
{ field: 'grouping', label: t('entry.latestBuys.grouping') },
{ field: 'packageValue', label: t('entry.latestBuys.packageValue') },
{ field: 'weight', label: t('entry.latestBuys.weight') },
{ field: 'description', label: t('globals.description') },
{ field: 'size', label: t('entry.latestBuys.size') },
{ field: 'weightByPiece', label: t('entry.latestBuys.weightByPiece') },
{ field: 'packingOut', label: t('entry.latestBuys.packingOut') },
{ field: 'landing', label: t('entry.latestBuys.landing') },
]; ];
const openEditTableCellDialog = () => {
editTableCellDialogRef.value.show();
};
const onEditCellDataSaved = async () => {
rowsSelected.value = [];
await rowsFetchDataRef.value.fetch();
};
const redirectToEntryBuys = (entryFk) => {
router.push({ name: 'EntryBuys', params: { id: entryFk } });
};
const applyColumnFilter = async (col) => {
try {
params[col.field] = col.columnFilter.filterValue;
await arrayData.addFilter({ params });
} catch (err) {
console.error('Error applying column filter', err);
}
};
onMounted(async () => { onMounted(async () => {
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
const filteredColumns = columns.value.filter((col) => col.name !== 'picture');
allColumnNames.value = filteredColumns.map((col) => col.name);
await arrayData.fetch({ append: false });
}); });
onUnmounted(() => (stateStore.rightDrawer = false)); onUnmounted(() => (stateStore.rightDrawer = false));
</script> </script>
<template> <template>
<FetchData
url="ItemTypes"
:filter="{ fields: ['code'], order: 'code ASC', limit: 30 }"
auto-load
@on-fetch="(data) => (itemTypesOptions = data)"
/>
<FetchData
url="Origins"
:filter="{ fields: ['code'], order: 'code ASC', limit: 30 }"
auto-load
@on-fetch="(data) => (originsOptions = data)"
/>
<FetchData
url="ItemFamilies"
:filter="{ fields: ['code'], order: 'code ASC', limit: 30 }"
auto-load
@on-fetch="(data) => (itemFamiliesOptions = data)"
/>
<FetchData
url="Packagings"
:filter="{ fields: ['id'], order: 'id ASC', limit: 30 }"
auto-load
@on-fetch="(data) => (packagingsOptions = data)"
/>
<FetchData
url="Intrastats"
:filter="{ fields: ['description'], order: 'description ASC', limit: 30 }"
auto-load
@on-fetch="(data) => (intrastatOptions = data)"
/>
<VnSubToolbar>
<template #st-data>
<TableVisibleColumns
:all-columns="allColumnNames"
table-code="latestBuys"
labels-traductions-path="entry.latestBuys"
@on-config-saved="visibleColumns = ['picture', ...$event]"
/>
</template>
</VnSubToolbar>
<RightMenu> <RightMenu>
<template #right-panel> <template #right-panel>
<EntryLatestBuysFilter data-key="EntryLatestBuys" /> <EntryLatestBuysFilter data-key="LatestBuys" />
</template> </template>
</RightMenu> </RightMenu>
<Teleport to="#actions-append"> <VnSubToolbar />
<div class="row q-gutter-x-sm"> <VnTable
<QBtn flat @click="stateStore.toggleRightDrawer()" round dense icon="menu"> ref="tableRef"
<QTooltip bottom anchor="bottom right"> data-key="LatestBuys"
{{ t('globals.collapseMenu') }} url="Buys/latestBuysFilter"
</QTooltip> order="id DESC"
</QBtn> :columns="columns"
</div> redirect="entry"
</Teleport> default-mode="table"
<QPage class="column items-center q-pa-md"> auto-load
<QTable :right-search="false"
:rows="rows" />
:columns="columns"
selection="multiple"
row-key="id"
class="full-width q-mt-md"
:visible-columns="visibleColumns"
v-model:selected="rowsSelected"
:no-data-label="t('globals.noResults')"
@row-click="(_, row) => redirectToEntryBuys(row.entryFk)"
>
<template #top-row="{ cols }">
<QTr>
<QTd />
<QTd
v-for="(col, index) in cols"
:key="index"
style="max-width: 100px"
>
<component
:is="col.columnFilter.component"
v-if="col.name !== 'picture'"
v-model="col.columnFilter.filterValue"
v-bind="col.columnFilter.attrs"
v-on="col.columnFilter.event(col)"
dense
/>
</QTd>
</QTr>
</template>
<template #body-cell-picture="{ row }">
<QTd>
<VnImg :id="row.itemFk" size="50x50" class="image" />
</QTd>
</template>
<template #body-cell-itemFk="{ row }">
<QTd @click.stop>
<QBtn flat color="primary">
{{ row.itemFk }}
</QBtn>
<ItemDescriptorProxy :id="row.itemFk" />
</QTd>
</template>
<template #body-cell-tags="{ row }">
<QTd>
<FetchedTags :item="row" :max-length="6" />
</QTd>
</template>
<template #body-cell-entryFk="{ row }">
<QTd @click.stop>
<QBtn flat color="primary">
<EntryDescriptorProxy :id="row.entryFk" />
{{ row.entryFk }}
</QBtn>
</QTd>
</template>
<template #body-cell-isIgnored="{ row }">
<QTd>
<QIcon
:name="row.isIgnored ? `check` : `close`"
:color="row.isIgnored ? `positive` : `negative`"
size="sm"
/>
</QTd>
</template>
<template #body-cell-isActive="{ row }">
<QTd>
<QIcon
:name="row.isActive ? `check` : `close`"
:color="row.isActive ? `positive` : `negative`"
size="sm"
/>
</QTd>
</template>
</QTable>
<QPageSticky v-if="rowsSelected.length > 0" :offset="[20, 20]">
<QBtn @click="openEditTableCellDialog()" color="primary" fab icon="edit" />
<QTooltip>
{{ t('Edit buy(s)') }}
</QTooltip>
</QPageSticky>
<QDialog ref="editTableCellDialogRef">
<EditTableCellValueForm
edit-url="Buys/editLatestBuys"
:rows="rowsSelected"
:fields-options="editTableCellFormFieldsOptions"
@on-data-saved="onEditCellDataSaved()"
/>
</QDialog>
</QPage>
</template> </template>
<i18n> <i18n>

View File

@ -1,31 +1,178 @@
<script setup> <script setup>
import { onMounted } from 'vue'; import { onMounted, ref, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import VnPaginate from 'src/components/ui/VnPaginate.vue'; import { useRoute } from 'vue-router';
import VnLv from 'src/components/ui/VnLv.vue';
import CardList from 'src/components/ui/CardList.vue';
import EntrySummary from './Card/EntrySummary.vue';
import EntryFilter from './EntryFilter.vue'; import EntryFilter from './EntryFilter.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { toDate } from 'src/filters/index'; import VnTable from 'components/VnTable/VnTable.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
import { toDate } from 'src/filters';
const stateStore = useStateStore(); const stateStore = useStateStore();
const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
const { viewSummary } = useSummaryDialog(); const route = useRoute();
const entityId = computed(() => route.params.id);
const tableRef = ref();
function navigate(id) { const entryFilter = {
router.push({ path: `/entry/${id}` }); include: [
} {
relation: 'suppliers',
const redirectToCreateView = () => { scope: {
router.push({ name: 'EntryCreate' }); fields: ['id', 'name'],
},
},
{
relation: 'travels',
scope: {
fields: ['id', 'ref'],
},
},
{
relation: 'companies',
scope: {
fields: ['id', 'code'],
},
},
],
}; };
const columns = computed(() => [
{
align: 'left',
label: t('entry.list.tableVisibleColumns.id'),
name: 'id',
isTitle: true,
cardVisible: true,
},
{
align: 'left',
label: t('entry.list.tableVisibleColumns.reference'),
name: 'reference',
isTitle: true,
component: 'input',
columnField: {
component: null,
},
create: true,
cardVisible: true,
},
{
align: 'left',
label: t('entry.list.tableVisibleColumns.created'),
name: 'created',
create: true,
cardVisible: true,
component: 'date',
columnField: {
component: null,
},
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.created)),
},
{
align: 'left',
label: t('entry.list.tableVisibleColumns.supplierFk'),
name: 'supplierFk',
create: true,
cardVisible: true,
component: 'select',
attrs: {
url: 'suppliers',
fields: ['id', 'name'],
},
columnField: {
component: null,
},
format: (row, dashIfEmpty) => dashIfEmpty(row.supplierName),
},
{
align: 'left',
label: t('entry.list.tableVisibleColumns.isBooked'),
name: 'isBooked',
cardVisible: true,
create: true,
component: 'checkbox',
},
{
align: 'left',
label: t('entry.list.tableVisibleColumns.isConfirmed'),
name: 'isConfirmed',
cardVisible: true,
create: true,
component: 'checkbox',
},
{
align: 'left',
label: t('entry.list.tableVisibleColumns.isOrdered'),
name: 'isOrdered',
cardVisible: true,
create: true,
component: 'checkbox',
},
{
align: 'left',
label: t('entry.list.tableVisibleColumns.companyFk'),
name: 'companyFk',
component: 'select',
attrs: {
url: 'companies',
fields: ['id', 'code'],
optionLabel: 'code',
optionValue: 'id',
},
columnField: {
component: null,
},
create: true,
format: (row, dashIfEmpty) => dashIfEmpty(row.companyCode),
},
{
align: 'left',
label: t('entry.list.tableVisibleColumns.travelFk'),
name: 'travelFk',
component: 'select',
attrs: {
url: 'travels',
fields: ['id', 'ref'],
optionLabel: 'ref',
optionValue: 'id',
},
columnField: {
component: null,
},
create: true,
format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef),
},
{
align: 'left',
label: t('entry.list.tableVisibleColumns.isExcludedFromAvailable'),
name: 'isExcludedFromAvailable',
chip: {
color: null,
condition: (value) => value,
icon: 'vn:inventory',
},
columnFilter: {
inWhere: true,
},
},
{
align: 'left',
label: t('entry.list.tableVisibleColumns.isRaid'),
name: 'isRaid',
chip: {
color: null,
condition: (value) => value,
icon: 'vn:net',
},
columnFilter: {
inWhere: true,
},
},
]);
onMounted(async () => { onMounted(async () => {
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
}); });
@ -42,83 +189,24 @@ onMounted(async () => {
<EntryFilter data-key="EntryList" /> <EntryFilter data-key="EntryList" />
</template> </template>
</RightMenu> </RightMenu>
<QPage class="column items-center q-pa-md"> <VnTable
<div class="vn-card-list"> ref="tableRef"
<VnPaginate data-key="EntryList"
data-key="EntryList" url="Entries/filter"
url="Entries/filter" :filter="entryFilter"
:order="['landed DESC', 'id DESC']" :create="{
auto-load urlCreate: 'Entries',
> title: 'Create entry',
<template #body="{ rows }"> onDataSaved: ({ id }) => tableRef.redirect(id),
<CardList formInitialData: {},
v-for="row of rows" }"
:key="row.id" order="id DESC"
:title="row.reference" :columns="columns"
@click="navigate(row.id)" redirect="entry"
:id="row.id" default-mode="table"
:has-info-icons="!!row.isExcludedFromAvailable || !!row.isRaid" auto-load
> :right-search="false"
<template #info-icons> />
<QIcon
v-if="row.isExcludedFromAvailable"
name="vn:inventory"
color="primary"
size="xs"
>
<QTooltip>{{ t('Inventory entry') }}</QTooltip>
</QIcon>
<QIcon
v-if="row.isRaid"
name="vn:net"
color="primary"
size="xs"
>
<QTooltip>{{ t('Virtual entry') }}</QTooltip>
</QIcon>
</template>
<template #list-items>
<VnLv :label="t('landed')" :value="toDate(row.landed)" />
<VnLv
:label="t('entry.list.booked')"
:value="!!row.isBooked"
/>
<VnLv
:label="t('entry.list.invoiceNumber')"
:value="row.invoiceNumber"
/>
<VnLv
:label="t('entry.list.confirmed')"
:value="!!row.isConfirmed"
/>
<VnLv
:label="t('entry.list.supplier')"
:value="row.supplierName"
/>
<VnLv
:label="t('entry.list.ordered')"
:value="!!row.isOrdered"
/>
</template>
<template #actions>
<QBtn
:label="t('components.smartCard.openSummary')"
@click.stop="viewSummary(row.id, EntrySummary)"
color="primary"
type="submit"
/>
</template>
</CardList>
</template>
</VnPaginate>
</div>
</QPage>
<QPageSticky :offset="[20, 20]">
<QBtn fab icon="add" color="primary" @click="redirectToCreateView()" />
<QTooltip>
{{ t('entry.list.newEntry') }}
</QTooltip>
</QPageSticky>
</template> </template>
<i18n> <i18n>

View File

@ -0,0 +1,92 @@
<script setup>
import { computed } from 'vue';
import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import VnTable from 'components/VnTable/VnTable.vue';
const { t } = useI18n();
const router = useRouter();
function navigate(id) {
router.push({ path: `/agency/${id}` });
}
const exprBuilder = (param, value) => {
if (!value) return;
if (param !== 'search') return;
if (!isNaN(value)) return { id: value };
return { name: { like: `%${value}%` } };
};
const columns = computed(() => [
{
align: 'left',
name: 'id',
label: 'Id',
chip: {
condition: () => true,
},
isId: true,
},
{
align: 'left',
label: t('globals.name'),
name: 'name',
isTitle: true,
},
{
align: 'left',
label: t('isOwn'),
name: 'isOwn',
component: 'checkbox',
cardVisible: true,
},
{
align: 'left',
label: t('isAnyVolumeAllowed'),
name: 'isAnyVolumeAllowed',
component: 'checkbox',
cardVisible: true,
disable: true,
},
{
align: 'right',
label: '',
name: 'tableActions',
actions: [
{
title: t('Client ticket list'),
icon: 'preview',
action: (row) => navigate(row.id),
},
],
},
]);
</script>
<template>
<VnSearchbar
:info="t('You can search by name')"
:label="t('Search agency')"
data-key="AgencyList"
:expr-builder="exprBuilder"
/>
<VnTable
ref="tableRef"
data-key="AgencyList"
url="Agencies"
order="name"
:columns="columns"
:right-search="false"
:use-model="true"
/>
</template>
<i18n>
es:
isOwn: Tiene propietario
isAnyVolumeAllowed: Permite cualquier volumen
Search agency: Buscar agencia
You can search by name: Puedes buscar por nombre
en:
isOwn: Has owner
isAnyVolumeAllowed: Allows any volume
</i18n>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import AgencyDescriptor from 'pages/Agency/Card/AgencyDescriptor.vue'; import AgencyDescriptor from 'pages/Route/Agency/Card/AgencyDescriptor.vue';
import VnCard from 'components/common/VnCard.vue'; import VnCard from 'components/common/VnCard.vue';
</script> </script>
<template> <template>

View File

@ -18,12 +18,10 @@ const entityId = computed(() => $props.id || useRoute().params.id);
<template #header="{ entity: agency }">{{ agency.name }}</template> <template #header="{ entity: agency }">{{ agency.name }}</template>
<template #body="{ entity: agency }"> <template #body="{ entity: agency }">
<QCard class="vn-one"> <QCard class="vn-one">
<QCardSection class="q-pa-none"> <VnTitle
<VnTitle :url="`#/agency/${entityId}/basic-data`"
:url="`#/agency/${entityId}/basic-data`" :text="t('globals.pageTitles.basicData')"
:text="t('globals.pageTitles.basicData')" />
/>
</QCardSection>
<VnLv :label="t('globals.name')" :value="agency.name" /> <VnLv :label="t('globals.name')" :value="agency.name" />
<QCheckbox <QCheckbox
:label="t('agency.isOwn')" :label="t('agency.isOwn')"

View File

@ -9,7 +9,6 @@ const { t } = useI18n();
data-key="RouteList" data-key="RouteList"
:label="t('Search route')" :label="t('Search route')"
:info="t('You can search by route reference')" :info="t('You can search by route reference')"
custom-route-redirect-name="RouteList"
/> />
</template> </template>

View File

@ -154,7 +154,7 @@ const warehouses = ref();
es: es:
params: params:
cmrFk: Id cmr cmrFk: Id cmr
hasCmrDms: Adjuntado en gestdoc hasCmrDms: Gestdoc
ticketFk: Id ticket ticketFk: Id ticket
country: País country: País
clientFk: Id cliente clientFk: Id cliente

View File

@ -12,6 +12,8 @@ import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
import { useStateStore } from 'src/stores/useStateStore'; import { useStateStore } from 'src/stores/useStateStore';
import VnTable from 'components/VnTable/VnTable.vue';
const { t } = useI18n(); const { t } = useI18n();
const { getTokenMultimedia } = useSession(); const { getTokenMultimedia } = useSession();
const token = getTokenMultimedia(); const token = getTokenMultimedia();
@ -107,88 +109,15 @@ function downloadPdfs() {
} }
</script> </script>
<template> <template>
<RightMenu> <VnTable
<template #right-panel> ref="tableRef"
<CmrFilter data-key="CmrList" /> data-key="CmrList"
</template> url="Routes/cmrs"
</RightMenu> order="cmrFk DESC"
<div class="column items-center"> :columns="columns"
<div class="list"> :right-search="true"
<VnPaginate data-key="CmrList" :url="`Routes/cmrs`" order="cmrFk DESC"> :use-model="true"
<template #body="{ rows }"> />
<QTable
:columns="columns"
:rows="rows"
:dense="$q.screen.lt.md"
row-key="cmrFk"
selection="multiple"
v-model:selected="selected"
:grid="$q.screen.lt.md"
auto-load
>
<template #top>
<div style="width: 100%; display: table">
<div style="float: right; color: lightgray">
{{ `${rows.length} ${t('route.cmr.list.results')}` }}
</div>
</div>
</template>
<template #body-cell-hasCmrDms="{ value }">
<QTd align="center">
<QBadge
text-color="black"
:id="value ? 'true' : 'false'"
:label="
value
? t('route.cmr.list.true')
: t('route.cmr.list.false')
"
/>
</QTd>
</template>
<template #body-cell-ticketFk="{ value }">
<QTd align="right" class="text-primary">
<span class="text-primary link">{{ value }}</span>
<TicketDescriptorProxy :id="value" />
</QTd>
</template>
<template #body-cell-clientFk="{ value }">
<QTd align="right" class="text-primary">
<span class="text-primary link">{{ value }}</span>
<CustomerDescriptorProxy :id="value" />
</QTd>
</template>
<template #body-cell-warehouseFk="{ value }">
<QTd align="center">
{{ warehouses.find(({ id }) => id === value)?.name }}
</QTd>
</template>
<template #body-cell-icons="{ value }">
<QTd align="center">
<a :href="getCmrUrl(value)" target="_blank">
<QIcon
name="visibility"
color="primary"
size="md"
class="q-mr-sm q-ml-sm"
/>
<QTooltip>
{{ t('route.cmr.list.viewCmr') }}
</QTooltip>
</a>
</QTd>
</template>
</QTable>
</template>
</VnPaginate>
</div>
<QPageSticky :offset="[20, 20]">
<QBtn @click="downloadPdfs" fab icon="cloud_download" color="primary" />
<QTooltip>
{{ t('route.cmr.list.downloadCmrs') }}
</QTooltip>
</QPageSticky>
</div>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.list { .list {

View File

@ -1,29 +1,32 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useArrayData } from 'composables/useArrayData';
import { computed, onMounted, ref } from 'vue';
import { dashIfEmpty, toHour } from 'src/filters'; import { dashIfEmpty, toHour } from 'src/filters';
import { computed, onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useValidator } from 'composables/useValidator'; import { useValidator } from 'composables/useValidator';
import { useSession } from 'composables/useSession'; import { useSession } from 'composables/useSession';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { useArrayData } from 'composables/useArrayData';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import axios from 'axios'; import axios from 'axios';
import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue'; import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import TableVisibleColumns from 'src/components/common/TableVisibleColumns.vue';
import RouteSummary from 'pages/Route/Card/RouteSummary.vue';
import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
import RouteListTicketsDialog from 'pages/Route/Card/RouteListTicketsDialog.vue'; import RouteListTicketsDialog from 'pages/Route/Card/RouteListTicketsDialog.vue';
import { useRouter } from 'vue-router';
import TableVisibleColumns from 'src/components/common/TableVisibleColumns.vue';
import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
import RouteSummary from 'pages/Route/Card/RouteSummary.vue';
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnPaginate from 'components/ui/VnPaginate.vue';
import VnSelect from 'components/common/VnSelect.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import VnInput from 'components/common/VnInput.vue'; import VnInput from 'components/common/VnInput.vue';
import VnInputTime from 'components/common/VnInputTime.vue'; import VnInputTime from 'components/common/VnInputTime.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnSelect from 'components/common/VnSelect.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import VnTable from 'components/VnTable/VnTable.vue';
import { useStateStore } from 'src/stores/useStateStore';
const { t } = useI18n(); const { t } = useI18n();
const { validate } = useValidator(); const { validate } = useValidator();
@ -40,90 +43,100 @@ const allColumnNames = ref([]);
const confirmationDialog = ref(false); const confirmationDialog = ref(false);
const startingDate = ref(null); const startingDate = ref(null);
const refreshKey = ref(0); const refreshKey = ref(0);
const router = useRouter();
const stateStore = useStateStore();
const columns = computed(() => [ const columns = computed(() => [
{ {
name: 'Id', align: 'left',
label: t('Id'), name: 'id',
field: (row) => row.id, label: 'Id',
sortable: true, chip: {
align: 'center', condition: () => true,
},
isId: true,
columnFilter: {
name: 'search',
},
}, },
{ {
align: 'left',
name: 'worker', name: 'worker',
label: t('Worker'), label: t('Worker'),
field: (row) => row.workerUserName, create: true,
sortable: true, component: 'select',
align: 'left', attrs: {
url: 'payrollComponents',
fields: ['id', 'name'],
},
cardVisible: true,
}, },
{ {
name: 'agency', name: 'agency',
label: t('Agency'), label: t('Agency'),
field: (row) => row.agencyName,
sortable: true,
align: 'left', align: 'left',
isTitle: true,
cardVisible: true,
create: true,
}, },
{ {
name: 'vehicle', name: 'vehicle',
label: t('Vehicle'), label: t('Vehicle'),
field: (row) => row.vehiclePlateNumber,
sortable: true,
align: 'left', align: 'left',
cardVisible: true,
create: true,
}, },
{ {
name: 'date', name: 'date',
label: t('Date'), label: t('Date'),
field: (row) => row.created,
sortable: true,
align: 'left', align: 'left',
cardVisible: true,
create: true,
}, },
{ {
name: 'volume', name: 'volume',
label: 'm³', label: 'm³',
field: (row) => dashIfEmpty(row.m3),
sortable: true,
align: 'center', align: 'center',
cardVisible: true,
}, },
{ {
name: 'description', name: 'description',
label: t('Description'), label: t('Description'),
field: (row) => row.description,
sortable: true,
align: 'left', align: 'left',
isTitle: true,
create: true,
}, },
{ {
name: 'started', name: 'started',
label: t('hourStarted'), label: t('hourStarted'),
field: (row) => toHour(row.started),
sortable: true,
align: 'left', align: 'left',
}, },
{ {
name: 'finished', name: 'finished',
label: t('hourFinished'), label: t('hourFinished'),
field: (row) => toHour(row.finished),
sortable: true,
align: 'left', align: 'left',
}, },
{ {
name: 'isServed', name: 'isServed',
label: t('Served'), label: t('Served'),
field: (row) => Boolean(row.isOk),
sortable: true,
align: 'left', align: 'left',
}, },
{ {
name: 'actions',
label: '',
sortable: false,
align: 'right', align: 'right',
label: 'asdasd',
name: 'tableActions',
actions: [
{
title: t('Client ticket list'),
icon: 'preview',
action: (row) => navigate(row.id),
},
],
}, },
]); ]);
const arrayData = useArrayData('EntryLatestBuys', { function navigate(id) {
url: 'Buys/latestBuysFilter', router.push({ path: `/route/${id}` });
order: ['itemFk DESC'], }
});
const updateRoute = async (route) => { const updateRoute = async (route) => {
try { try {
@ -181,20 +194,10 @@ const openTicketsDialog = (id) => {
}) })
.onOk(() => refreshKey.value++); .onOk(() => refreshKey.value++);
}; };
onMounted(async () => {
allColumnNames.value = columns.value.map((col) => col.name);
await arrayData.fetch({ append: false });
});
</script> </script>
<template> <template>
<RouteSearchbar /> <RouteSearchbar />
<RightMenu>
<template #right-panel>
<RouteFilter data-key="RouteList" />
</template>
</RightMenu>
<QDialog v-model="confirmationDialog"> <QDialog v-model="confirmationDialog">
<QCard style="min-width: 350px"> <QCard style="min-width: 350px">
<QCardSection> <QCardSection>
@ -227,256 +230,53 @@ onMounted(async () => {
/> />
<FetchData url="AgencyModes" @on-fetch="(data) => (agencyList = data)" auto-load /> <FetchData url="AgencyModes" @on-fetch="(data) => (agencyList = data)" auto-load />
<FetchData url="Vehicles" @on-fetch="(data) => (vehicleList = data)" auto-load /> <FetchData url="Vehicles" @on-fetch="(data) => (vehicleList = data)" auto-load />
<QPage class="column items-center"> <VnSubToolbar />
<VnSubToolbar> <VnTable
<template #st-data> ref="tableRef"
<TableVisibleColumns data-key="RouteList"
class="LeftIcon" url="Routes/filter"
:all-columns="allColumnNames" :columns="columns"
table-code="routesList" :right-search="true"
labels-traductions-path="route.columnLabels" default-mode="table"
@on-config-saved="visibleColumns = [...$event]" :is-editable="true"
/> :create="{
</template> urlCreate: 'Routes',
<template #st-actions> title: t('Create route'),
<QBtn onDataSaved: () => tableRef.reload(),
icon="vn:clone" }"
color="primary" save-url="routes"
class="q-mr-sm" :disable-option="{ card: true }"
:disable="!selectedRows?.length" >
@click="confirmationDialog = true" <template #moreBeforeActions>
> <QBtn
<QTooltip>{{ t('Clone Selected Routes') }}</QTooltip> icon="vn:clone"
</QBtn> color="primary"
<QBtn class="q-mr-sm"
icon="cloud_download" :disable="!selectedRows?.length"
color="primary" @click="confirmationDialog = true"
class="q-mr-sm"
:disable="!selectedRows?.length"
@click="showRouteReport"
>
<QTooltip>{{ t('Download selected routes as PDF') }}</QTooltip>
</QBtn>
<QBtn
icon="check"
color="primary"
class="q-mr-sm"
:disable="!selectedRows?.length"
@click="markAsServed()"
>
<QTooltip>{{ t('Mark as served') }}</QTooltip>
</QBtn>
</template>
</VnSubToolbar>
<div class="route-list">
<VnPaginate
:key="refreshKey"
data-key="RouteList"
url="Routes/filter"
:order="['created ASC', 'started ASC', 'id ASC']"
:limit="20"
> >
<template #body="{ rows }"> <QTooltip>{{ t('Clone Selected Routes') }}</QTooltip>
<div class="q-pa-md route-table"> </QBtn>
<QTable <QBtn
v-model:selected="selectedRows" icon="cloud_download"
:columns="columns" color="primary"
:rows="rows" class="q-mr-sm"
flat :disable="!selectedRows?.length"
row-key="id" @click="showRouteReport"
selection="multiple" >
:rows-per-page-options="[0]" <QTooltip>{{ t('Download selected routes as PDF') }}</QTooltip>
:visible-columns="visibleColumns" </QBtn>
hide-pagination <QBtn
:no-data-label="t('globals.noResults')" icon="check"
style="max-height: 82vh" color="primary"
> class="q-mr-sm"
<template #body-cell-worker="{ row }"> :disable="!selectedRows?.length"
<QTd class="table-input-cell"> @click="markAsServed()"
<VnSelect >
:label="t('Worker')" <QTooltip>{{ t('Mark as served') }}</QTooltip>
v-model="row.workerFk" </QBtn>
:options="workers" </template>
option-value="id" </VnTable>
option-label="nickname"
hide-selected
dense
:emit-value="false"
:rules="validate('Route.workerFk')"
:is-clearable="false"
@update:model-value="updateRoute(row)"
>
<template #option="{ opt, itemProps }">
<QItem
v-bind="itemProps"
class="q-pa-xs row items-center"
>
<QItemSection
class="col-9 justify-center"
>
<span>{{ opt.name }}</span>
<span class="text-grey">{{
opt.nickname
}}</span>
</QItemSection>
</QItem>
</template>
</VnSelect>
</QTd>
</template>
<template #body-cell-agency="{ row }">
<QTd class="table-input-cell">
<VnSelect
:label="t('Agency')"
v-model="row.agencyModeFk"
:options="agencyList"
option-value="id"
option-label="name"
hide-selected
dense
:emit-value="false"
:rules="validate('route.agencyFk')"
:is-clearable="false"
@update:model-value="updateRoute(row)"
/>
</QTd>
</template>
<template #body-cell-vehicle="{ row }">
<QTd class="table-input-cell small-column">
<VnSelect
:label="t('Vehicle')"
v-model="row.vehicleFk"
:options="vehicleList"
option-value="id"
option-label="numberPlate"
hide-selected
dense
:emit-value="false"
:rules="validate('route.vehicleFk')"
:is-clearable="false"
@update:model-value="updateRoute(row)"
/>
</QTd>
</template>
<template #body-cell-date="{ row }">
<QTd class="table-input-cell small-column">
<VnInputDate
v-model="row.created"
hide-bottom-space
dense
:label="t('Date')"
:rules="validate('route.created')"
:is-clearable="false"
@update:model-value="updateRoute(row)"
/>
</QTd>
</template>
<template #body-cell-description="{ row }">
<QTd class="table-input-cell">
<VnInput
v-model="row.description"
:label="t('Description')"
:rules="validate('route.description')"
:is-clearable="false"
dense
@update:model-value="updateRoute(row)"
/>
</QTd>
</template>
<template #body-cell-started="{ row }">
<QTd class="table-input-cell small-column">
<VnInputTime
v-model="row.started"
:label="t('hourStarted')"
:rules="validate('route.started')"
:is-clearable="false"
hide-bottom-space
dense
@update:model-value="updateRoute(row)"
/>
</QTd>
</template>
<template #body-cell-finished="{ row }">
<QTd class="table-input-cell small-column">
<VnInputTime
v-model="row.finished"
autofocus
:label="t('hourFinished')"
:rules="validate('route.finished')"
:is-clearable="false"
hide-bottom-space
dense
@update:model-value="updateRoute(row)"
/>
</QTd>
</template>
<template #body-cell-isServed="props">
<QTd class="table-input-cell small-column">
<QCheckbox v-model="props.value" disable>
<QTooltip>
{{
props.value
? t('Route is closed')
: t('Route is not served')
}}
</QTooltip>
</QCheckbox>
</QTd>
</template>
<template #body-cell-actions="props">
<QTd :props="props">
<div class="flex items-center no-wrap table-actions">
<QIcon
name="vn:ticketAdd"
size="sm"
color="primary"
class="cursor-pointer"
@click="openTicketsDialog(props?.row?.id)"
>
<QTooltip>{{ t('Add ticket') }}</QTooltip>
</QIcon>
<QIcon
name="preview"
size="sm"
color="primary"
@click="
viewSummary(props?.row?.id, RouteSummary)
"
class="cursor-pointer"
>
<QTooltip>{{ t('Preview') }}</QTooltip>
</QIcon>
<RouterLink
:to="{
name: 'RouteSummary',
params: { id: props?.row?.id },
}"
>
<QIcon
name="vn:eye"
size="xs"
color="primary"
>
<QTooltip>{{ t('Summary') }}</QTooltip>
</QIcon>
</RouterLink>
</div>
</QTd>
</template>
</QTable>
</div>
</template>
</VnPaginate>
</div>
<QPageSticky :offset="[20, 20]">
<RouterLink :to="{ name: 'RouteCreate' }">
<QBtn fab icon="add" color="primary" />
<QTooltip>
{{ t('newRoute') }}
</QTooltip>
</RouterLink>
</QPageSticky>
</QPage>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -2,7 +2,7 @@
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'src/components/LeftMenu.vue'; import LeftMenu from 'src/components/LeftMenu.vue';
import { onMounted } from 'vue'; import { onMounted } from 'vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
onMounted(() => (stateStore.leftDrawer = false)); onMounted(() => (stateStore.leftDrawer = false));
</script> </script>

View File

@ -33,8 +33,12 @@ const filter = {
<template> <template>
<VnCard <VnCard
data-key="Travel" data-key="Travel"
:filter="filter"
base-url="Travels" base-url="Travels"
search-data-key="TravelList"
searchbar-label="Search travel"
searchbar-info="You can search by travel id or name"
search-url="Travels"
:filter="filter"
:descriptor="TravelDescriptor" :descriptor="TravelDescriptor"
/> />
</template> </template>

View File

@ -12,8 +12,6 @@ import FetchData from 'src/components/FetchData.vue';
import { toDate, toCurrency } from 'src/filters'; import { toDate, toCurrency } from 'src/filters';
import axios from 'axios'; import axios from 'axios';
onUpdated(() => summaryRef.value.fetch());
const $props = defineProps({ const $props = defineProps({
id: { id: {
type: Number, type: Number,

View File

@ -2,31 +2,27 @@
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import VnPaginate from 'src/components/ui/VnPaginate.vue'; import { useRoute } from 'vue-router';
import CardList from 'src/components/ui/CardList.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import TravelSummary from './Card/TravelSummary.vue';
import TravelFilter from './TravelFilter.vue';
import FetchData from 'components/FetchData.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { toDate } from 'src/filters/index'; import VnTable from 'components/VnTable/VnTable.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { getDateQBadgeColor } from 'src/composables/getDateQBadgeColor.js'; import { computed } from 'vue';
import RightMenu from 'src/components/common/RightMenu.vue'; import TravelSummary from './Card/TravelSummary.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
import { dashIfEmpty, toDate } from 'src/filters';
const { viewSummary } = useSummaryDialog();
const router = useRouter(); const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
const stateStore = useStateStore(); const stateStore = useStateStore();
const { viewSummary } = useSummaryDialog(); const route = useRoute();
const tableRef = ref();
const warehouses = ref([]); const $props = defineProps({
id: {
const navigateToTravelId = (id) => { type: Number,
router.push({ path: `/travel/${id}` }); default: 0,
}; },
});
const entityId = computed(() => $props.id || route.params.id);
const cloneTravel = (travelData) => { const cloneTravel = (travelData) => {
const stringifiedTravelData = JSON.stringify(travelData); const stringifiedTravelData = JSON.stringify(travelData);
redirectToCreateView(stringifiedTravelData); redirectToCreateView(stringifiedTravelData);
@ -40,125 +36,170 @@ const redirectCreateEntryView = (travelData) => {
router.push({ name: 'EntryCreate', query: { travelFk: travelData.id } }); router.push({ name: 'EntryCreate', query: { travelFk: travelData.id } });
}; };
const getWarehouseName = (id) => {
return warehouses.value.find((warehouse) => warehouse.id === id).name;
};
onMounted(async () => { onMounted(async () => {
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
}); });
const columns = computed(() => [
{
align: 'left',
name: 'id',
label: t('travel.travelList.tableVisibleColumns.id'),
isId: true,
field: 'id',
cardVisible: true,
},
{
align: 'left',
name: 'ref',
label: t('travel.travelList.tableVisibleColumns.ref'),
field: 'ref',
component: 'input',
columnField: {
component: null,
},
cardVisible: true,
create: true,
},
{
align: 'left',
name: 'agencyModeFk',
label: t('travel.travelList.tableVisibleColumns.agency'),
field: 'agencyModeFk',
component: 'select',
attrs: {
url: 'agencyModes',
fields: ['id', 'name'],
},
columnField: {
component: null,
},
cardVisible: true,
create: true,
},
{
align: 'left',
name: 'shipped',
label: t('travel.travelList.tableVisibleColumns.shipped'),
field: 'shipped',
component: 'date',
columnField: {
component: null,
},
cardVisible: true,
create: true,
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.shipped)),
},
{
align: 'left',
name: 'landed',
label: t('travel.travelList.tableVisibleColumns.landed'),
field: 'landed',
component: 'date',
columnField: {
component: null,
},
cardVisible: true,
create: true,
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landed)),
},
{
align: 'left',
name: 'warehouseInFk',
label: t('travel.travelList.tableVisibleColumns.warehouseIn'),
field: 'warehouseInFk',
component: 'select',
attrs: {
url: 'warehouses',
fields: ['id', 'name'],
},
columnField: {
component: null,
},
cardVisible: true,
create: true,
},
{
align: 'left',
name: 'warehouseOutFk',
label: t('travel.travelList.tableVisibleColumns.warehouseOut'),
field: 'warehouseOutFk',
component: 'select',
attrs: {
url: 'warehouses',
fields: ['id', 'name'],
},
columnField: {
component: null,
},
cardVisible: true,
create: true,
},
{
align: 'left',
name: 'totalEntries',
label: t('travel.travelList.tableVisibleColumns.totalEntries'),
field: 'totalEntries',
component: 'input',
columnField: {
component: null,
},
cardVisible: true,
create: true,
},
{
align: 'right',
label: '',
name: 'tableActions',
actions: [
{
title: t('Clone'),
icon: 'vn:clone',
action: cloneTravel,
isPrimary: true,
},
{
title: t('Add entry'),
icon: 'contact_support',
action: redirectCreateEntryView,
},
{
title: t('View Summary'),
icon: 'preview',
action: (row) => viewSummary(row.id, TravelSummary),
},
],
},
]);
</script> </script>
<template> <template>
<FetchData <VnSearchbar
url="Warehouses" :info="t('You can search by travel id or name')"
:filter="{ fields: ['id', 'name'] }" :label="t('Search travel')"
order="name" data-key="TravelList"
@on-fetch="(data) => (warehouses = data)" />
auto-load <VnTable
ref="tableRef"
data-key="TravelList"
url="Travels"
:create="{
urlCreate: 'Travels',
title: t('Create Travels'),
onDataSaved: ({ id }) => tableRef.redirect(id),
formInitialData: {
editorFk: entityId,
},
}"
order="landed DESC"
:columns="columns"
default-mode="table"
auto-load
redirect="travel"
:right-search="false"
:is-editable="false"
:use-model="true"
/> />
<VnSearchbar data-key="TravelList" :limit="20" :label="t('searchByIdOrReference')" />
<RightMenu>
<template #right-panel>
<TravelFilter data-key="TravelList" />
</template>
</RightMenu>
<QPage class="column items-center q-pa-md">
<div class="vn-card-list">
<VnPaginate
data-key="TravelList"
url="Travels/filter"
auto-load
order="shipped DESC, landed DESC"
>
<template #body="{ rows }">
<CardList
v-for="row of rows"
:key="row.id"
:title="row.ref"
:id="row.id"
@click="navigateToTravelId(row.id)"
>
<template #list-items>
<VnLv
:label="t('globals.agency')"
:value="row.agencyModeName"
/>
<VnLv
v-if="warehouses.length > 0"
:label="t('globals.wareHouseOut')"
:value="getWarehouseName(row.warehouseOutFk)"
/>
<VnLv :label="t('globals.shipped')">
<template #value>
<QBadge
text-color="black"
v-if="getDateQBadgeColor(row.shipped)"
:color="getDateQBadgeColor(row.shipped)"
class="q-ma-none"
dense
style="font-size: 14px"
>
{{ toDate(row.shipped) }}
</QBadge>
<span v-else>{{ toDate(row.shipped) }}</span>
</template>
</VnLv>
<VnLv :label="t('globals.landed')">
<template #value>
<QBadge
text-color="black"
v-if="getDateQBadgeColor(row.landed)"
:color="getDateQBadgeColor(row.landed)"
class="q-ma-none"
dense
style="font-size: 14px"
>
{{ toDate(row.landed) }}
</QBadge>
<span v-else>{{ toDate(row.landed) }}</span>
</template>
</VnLv>
<VnLv
v-if="warehouses.length > 0"
:label="t('globals.wareHouseIn')"
:value="getWarehouseName(row.warehouseInFk)"
/>
<VnLv
:label="t('globals.totalEntries')"
:value="row.totalEntries"
/>
</template>
<template #actions>
<QBtn
:label="t('components.smartCard.clone')"
@click.stop="cloneTravel(row)"
outline
/>
<QBtn
:label="t('addEntry')"
@click.stop="redirectCreateEntryView(row)"
outline
style="margin-top: 15px"
/>
<QBtn
:label="t('components.smartCard.openSummary')"
@click.stop="viewSummary(row.id, TravelSummary)"
color="primary"
style="margin-top: 15px"
/>
</template>
</CardList>
</template>
</VnPaginate>
</div>
<QPageSticky :offset="[20, 20]">
<QBtn fab icon="add" color="primary" @click="redirectToCreateView()" />
<QTooltip>
{{ t('supplier.list.newSupplier') }}
</QTooltip>
</QPageSticky>
</QPage>
</template> </template>
<i18n> <i18n>
@ -169,4 +210,6 @@ en:
es: es:
addEntry: Añadir entrada addEntry: Añadir entrada
searchByIdOrReference: Buscar por ID o por referencia searchByIdOrReference: Buscar por ID o por referencia
You can search by travel id or name: Buscar por envio por id o nombre
Search travel: Buscar envio
</i18n> </i18n>

View File

@ -18,7 +18,7 @@ export default {
{ {
path: '/agency/:id', path: '/agency/:id',
name: 'AgencyCard', name: 'AgencyCard',
component: () => import('src/pages/Agency/Card/AgencyCard.vue'), component: () => import('src/pages/Route/Agency/Card/AgencyCard.vue'),
redirect: { name: 'AgencySummary' }, redirect: { name: 'AgencySummary' },
children: [ children: [
{ {
@ -28,7 +28,8 @@ export default {
title: 'summary', title: 'summary',
icon: 'view_list', icon: 'view_list',
}, },
component: () => import('src/pages/Agency/Card/AgencySummary.vue'), component: () =>
import('src/pages/Route/Agency/Card/AgencySummary.vue'),
}, },
{ {
name: 'AgencyBasicData', name: 'AgencyBasicData',
@ -37,7 +38,8 @@ export default {
title: 'basicData', title: 'basicData',
icon: 'vn:settings', icon: 'vn:settings',
}, },
component: () => import('pages/Agency/Card/AgencyBasicData.vue'), component: () =>
import('pages/Route/Agency/Card/AgencyBasicData.vue'),
}, },
{ {
path: 'workCenter', path: 'workCenter',
@ -52,7 +54,9 @@ export default {
title: 'workCenters', title: 'workCenters',
}, },
component: () => component: () =>
import('src/pages/Agency/Card/AgencyWorkcenter.vue'), import(
'src/pages/Route/Agency/Card/AgencyWorkcenter.vue'
),
}, },
], ],
}, },
@ -69,7 +73,7 @@ export default {
title: 'modes', title: 'modes',
}, },
component: () => component: () =>
import('src/pages/Agency/Card/AgencyModes.vue'), import('src/pages/Route/Agency/Card/AgencyModes.vue'),
}, },
], ],
}, },
@ -80,7 +84,7 @@ export default {
title: 'log', title: 'log',
icon: 'history', icon: 'history',
}, },
component: () => import('src/pages/Agency/Card/AgencyLog.vue'), component: () => import('src/pages/Route/Agency/Card/AgencyLog.vue'),
}, },
], ],
}, },

View File

@ -86,7 +86,8 @@ export default {
title: 'agencyList', title: 'agencyList',
icon: 'view_list', icon: 'view_list',
}, },
component: () => import('src/pages/Agency/AgencyList.vue'), component: () =>
import('src/pages/Route/Agency/AgencyList.vue'),
}, },
], ],
}, },