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 VnLv from 'components/ui/VnLv.vue';
|
||||
import VnTableOrder from 'src/components/VnTable/VnOrder.vue';
|
||||
import item from 'src/router/modules/item';
|
||||
|
||||
const $props = defineProps({
|
||||
columns: {
|
||||
|
@ -609,6 +610,25 @@ defineExpose({
|
|||
</QCard>
|
||||
</component>
|
||||
</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>
|
||||
</template>
|
||||
</CrudModel>
|
||||
|
|
|
@ -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();
|
||||
</script>
|
||||
<template>
|
||||
<VnSubToolbar />
|
||||
|
@ -109,11 +130,27 @@ const columns = [
|
|||
onDataSaved: () => tableRef.reload(),
|
||||
formInitialData: {
|
||||
workerFk: user.id,
|
||||
dated: Date.now(),
|
||||
dated: Date.vnNow(),
|
||||
},
|
||||
}"
|
||||
: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 }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row?.worker?.user?.name }}
|
||||
|
|
|
@ -38,9 +38,9 @@ const columns = [
|
|||
align: 'left',
|
||||
label: t('Name'),
|
||||
name: 'itemName',
|
||||
columnFilter: false,
|
||||
create: true,
|
||||
columnClass: 'expand',
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
|
|
|
@ -70,6 +70,9 @@ const agenciesOptions = ref([]);
|
|||
hide-selected
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput v-model="data.m3" label="m3" />
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<QCheckbox
|
||||
:label="t('travel.basicData.delivered')"
|
||||
|
|
Loading…
Reference in New Issue