From 3dc720e2d0db55c61b7b28df6087d997af241b54 Mon Sep 17 00:00:00 2001 From: pablone Date: Wed, 4 Sep 2024 14:40:36 +0200 Subject: [PATCH] feat: refs #7404 add m3 and fix detail --- src/components/VnTable/VnTable.vue | 36 ++++- src/pages/Entry/EntryList.vue | 3 - src/pages/Entry/EntryStockBought.vue | 136 +++++++++++------- src/pages/Entry/EntryStockBoughtDetail.vue | 2 +- .../integration/entry/stockBought.spec.js | 2 +- 5 files changed, 118 insertions(+), 61 deletions(-) diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 26b5c424a..0fd6d1dd1 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -90,6 +90,10 @@ const $props = defineProps({ type: String, default: '90vh', }, + footer: { + type: Boolean, + default: false, + }, }); const { t } = useI18n(); const stateStore = useStateStore(); @@ -108,7 +112,7 @@ const orders = ref(parseOrder(routeQuery.filter?.order)); const CrudModelRef = ref({}); const showForm = ref(false); const splittedColumns = ref({ columns: [] }); -const columnsVisibilitySkippped = ref(); +const columnsVisibilitySkipped = ref(); const createForm = ref(); const tableModes = [ @@ -347,11 +351,11 @@ defineExpose({ + + +
+ {{ + rows.reduce( + (sum, currentRow) => sum + currentRow[col.name], + 0 + ) + }} +
+
+
+
@@ -672,7 +698,7 @@ es: } .bg-header { - background-color: var(--vn-header-color); + background-color: var(--vn-accent-color); color: var(--vn-text-color); } diff --git a/src/pages/Entry/EntryList.vue b/src/pages/Entry/EntryList.vue index c03c67edb..6f7ff1935 100644 --- a/src/pages/Entry/EntryList.vue +++ b/src/pages/Entry/EntryList.vue @@ -9,9 +9,6 @@ import RightMenu from 'src/components/common/RightMenu.vue'; import { toDate } from 'src/filters'; import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import EntrySummary from './Card/EntrySummary.vue'; -import VnUserLink from 'components/ui/VnUserLink.vue'; -import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; -import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue'; import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue'; import TravelDescriptorProxy from 'src/pages/Travel/Card/TravelDescriptorProxy.vue'; diff --git a/src/pages/Entry/EntryStockBought.vue b/src/pages/Entry/EntryStockBought.vue index 12fc96214..75d356bd2 100644 --- a/src/pages/Entry/EntryStockBought.vue +++ b/src/pages/Entry/EntryStockBought.vue @@ -6,24 +6,23 @@ import { useQuasar } from 'quasar'; import VnTable from 'components/VnTable/VnTable.vue'; import VnRow from 'src/components/ui/VnRow.vue'; -import VnInput from 'src/components/common/VnInput.vue'; -import VnLv from 'src/components/ui/VnLv.vue'; import FetchData from 'src/components/FetchData.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import EntryStockBoughtDetail from 'src/pages/Entry/EntryStockBoughtDetail.vue'; +import { useRouter } from 'vue-router'; const { t } = useI18n(); const quasar = useQuasar(); const tableRef = ref(); const state = useState(); const user = state.getUser(); +const router = useRouter(); const columns = [ { align: 'left', label: 'Id', name: 'id', - isTitle: true, isId: true, columnFilter: false, visible: false, @@ -32,6 +31,7 @@ const columns = [ align: 'left', name: 'workerFk', label: t('Buyer'), + isTitle: true, columnFilter: false, }, { @@ -42,6 +42,7 @@ const columns = [ create: true, component: 'number', summation: true, + cardVisible: true, }, { align: 'left', @@ -67,6 +68,7 @@ const columns = [ name: 'bought', columnFilter: false, summation: true, + cardVisible: true, }, { align: 'left', @@ -89,7 +91,6 @@ const columns = [ component: EntryStockBoughtDetail, componentProps: { workerFk: row.workerFk, - dated: row.dated, }, maximized: true, }); @@ -98,15 +99,22 @@ const columns = [ ], }, ]; -function getFilter(dated = Date.vnNow()) { - console.log('dated: ', new Date(dated * 1000)); + +function navigate(id) { + router.push({ path: `/travel/${id}/basic-data` }); +} + +function getFilter(dated) { + const shipped = dated ? new Date(dated) : Date.vnNew(); + shipped.setHours(0, 0, 0, 0); return { - fields: ['id', 'm3'], - where: { dated }, + where: { + shipped, + m3: { neq: null }, + }, include: [ { relation: 'warehouseIn', - where: { code: 'vnh' }, }, ], }; @@ -116,49 +124,74 @@ const fetchDataRef = ref(); + en: Buyer: Buyer @@ -168,6 +201,7 @@ const fetchDataRef = ref(); Date: Date This buyer has already made a reservation for this date: This buyer has already made a reservation for this date es: + Booked trucks: Camiones reservados Buyer: Comprador Reserve: Reservado Bought: Comprado diff --git a/src/pages/Entry/EntryStockBoughtDetail.vue b/src/pages/Entry/EntryStockBoughtDetail.vue index 9212f1115..b9420af71 100644 --- a/src/pages/Entry/EntryStockBoughtDetail.vue +++ b/src/pages/Entry/EntryStockBoughtDetail.vue @@ -18,7 +18,7 @@ const $props = defineProps({ required: true, }, }); -const customUrl = `StockBoughts/getStockBoughtDetail?workerFk=${$props.workerFk}`; +const customUrl = `StockBoughts/getStockBoughtDetail?workerFk=${$props.workerFk}&date=${$props.dated}`; const columns = [ { align: 'left', diff --git a/test/cypress/integration/entry/stockBought.spec.js b/test/cypress/integration/entry/stockBought.spec.js index 8e4fe225c..10af3ef42 100644 --- a/test/cypress/integration/entry/stockBought.spec.js +++ b/test/cypress/integration/entry/stockBought.spec.js @@ -8,7 +8,7 @@ describe('EntryStockBought', () => { ); }); it('Should edit the reserved space', () => { - cy.get('tBody > tr').its('length').should('eq', 1); + cy.get('tBody > tr').its('length').should('eq', 2); cy.get(reserveField).type('10{enter}'); cy.get('button[title="Save"]').click(); cy.get('.q-notification__message').should('have.text', 'Data saved');