0
0
Fork 0
This commit is contained in:
Javier Segarra 2024-07-01 11:40:57 +02:00
parent 666cb519c5
commit 379d90d4c9
4 changed files with 41 additions and 32 deletions

View File

@ -70,7 +70,7 @@ function getRoutes() {
(route) => toLowerCamel(route.name) === item.module (route) => toLowerCamel(route.name) === item.module
); );
if (!moduleDef) continue; if (!moduleDef) continue;
if (!role.isEmployee()) continue; // if (!role.isEmployee()) continue;
item.children = []; item.children = [];
addChildren(item.module, moduleDef, item.children); addChildren(item.module, moduleDef, item.children);

View File

@ -28,7 +28,7 @@ export function useRole() {
return false; return false;
} }
function isEmployee() { function isEmployee() {
return !hasAny(['employee']); return hasAny(['employee']);
} }
return { return {

View File

@ -17,6 +17,8 @@ import { useQuasar } from 'quasar';
import { toCurrency } from 'src/filters'; import { toCurrency } from 'src/filters';
import axios from 'axios'; import axios from 'axios';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
import { usePrintService } from 'composables/usePrintService';
const { openReport } = usePrintService();
const quasar = useQuasar(); const quasar = useQuasar();
const route = useRoute(); const route = useRoute();
@ -31,18 +33,14 @@ const $props = defineProps({
}, },
}); });
const rowsSelected = ref([]); const rowsSelected = ref([]);
const entityId = computed(() => $props.id || route.params.id);
const entriesTableColumns = computed(() => [ const entriesTableColumns = computed(() => [
{ {
align: 'left', align: 'left',
name: 'item', name: 'item',
label: t('entry.summary.item'), label: t('entry.summary.item'),
field: 'itemFk', field: (row) => row.item.name,
format: (row) => row.item.name,
// component: 'fetchedTags',
// attrs: {
// item: (row) => row.item,
// },
}, },
{ {
align: 'left', align: 'left',
@ -90,8 +88,7 @@ const entriesTableColumns = computed(() => [
align: 'left', align: 'left',
name: 'buyingValue', name: 'buyingValue',
label: t('entry.summary.buyingValue'), label: t('entry.summary.buyingValue'),
field: 'buyingValue', field: ({ buyingValue }) => toCurrency(buyingValue),
format: ({ buyingValue }) => toCurrency(buyingValue),
}, },
{ {
align: 'left', align: 'left',
@ -109,20 +106,9 @@ const entriesTableColumns = computed(() => [
align: 'left', align: 'left',
name: 'import', name: 'import',
label: t('entry.summary.import'), label: t('entry.summary.import'),
format: (row) => toCurrency(row.buyingValue * row.quantity), field: (row) => toCurrency(row.buyingValue * row.quantity),
}, },
]); ]);
import { useArrayData } from 'src/composables/useArrayData';
import VnTable from 'src/components/VnTable/VnTable.vue';
const arrayData = useArrayData('EntryBuys');
const { store } = arrayData;
const entityId = computed(() => $props.id || route.params.id);
// import EntryBuysTable from './EntryBuysTable.vue';
store.userParams = {};
onBeforeMount(() => {});
</script> </script>
<template> <template>
@ -142,28 +128,49 @@ onBeforeMount(() => {});
</QCardSection> </QCardSection>
<QCardActions align="right"> <QCardActions align="right">
<QBtn <QBtn
:label="t('globals.print')" :label="t('Print buys')"
color="primary" color="primary"
icon="print" icon="print"
:loading="isLoading" :loading="isLoading"
@click="confirm()" @click="openReport(`Entries/${entityId}/buy-label`)"
unelevated unelevated
autofocus autofocus
/> />
</QCardActions> </QCardActions>
<QCardSection class="row items-center"> <QCardSection class="row items-center">
<VnTable <VnPaginate
ref="entryBuysPaginateRef" ref="entryBuysPaginateRef"
data-key="EntryBuys" data-key="EntryBuys"
:url="`Entries/${entityId}/getBuys`" :url="`Entries/${entityId}/getBuys`"
auto-load auto-load
:columns="entriesTableColumns"
default-mode="table"
:right-search="false"
:is-editable="false"
:use-model="false"
> >
</VnTable> </QCardSection <template #body="{ rows }">
<QTable
:rows="rows"
:columns="entriesTableColumns"
selection="multiple"
row-key="id"
class="full-width q-mt-md"
:grid="$q.screen.lt.md"
v-model:selected="rowsSelected"
:no-data-label="t('globals.noResults')"
>
<template #body="props">
<QTr>
<QTd>
<QCheckbox v-model="props.selected" />
</QTd>
<QTd v-for="col in props.cols" :key="col.name">
{{ col.value }}
<FetchedTags
v-if="col.name === 'item'"
:item="props.row['item']"
></FetchedTags>
</QTd>
</QTr>
</template>
</QTable> </template
></VnPaginate> </QCardSection
></QCard> ></QCard>
</QDialog> </QDialog>
</template> </template>
@ -181,4 +188,5 @@ onBeforeMount(() => {});
<i18n> <i18n>
es: es:
Print buys: Imprimir compras
</i18n> </i18n>

View File

@ -125,7 +125,7 @@ const printBuys = (rowId) => {
type="submit" type="submit"
/> />
<QBtn <QBtn
:label="t('globals.print')" :label="t('Print buys')"
@click.stop="printBuys(row.id)" @click.stop="printBuys(row.id)"
color="primary" color="primary"
type="submit" type="submit"
@ -146,6 +146,7 @@ const printBuys = (rowId) => {
<i18n> <i18n>
es: es:
Print buys: Imprimir compras
Inventory entry: Es inventario Inventory entry: Es inventario
Virtual entry: Es una redada Virtual entry: Es una redada
Search entries: Buscar entradas Search entries: Buscar entradas