7404-stockBought #593
|
@ -4,7 +4,7 @@ import { useArrayData } from 'composables/useArrayData';
|
||||||
const model = defineModel({ type: Object });
|
const model = defineModel({ type: Object });
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
name: {
|
name: {
|
||||||
type: String,
|
type: [String, Boolean],
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
label: {
|
label: {
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref, watch } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
import axios from 'axios';
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
import FormModelPopup from 'components/FormModelPopup.vue';
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import EntryStockBoughtFilter from './EntryStockBoughtFilter.vue';
|
import EntryStockBoughtFilter from './EntryStockBoughtFilter.vue';
|
||||||
|
@ -31,7 +32,9 @@ const columns = [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'workerFk',
|
name: 'workerFk',
|
||||||
label: t('Buyer'),
|
label: t('Buyer'),
|
||||||
|
isTitle: true,
|
||||||
component: 'select',
|
component: 'select',
|
||||||
|
cardVisible: true,
|
||||||
create: true,
|
create: true,
|
||||||
attrs: {
|
attrs: {
|
||||||
url: 'Workers/activeWithInheritedRole',
|
url: 'Workers/activeWithInheritedRole',
|
||||||
|
@ -82,6 +85,7 @@ const columns = [
|
||||||
component: EntryStockBoughtDetail,
|
component: EntryStockBoughtDetail,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
workerFk: row.workerFk,
|
workerFk: row.workerFk,
|
||||||
|
dated: userParams.value.dated,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -91,6 +95,7 @@ const columns = [
|
||||||
];
|
];
|
||||||
|
|
||||||
const fetchDataRef = ref();
|
const fetchDataRef = ref();
|
||||||
|
const travelDialogRef = ref(false);
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const travel = ref(null);
|
const travel = ref(null);
|
||||||
const userParams = ref({
|
const userParams = ref({
|
||||||
|
@ -108,38 +113,21 @@ const filter = ref({
|
||||||
{
|
{
|
||||||
relation: 'warehouseIn',
|
relation: 'warehouseIn',
|
||||||
scope: {
|
scope: {
|
||||||
where: { code: 'vnh' },
|
fields: ['code'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
function getFilter(dated) {
|
|
||||||
console.log('dated: ', dated);
|
|
||||||
const shipped = dated ? new Date(dated) : Date.vnNew();
|
|
||||||
shipped.setHours(0, 0, 0, 0);
|
|
||||||
return {
|
|
||||||
where: {
|
|
||||||
shipped,
|
|
||||||
m3: { neq: null },
|
|
||||||
},
|
|
||||||
include: [
|
|
||||||
{
|
|
||||||
relation: 'warehouseIn',
|
|
||||||
scope: {
|
|
||||||
where: { code: 'vnh' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const setUserParams = async ({ dated }) => {
|
const setUserParams = async ({ dated }) => {
|
||||||
const shipped = (dated ? new Date(dated) : Date.vnNew()).setHours(0, 0, 0, 0);
|
const shipped = (dated ? new Date(dated) : Date.vnNew()).setHours(0, 0, 0, 0);
|
||||||
|
|
||||||
filter.value.where.shipped = shipped;
|
filter.value.where.shipped = shipped;
|
||||||
fetchDataRef.value?.fetch();
|
fetchDataRef.value?.fetch();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function openDialog() {
|
||||||
|
travelDialogRef.value = true;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnSubToolbar>
|
<VnSubToolbar>
|
||||||
|
@ -147,35 +135,55 @@ const setUserParams = async ({ dated }) => {
|
||||||
<FetchData
|
<FetchData
|
||||||
ref="fetchDataRef"
|
ref="fetchDataRef"
|
||||||
url="Travels"
|
url="Travels"
|
||||||
limit="1"
|
|
||||||
auto-load
|
auto-load
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
@on-fetch="(data) => (travel = data)"
|
@on-fetch="
|
||||||
|
(data) => {
|
||||||
|
travel = data.filter((data) => data.warehouseIn.code === 'VNH');
|
||||||
|
}
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
|
<VnRow class="travel">
|
||||||
<VnRow>
|
<div v-if="travel">
|
||||||
<div v-if="travel" class="q-pa-md">
|
<span style="color: var(--vn-label-color)">
|
||||||
<QIcon
|
{{ t('Booked trucks') }}:
|
||||||
name="local_airport"
|
</span>
|
||||||
class="fill-icon q-mr-sm"
|
|
||||||
size="md"
|
|
||||||
:title="t('Travel')"
|
|
||||||
color="primary"
|
|
||||||
/>
|
|
||||||
<span>
|
<span>
|
||||||
{{ t('Booked trucks') + ': ' + travel[0]?.m3 }}
|
{{ travel[0]?.m3 }}
|
||||||
</span>
|
</span>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
v-if="travel[0]?.m3"
|
||||||
style="max-width: 20%"
|
style="max-width: 20%"
|
||||||
flat
|
flat
|
||||||
icon="edit"
|
icon="edit"
|
||||||
@click="navigate(travel[0]?.id)"
|
@click="openDialog()"
|
||||||
:title="t('Edit travel')"
|
:title="t('Edit travel')"
|
||||||
|
color="primary"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
</VnSubToolbar>
|
</VnSubToolbar>
|
||||||
|
<QDialog v-model="travelDialogRef" :maximized="true" :class="['vn-row', 'wrap']">
|
||||||
|
<FormModelPopup
|
||||||
|
:url-update="`Travels/${travel[0].id}`"
|
||||||
|
model="travel"
|
||||||
|
:title="t('Travel m3')"
|
||||||
|
:form-initial-data="{ id: travel[0].id, m3: travel[0].m3 }"
|
||||||
|
@on-data-saved="fetchDataRef.fetch()"
|
||||||
|
>
|
||||||
|
<template #form-inputs="{ data }">
|
||||||
|
<VnInput
|
||||||
|
v-model="data.id"
|
||||||
|
:label="t('id')"
|
||||||
|
type="number"
|
||||||
|
disable
|
||||||
|
readonly
|
||||||
|
/>
|
||||||
|
<VnInput v-model="data.m3" :label="t('m3')" type="number" />
|
||||||
|
</template>
|
||||||
|
</FormModelPopup>
|
||||||
|
</QDialog>
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
<template #right-panel>
|
<template #right-panel>
|
||||||
<EntryStockBoughtFilter
|
<EntryStockBoughtFilter
|
||||||
|
@ -196,10 +204,7 @@ const setUserParams = async ({ dated }) => {
|
||||||
:create="{
|
:create="{
|
||||||
urlCreate: 'StockBoughts',
|
urlCreate: 'StockBoughts',
|
||||||
title: t('Reserve some space'),
|
title: t('Reserve some space'),
|
||||||
onDataSaved: () => {
|
onDataSaved: () => tableRef.reload(),
|
||||||
tableRef.reload();
|
|
||||||
fetchDataRef.reload();
|
|
||||||
},
|
|
||||||
formInitialData: {
|
formInitialData: {
|
||||||
workerFk: user.id,
|
workerFk: user.id,
|
||||||
dated: Date.vnNow(),
|
dated: Date.vnNow(),
|
||||||
|
@ -214,17 +219,14 @@ const setUserParams = async ({ dated }) => {
|
||||||
<span class="link" @click.stop>
|
<span class="link" @click.stop>
|
||||||
{{ row?.worker?.user?.name }}
|
{{ row?.worker?.user?.name }}
|
||||||
<WorkerDescriptorProxy :id="row?.workerFk" />
|
<WorkerDescriptorProxy :id="row?.workerFk" />
|
||||||
</span>
|
</span> </template
|
||||||
</template>
|
>0
|
||||||
|
|||||||
</VnTable>
|
</VnTable>
|
||||||
</QPage>
|
</QPage>
|
||||||
</template>
|
</template>
|
||||||
<style lang="scss">
|
<style lang="css" scoped>
|
||||||
.trucks {
|
.travel {
|
||||||
text-align: center;
|
margin-bottom: 0px;
|
||||||
margin: 3%;
|
|
||||||
border: 3px solid var(--vn-header-color);
|
|
||||||
padding: 1%;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -14,7 +14,7 @@ const $props = defineProps({
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
dated: {
|
dated: {
|
||||||
type: String,
|
type: Date,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -63,34 +63,46 @@ const columns = [
|
||||||
];
|
];
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QDialog>
|
<QDialog position="bottom" :maximized="true">
|
||||||
<VnTable
|
<div class="container">
|
||||||
ref="tableRef"
|
<VnTable
|
||||||
data-key="StockBoughtsDetail"
|
ref="tableRef"
|
||||||
:url="customUrl"
|
data-key="StockBoughtsDetail"
|
||||||
order="itemName DESC"
|
:url="customUrl"
|
||||||
:columns="columns"
|
order="itemName DESC"
|
||||||
:right-search="false"
|
:columns="columns"
|
||||||
:disable-infinite-scroll="true"
|
:right-search="false"
|
||||||
:disable-option="{ card: true }"
|
:disable-infinite-scroll="true"
|
||||||
:limit="0"
|
:disable-option="{ card: true }"
|
||||||
auto-load
|
:limit="0"
|
||||||
>
|
auto-load
|
||||||
<template #column-entryFk="{ row }">
|
>
|
||||||
<span class="link" @click.stop>
|
<template #column-entryFk="{ row }">
|
||||||
{{ row?.entryFk }}
|
<span class="link" @click.stop>
|
||||||
<EntryDescriptorProxy :id="row.entryFk" />
|
{{ row?.entryFk }}
|
||||||
</span>
|
<EntryDescriptorProxy :id="row.entryFk" />
|
||||||
</template>
|
</span>
|
||||||
<template #column-itemName="{ row }">
|
</template>
|
||||||
<span class="link" @click.stop>
|
<template #column-itemName="{ row }">
|
||||||
{{ row?.itemName }}
|
<span class="link" @click.stop>
|
||||||
<ItemDescriptorProxy :id="row.itemFk" />
|
{{ row?.itemName }}
|
||||||
</span>
|
<ItemDescriptorProxy :id="row.itemFk" />
|
||||||
</template>
|
</span>
|
||||||
</VnTable>
|
</template>
|
||||||
|
</VnTable>
|
||||||
|
</div>
|
||||||
</QDialog>
|
</QDialog>
|
||||||
</template>
|
</template>
|
||||||
|
<style lang="css">
|
||||||
|
.q-dialog__inner {
|
||||||
|
max-width: 50vw;
|
||||||
|
overflow: auto;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
Buyer: Comprador
|
Buyer: Comprador
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { onMounted } from 'vue';
|
import { onMounted } from 'vue';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
|
||||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -15,7 +13,6 @@ const props = defineProps({
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const companiesOptions = ref([]);
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const emit = defineEmits(['set-user-params']);
|
const emit = defineEmits(['set-user-params']);
|
||||||
const setUserParams = (params) => {
|
const setUserParams = (params) => {
|
||||||
|
@ -27,20 +24,10 @@ onMounted(async () => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
ref="buyer"
|
|
||||||
url="Workers/activeWithInheritedRole"
|
|
||||||
:filter="{
|
|
||||||
fields: ['id', 'name'],
|
|
||||||
where: { role: 'buyer' },
|
|
||||||
}"
|
|
||||||
order="name"
|
|
||||||
@on-fetch="(data) => (companiesOptions = data)"
|
|
||||||
auto-load
|
|
||||||
/>
|
|
||||||
<VnFilterPanel
|
<VnFilterPanel
|
||||||
:data-key="props.dataKey"
|
:data-key="props.dataKey"
|
||||||
:search-button="true"
|
:search-button="true"
|
||||||
|
search-url="table"
|
||||||
@set-user-params="setUserParams"
|
@set-user-params="setUserParams"
|
||||||
>
|
>
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
|
@ -52,13 +39,25 @@ onMounted(async () => {
|
||||||
<template #body="{ params }">
|
<template #body="{ params }">
|
||||||
<QItem class="q-my-sm">
|
<QItem class="q-my-sm">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInputDate v-model="params.dated" :label="t('Date')" is-outlined />
|
<VnInputDate
|
||||||
|
id="date"
|
||||||
|
v-model="params.dated"
|
||||||
|
:label="t('Date')"
|
||||||
|
is-outlined
|
||||||
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
</VnFilterPanel>
|
</VnFilterPanel>
|
||||||
</template>
|
</template>
|
||||||
<i18n>
|
<i18n>
|
||||||
|
en:
|
||||||
|
params:
|
||||||
|
dated: Date
|
||||||
|
workerFk: Worker
|
||||||
es:
|
es:
|
||||||
Date: Fecha
|
Date: Fecha
|
||||||
|
params:
|
||||||
|
dated: Date
|
||||||
|
workerFk: Trabajador
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
describe('EntryStockBought', () => {
|
describe('EntryStockBought', () => {
|
||||||
const reserveField = 'input[name="reserve"]';
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
cy.login('buyer');
|
cy.login('buyer');
|
||||||
cy.visit(
|
cy.visit(`/#/entry/stock-Bought`);
|
||||||
`/#/entry/stock-Bought?table={"filter":"{}","dated":"2000-12-31T23:00:00.000Z"}`
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
it('Should edit the reserved space', () => {
|
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('tBody > tr').its('length').should('eq', 2);
|
||||||
cy.get(reserveField).type('10{enter}');
|
cy.get('input[name="reserve"]').type('10{enter}');
|
||||||
cy.get('button[title="Save"]').click();
|
cy.get('button[title="Save"]').click();
|
||||||
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
||||||
});
|
});
|
||||||
|
@ -33,4 +31,11 @@ describe('EntryStockBought', () => {
|
||||||
'warningNo data available'
|
'warningNo data available'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
pablone marked this conversation as resolved
alexm
commented
Aixina? Aixina?
|
|||||||
|
it('Should edit travel m3 and refresh', () => {
|
||||||
|
cy.get('.vn-row > div > .q-btn > .q-btn__content > .q-icon').click();
|
||||||
|
cy.get('input[aria-label="m3"]').clear();
|
||||||
|
cy.get('input[aria-label="m3"]').type('60');
|
||||||
|
cy.get('.q-mt-lg > .q-btn--standard > .q-btn__content > .block').click();
|
||||||
|
cy.get('.vn-row > div > :nth-child(2)').should('have.text', '60');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Ixe 0 el vols?