forked from verdnatura/salix-front
feat: travel m3
This commit is contained in:
parent
cf1545d5e8
commit
ffd7d98e9c
|
@ -15,6 +15,7 @@ import VnTableChip from 'components/VnTable/VnChip.vue';
|
||||||
import VnVisibleColumn from 'src/components/VnTable/VnVisibleColumn.vue';
|
import VnVisibleColumn from 'src/components/VnTable/VnVisibleColumn.vue';
|
||||||
import VnLv from 'components/ui/VnLv.vue';
|
import VnLv from 'components/ui/VnLv.vue';
|
||||||
import VnTableOrder from 'src/components/VnTable/VnOrder.vue';
|
import VnTableOrder from 'src/components/VnTable/VnOrder.vue';
|
||||||
|
import item from 'src/router/modules/item';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
columns: {
|
columns: {
|
||||||
|
@ -609,6 +610,25 @@ defineExpose({
|
||||||
</QCard>
|
</QCard>
|
||||||
</component>
|
</component>
|
||||||
</template>
|
</template>
|
||||||
|
<template #bottom-row="{ cols }">
|
||||||
|
<QTr>
|
||||||
|
<QTh
|
||||||
|
v-for="col of cols.filter((cols) => cols.visible ?? true)"
|
||||||
|
:key="col.id"
|
||||||
|
class="text-center"
|
||||||
|
>
|
||||||
|
<span v-if="col.summation">
|
||||||
|
{{
|
||||||
|
rows.reduce(
|
||||||
|
(sum, currentRow) =>
|
||||||
|
sum + currentRow[col.name],
|
||||||
|
0
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
</QTh>
|
||||||
|
</QTr>
|
||||||
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
</template>
|
</template>
|
||||||
</CrudModel>
|
</CrudModel>
|
||||||
|
|
|
@ -5,6 +5,10 @@ import { useState } from 'src/composables/useState';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
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 VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
import EntryStockBoughtDetail from 'src/pages/Entry/EntryStockBoughtDetail.vue';
|
import EntryStockBoughtDetail from 'src/pages/Entry/EntryStockBoughtDetail.vue';
|
||||||
|
@ -37,6 +41,7 @@ const columns = [
|
||||||
columnFilter: false,
|
columnFilter: false,
|
||||||
create: true,
|
create: true,
|
||||||
component: 'number',
|
component: 'number',
|
||||||
|
summation: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -61,6 +66,7 @@ const columns = [
|
||||||
label: t('Bought'),
|
label: t('Bought'),
|
||||||
name: 'bought',
|
name: 'bought',
|
||||||
columnFilter: false,
|
columnFilter: false,
|
||||||
|
summation: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
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();
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnSubToolbar />
|
<VnSubToolbar />
|
||||||
|
@ -109,11 +130,27 @@ const columns = [
|
||||||
onDataSaved: () => tableRef.reload(),
|
onDataSaved: () => tableRef.reload(),
|
||||||
formInitialData: {
|
formInitialData: {
|
||||||
workerFk: user.id,
|
workerFk: user.id,
|
||||||
dated: Date.now(),
|
dated: Date.vnNow(),
|
||||||
},
|
},
|
||||||
}"
|
}"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
|
auto-load
|
||||||
|
@on-fetch="() => fetchDataRef.fetch()"
|
||||||
>
|
>
|
||||||
|
<template #moreFilterPanel="{ params }">
|
||||||
|
<FetchData
|
||||||
|
ref="fetchDataRef"
|
||||||
|
url="Travels"
|
||||||
|
limit="1"
|
||||||
|
auto-load
|
||||||
|
:filter="getFilter(params?.date)"
|
||||||
|
@on-fetch="(data) => (travel = data)"
|
||||||
|
/>
|
||||||
|
<VnRow class="q-pa-md" style="align-items: center" v-if="travel?.length">
|
||||||
|
<span>{{ t('Booked trucks: ') + travel[0]?.m3 }}</span>
|
||||||
|
<QBtn style="max-width: 20%" flat icon="edit" />
|
||||||
|
</VnRow>
|
||||||
|
</template>
|
||||||
<template #column-workerFk="{ row }">
|
<template #column-workerFk="{ row }">
|
||||||
<span class="link" @click.stop>
|
<span class="link" @click.stop>
|
||||||
{{ row?.worker?.user?.name }}
|
{{ row?.worker?.user?.name }}
|
||||||
|
|
|
@ -38,9 +38,9 @@ const columns = [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
label: t('Name'),
|
label: t('Name'),
|
||||||
name: 'itemName',
|
name: 'itemName',
|
||||||
columnFilter: false,
|
|
||||||
create: true,
|
create: true,
|
||||||
columnClass: 'expand',
|
columnClass: 'expand',
|
||||||
|
columnFilter: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
|
|
@ -70,6 +70,9 @@ const agenciesOptions = ref([]);
|
||||||
hide-selected
|
hide-selected
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<VnInput v-model="data.m3" label="m3" />
|
||||||
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:label="t('travel.basicData.delivered')"
|
:label="t('travel.basicData.delivered')"
|
||||||
|
|
Loading…
Reference in New Issue