From f2be2b430010d647f2547a8a6d8a2b7604b894dd Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 5 Aug 2024 15:42:57 +0200 Subject: [PATCH 01/10] fea: stockBought add form and formDetail --- src/components/VnTable/VnTable.vue | 14 +- src/components/common/VnInputDate.vue | 2 +- src/components/common/VnInputTime.vue | 2 +- src/i18n/locale/en.yml | 1 + src/pages/Entry/EntryStockBought.vue | 142 ++++++++++++++++++ src/pages/Entry/EntryStockBoughtDetail.vue | 102 +++++++++++++ src/pages/Route/RouteList.vue | 3 +- src/router/modules/entry.js | 11 +- .../integration/entry/stockBought.spec.js | 36 +++++ 9 files changed, 302 insertions(+), 11 deletions(-) create mode 100644 src/pages/Entry/EntryStockBought.vue create mode 100644 src/pages/Entry/EntryStockBoughtDetail.vue create mode 100644 test/cypress/integration/entry/stockBought.spec.js diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 4e40c0ba6..8a20023f2 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -107,7 +107,7 @@ const orders = ref(parseOrder(routeQuery.filter?.order)); const CrudModelRef = ref({}); const showForm = ref(false); const splittedColumns = ref({ columns: [] }); -const columnsVisibilitySkiped = ref(); +const columnsVisibilitySkipped = ref(); const tableModes = [ { icon: 'view_column', @@ -133,7 +133,7 @@ onMounted(() => { ? CARD_MODE : $props.defaultMode; stateStore.rightDrawer = true; - columnsVisibilitySkiped.value = [ + columnsVisibilitySkipped.value = [ ...splittedColumns.value.columns .filter((c) => c.visible == false) .map((c) => c.name), @@ -325,11 +325,11 @@ defineExpose({
+ diff --git a/src/pages/Entry/EntryStockBought.vue b/src/pages/Entry/EntryStockBought.vue index e0063bb62..12fc96214 100644 --- a/src/pages/Entry/EntryStockBought.vue +++ b/src/pages/Entry/EntryStockBought.vue @@ -5,6 +5,10 @@ import { useState } from 'src/composables/useState'; 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'; @@ -37,6 +41,7 @@ const columns = [ columnFilter: false, create: true, component: 'number', + summation: true, }, { align: 'left', @@ -61,6 +66,7 @@ const columns = [ label: t('Bought'), name: 'bought', columnFilter: false, + summation: true, }, { align: 'left', @@ -92,6 +98,21 @@ const columns = [ ], }, ]; +function getFilter(dated = Date.vnNow()) { + console.log('dated: ', new Date(dated * 1000)); + return { + fields: ['id', 'm3'], + where: { dated }, + include: [ + { + relation: 'warehouseIn', + where: { code: 'vnh' }, + }, + ], + }; +} +const travel = ref(); +const fetchDataRef = ref(); @@ -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'); From cd12343302c9fea5bc5419ac04731d43b75baf2d Mon Sep 17 00:00:00 2001 From: pablone Date: Fri, 6 Sep 2024 07:26:04 +0200 Subject: [PATCH 05/10] feat: refs #7404 add some style to the form and reorganize fields --- src/components/VnTable/VnColumn.vue | 3 + src/components/VnTable/VnTable.vue | 8 +- src/components/common/VnComponent.vue | 6 +- src/pages/Entry/EntryStockBought.vue | 119 ++++++++++----------- src/pages/Entry/EntryStockBoughtFilter.vue | 57 ++++++++++ src/pages/Route/Card/RouteSearchbar.vue | 1 - src/pages/Route/RouteList.vue | 1 - 7 files changed, 120 insertions(+), 75 deletions(-) create mode 100644 src/pages/Entry/EntryStockBoughtFilter.vue diff --git a/src/components/VnTable/VnColumn.vue b/src/components/VnTable/VnColumn.vue index ed34e9eee..ad120f02e 100644 --- a/src/components/VnTable/VnColumn.vue +++ b/src/components/VnTable/VnColumn.vue @@ -171,6 +171,8 @@ const components = computed(() => $props.components ?? defaultComponents); :value="{ row, model }" v-model="model" /> + + {{ console.log('model: ', col) }} $props.components ?? defaultComponents); :value="{ row, model }" v-model="model" /> + {{ value }}