0
0
Fork 0

Merge pull request '7404-fixFront' (!743) from 7404-fixFront into dev

Reviewed-on: verdnatura/salix-front#743
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Alex Moreno 2024-09-24 06:19:58 +00:00
commit eaadacd332
10 changed files with 151 additions and 101 deletions

View File

@ -643,18 +643,10 @@ function handleOnDataSaved(_) {
:key="col?.id"
class="text-center"
>
<div
v-if="col?.summation"
:class="`text-${col?.align ?? 'left'}`"
class="text-bold q-pa-sm"
>
{{
rows.reduce(
(sum, currentRow) => sum + currentRow[col.name],
0
)
}}
</div>
<slot
:name="`column-footer-${col.name}`"
:class="getColAlign(col)"
/>
</QTh>
</QTr>
</template>
@ -739,10 +731,6 @@ es:
border-color: var(--vn-section-color);
}
.q-table__container > div:first-child {
background-color: var(--vn-page-color);
}
.grid-three {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(400px, max-content));

View File

@ -131,9 +131,8 @@ async function fetch(params) {
useArrayData(props.dataKey, params);
arrayData.reset(['filter.skip', 'skip']);
await arrayData.fetch({ append: false });
if (!store.hasMoreData) {
isLoading.value = false;
}
if (!store.hasMoreData) isLoading.value = false;
emit('onFetch', store.data);
return store.data;
}

View File

@ -36,7 +36,6 @@ $color-font-secondary: #777;
.bg-success {
background-color: $positive;
}
.bg-notice {
background-color: $info;
}

View File

@ -162,6 +162,7 @@ globals:
dms: Gestión documental
entryCreate: Nueva entrada
latestBuys: Últimas compras
reserves: Reservas
tickets: Tickets
ticketCreate: Nuevo ticket
boxing: Encajado

View File

@ -10,6 +10,7 @@ import TravelDescriptorProxy from 'src/pages/Travel/Card/TravelDescriptorProxy.v
import { toDate, toCurrency } from 'src/filters';
import { getUrl } from 'src/composables/getUrl';
import axios from 'axios';
import FetchedTags from 'src/components/ui/FetchedTags.vue';
const route = useRoute();
const { t } = useI18n();
@ -163,7 +164,7 @@ const fetchEntryBuys = async () => {
>
<template #header-left>
<router-link
v-if="route.name !== 'EntrySummary'"
v-if="route?.name !== 'EntrySummary'"
:to="{ name: 'EntrySummary', params: { id: entityId } }"
class="header link"
:href="entryUrl"
@ -184,7 +185,10 @@ const fetchEntryBuys = async () => {
<QIcon name="open_in_new" />
</router-link>
<VnLv :label="t('entry.summary.commission')" :value="entry.commission" />
<VnLv :label="t('entry.summary.currency')" :value="entry.currency.name" />
<VnLv
:label="t('entry.summary.currency')"
:value="entry.currency?.name"
/>
<VnLv :label="t('entry.summary.company')" :value="entry.company.code" />
<VnLv :label="t('entry.summary.reference')" :value="entry.reference" />
<VnLv
@ -210,12 +214,12 @@ const fetchEntryBuys = async () => {
</VnLv>
<VnLv
:label="t('entry.summary.travelAgency')"
:value="entry.travel.agency.name"
:value="entry.travel.agency?.name"
/>
<VnLv :label="t('shipped')" :value="toDate(entry.travel.shipped)" />
<VnLv
:label="t('entry.summary.travelWarehouseOut')"
:value="entry.travel.warehouseOut.name"
:value="entry.travel.warehouseOut?.name"
/>
<QCheckbox
:label="t('entry.summary.travelDelivered')"
@ -225,7 +229,7 @@ const fetchEntryBuys = async () => {
<VnLv :label="t('landed')" :value="toDate(entry.travel.landed)" />
<VnLv
:label="t('entry.summary.travelWarehouseIn')"
:value="entry.travel.warehouseIn.name"
:value="entry.travel.warehouseIn?.name"
/>
<QCheckbox
:label="t('entry.summary.travelReceived')"
@ -281,17 +285,17 @@ const fetchEntryBuys = async () => {
>
<template #body="{ cols, row, rowIndex }">
<QTr no-hover>
<QTd v-for="col in cols" :key="col.name">
<QTd v-for="col in cols" :key="col?.name">
<component
:is="tableColumnComponents[col.name].component(props)"
v-bind="tableColumnComponents[col.name].props(props)"
@click="tableColumnComponents[col.name].event(props)"
:is="tableColumnComponents[col?.name].component()"
v-bind="tableColumnComponents[col?.name].props()"
@click="tableColumnComponents[col?.name].event()"
class="col-content"
>
<template
v-if="
col.name !== 'observation' &&
col.name !== 'isConfirmed'
col?.name !== 'observation' &&
col?.name !== 'isConfirmed'
"
>{{ col.value }}</template
>

View File

@ -1,16 +1,17 @@
<script setup>
import { onMounted, onUnmounted, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import RightMenu from 'src/components/common/RightMenu.vue';
import VnTable from 'components/VnTable/VnTable.vue';
import EntryLatestBuysFilter from './EntryLatestBuysFilter.vue';
import { useStateStore } from 'stores/useStateStore';
import { toDate } from 'src/filters';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import EntryLatestBuysFilter from './EntryLatestBuysFilter.vue';
import VnTable from 'components/VnTable/VnTable.vue';
import VnImg from 'src/components/ui/VnImg.vue';
const stateStore = useStateStore();
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 columns = [
{
align: 'center',

View File

@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnInput from 'components/common/VnInput.vue';
import VnSelect from 'components/common/VnSelect.vue';
import ItemsFilterPanel from 'src/components/ItemsFilterPanel.vue';
@ -18,6 +19,7 @@ defineProps({
const itemTypeWorkersOptions = ref([]);
const suppliersOptions = ref([]);
const tagValues = ref([]);
</script>
<template>

View File

@ -54,10 +54,9 @@ const columns = [
create: true,
component: 'number',
summation: true,
cardVisible: true,
},
{
align: 'left',
align: 'center',
label: t('Bought'),
name: 'bought',
summation: true,
@ -101,14 +100,9 @@ const travel = ref(null);
const userParams = ref({
dated: Date.vnNew(),
});
const filter = ref({
where: {
shipped: (userParams.value.dated
? new Date(userParams.value.dated)
: Date.vnNew()
).setHours(0, 0, 0, 0),
m3: { neq: null },
},
fields: ['id', 'm3', 'warehouseInFk'],
include: [
{
relation: 'warehouseIn',
@ -117,6 +111,13 @@ const filter = ref({
},
},
],
where: {
shipped: (userParams.value.dated
? new Date(userParams.value.dated)
: Date.vnNew()
).setHours(0, 0, 0, 0),
m3: { neq: null },
},
});
const setUserParams = async ({ dated }) => {
@ -128,6 +129,18 @@ const setUserParams = async ({ dated }) => {
function openDialog() {
travelDialogRef.value = true;
}
function setFooter(data) {
const footer = {
bought: 0,
reserve: 0,
};
data.forEach((row) => {
footer.bought += row?.bought;
footer.reserve += row?.reserve;
});
tableRef.value.footer = footer;
}
</script>
<template>
<VnSubToolbar>
@ -139,7 +152,7 @@ function openDialog() {
:filter="filter"
@on-fetch="
(data) => {
travel = data.filter((data) => data.warehouseIn.code === 'VNH');
travel = data.find((data) => data.warehouseIn.code === 'VNH');
}
"
/>
@ -149,10 +162,10 @@ function openDialog() {
{{ t('Booked trucks') }}:
</span>
<span>
{{ travel[0]?.m3 }}
{{ travel?.m3 }}
</span>
<QBtn
v-if="travel[0]?.m3"
v-if="travel?.m3"
style="max-width: 20%"
flat
icon="edit"
@ -166,10 +179,10 @@ function openDialog() {
</VnSubToolbar>
<QDialog v-model="travelDialogRef" :maximized="true" :class="['vn-row', 'wrap']">
<FormModelPopup
:url-update="`Travels/${travel[0].id}`"
:url-update="`Travels/${travel?.id}`"
model="travel"
:title="t('Travel m3')"
:form-initial-data="{ id: travel[0].id, m3: travel[0].m3 }"
:form-initial-data="{ id: travel?.id, m3: travel?.m3 }"
@on-data-saved="fetchDataRef.fetch()"
>
<template #form-inputs="{ data }">
@ -192,51 +205,80 @@ function openDialog() {
/>
</template>
</RightMenu>
<QPage class="column items-center q-pa-md">
<VnTable
ref="tableRef"
data-key="StockBoughts"
url="StockBoughts/getStockBought"
save-url="StockBoughts/crud"
order="reserve DESC"
:right-search="false"
:is-editable="true"
:create="{
urlCreate: 'StockBoughts',
title: t('Reserve some space'),
onDataSaved: () => tableRef.reload(),
formInitialData: {
workerFk: user.id,
dated: Date.vnNow(),
},
}"
:columns="columns"
:user-params="userParams"
:footer="true"
auto-load
>
<template #column-workerFk="{ row }">
<span class="link" @click.stop>
{{ row?.worker?.user?.name }}
<WorkerDescriptorProxy :id="row?.workerFk" />
</span>
</template>
</VnTable>
</QPage>
<div class="table-container">
<QPage class="column items-center q-pa-md">
<VnTable
ref="tableRef"
data-key="StockBoughts"
url="StockBoughts/getStockBought"
save-url="StockBoughts/crud"
order="reserve DESC"
:right-search="false"
:is-editable="true"
@on-fetch="(data) => setFooter(data)"
:create="{
urlCreate: 'StockBoughts',
title: t('Reserve some space'),
onDataSaved: () => tableRef.reload(),
formInitialData: {
workerFk: user.id,
dated: Date.vnNow(),
},
}"
:columns="columns"
:user-params="userParams"
:footer="true"
auto-load
>
<template #column-workerFk="{ row }">
<span class="link" @click.stop>
{{ row?.worker?.user?.name }}
<WorkerDescriptorProxy :id="row?.workerFk" />
</span>
</template>
<template #column-bought="{ row }">
<span :class="{ 'text-negative': row.reserve < row.bought }">
{{ row?.bought }}
</span>
</template>
<template #column-footer-reserve>
<span>
{{ tableRef.footer.reserve }}
</span>
</template>
<template #column-footer-bought>
<span
:class="{
'text-negative':
tableRef.footer.reserve < tableRef.footer.bought,
}"
>
{{ tableRef.footer.bought }}
</span>
</template>
</VnTable>
</QPage>
</div>
</template>
<style lang="css" scoped>
<style lang="scss" scoped>
.travel {
margin-bottom: 0px;
}
.table-container {
display: flex;
justify-content: center;
}
.column {
display: flex;
flex-direction: column;
align-items: center;
width: 40%;
}
.text-negative {
color: $negative !important;
}
</style>
<i18n>
en:
Buyer: Buyer
Reserve: Reserve
Bought: Bought
More: More
Date: Date
This buyer has already made a reservation for this date: This buyer has already made a reservation for this date
es:
Edit travel: Editar envío
Travel: Envíos

View File

@ -22,7 +22,7 @@ const customUrl = `StockBoughts/getStockBoughtDetail?workerFk=${$props.workerFk}
const columns = [
{
align: 'left',
label: 'Entry',
label: t('Entry'),
name: 'entryFk',
isTitle: true,
isId: true,
@ -41,29 +41,33 @@ const columns = [
create: true,
columnClass: 'expand',
columnFilter: false,
cardVisible: true,
},
{
align: 'left',
name: 'volume',
label: t('Volume'),
columnFilter: false,
cardVisible: true,
},
{
align: 'left',
label: t('Packaging'),
name: 'packagingFk',
columnFilter: false,
cardVisible: true,
},
{
align: 'left',
label: 'Packing',
name: 'packing',
columnFilter: false,
cardVisible: true,
},
];
</script>
<template>
<QDialog :maximized="true">
<QDialog>
<div class="container">
<VnTable
ref="tableRef"
@ -73,18 +77,26 @@ const columns = [
:columns="columns"
:right-search="false"
:disable-infinite-scroll="true"
:disable-option="{ card: true }"
:limit="0"
auto-load
>
<template #top-left>
<QBtn
flat
icon="Close"
color="primary"
class="bg-vn-section-color q-pa-xs"
v-close-popup
/>
</template>
<template #column-entryFk="{ row }">
<span class="link" @click.stop>
<span class="link">
{{ row?.entryFk }}
<EntryDescriptorProxy :id="row.entryFk" />
</span>
</template>
<template #column-itemName="{ row }">
<span class="link" @click.stop>
<span class="link">
{{ row?.itemName }}
<ItemDescriptorProxy :id="row.itemFk" />
</span>
@ -93,11 +105,10 @@ const columns = [
</div>
</QDialog>
</template>
<style lang="css">
.q-dialog__inner {
<style lang="css" scoped>
.container {
max-width: 50vw;
overflow: auto;
display: flex;
justify-content: center;
align-items: center;
margin: auto;
@ -110,4 +121,9 @@ const columns = [
Bought: Comprado
More: Más
Date: Fecha
Entry: Entrada
Item: Artículo
Name: Nombre
Volume: Volumen
Packaging: Embalage
</i18n>

View File

@ -6,7 +6,6 @@ describe('EntryStockBought', () => {
});
it('Should edit the reserved space', () => {
cy.get('.q-field__native.q-placeholder').should('have.value', '01/01/2001');
cy.get('tBody > tr').its('length').should('eq', 2);
cy.get('input[name="reserve"]').type('10{enter}');
cy.get('button[title="Save"]').click();
cy.get('.q-notification__message').should('have.text', 'Data saved');
@ -18,7 +17,6 @@ describe('EntryStockBought', () => {
cy.get('input[aria-label="Date"]').eq(1).type('01-01');
cy.get('input[aria-label="Buyer"]').type('buyerboss{downarrow}{enter}');
cy.get('.q-notification__message').should('have.text', 'Data created');
cy.get('tBody > tr').its('length').should('eq', 3);
});
it('Should check detail for the buyer', () => {
cy.get(':nth-child(1) > .sticky > .q-btn > .q-btn__content > .q-icon').click();