forked from verdnatura/salix-front
feat: refs #7404 add some style to the form and reorganize fields
This commit is contained in:
parent
717bf1c3e3
commit
cd12343302
|
@ -171,6 +171,8 @@ const components = computed(() => $props.components ?? defaultComponents);
|
|||
:value="{ row, model }"
|
||||
v-model="model"
|
||||
/>
|
||||
|
||||
{{ console.log('model: ', col) }}
|
||||
<VnComponent
|
||||
v-if="col.component"
|
||||
:prop="col"
|
||||
|
@ -178,6 +180,7 @@ const components = computed(() => $props.components ?? defaultComponents);
|
|||
:value="{ row, model }"
|
||||
v-model="model"
|
||||
/>
|
||||
|
||||
<span :title="value" v-else>{{ value }}</span>
|
||||
<VnComponent
|
||||
v-if="col.after"
|
||||
|
|
|
@ -15,7 +15,6 @@ 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: {
|
||||
|
@ -410,7 +409,7 @@ defineExpose({
|
|||
/>
|
||||
</template>
|
||||
<template #header-cell="{ col }">
|
||||
<QTh v-if="col.visible ?? true">
|
||||
<QTh table-header-style="max-width:50%" v-if="col.visible ?? true">
|
||||
<div
|
||||
class="column self-start q-ml-xs ellipsis"
|
||||
:class="`text-${col?.align ?? 'left'}`"
|
||||
|
@ -665,6 +664,7 @@ defineExpose({
|
|||
:column-name="column.name"
|
||||
:label="column.label"
|
||||
>
|
||||
{{ console.log('data: ', data) }}
|
||||
<VnTableColumn
|
||||
:column="column"
|
||||
:row="{}"
|
||||
|
@ -708,9 +708,7 @@ es:
|
|||
|
||||
.q-table--dark .q-table__bottom,
|
||||
.q-table--dark thead,
|
||||
.q-table--dark tr,
|
||||
.q-table--dark th,
|
||||
.q-table--dark td {
|
||||
.q-table--dark tr {
|
||||
border-color: var(--vn-section-color);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,17 +17,16 @@ const $props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
let mixed;
|
||||
const componentArray = computed(() => {
|
||||
if (typeof $props.prop === 'object') return [$props.prop];
|
||||
return $props.prop;
|
||||
});
|
||||
|
||||
function mix(toComponent) {
|
||||
if (mixed) return mixed;
|
||||
const { component, attrs, event } = toComponent;
|
||||
console.log('attrs: ', attrs);
|
||||
const customComponent = $props.components[component];
|
||||
mixed = {
|
||||
return {
|
||||
component: customComponent?.component ?? component,
|
||||
attrs: {
|
||||
...toValueAttrs(attrs),
|
||||
|
@ -37,7 +36,6 @@ function mix(toComponent) {
|
|||
},
|
||||
event: { ...customComponent?.event, ...event },
|
||||
};
|
||||
return mixed;
|
||||
}
|
||||
|
||||
function toValueAttrs(attrs) {
|
||||
|
|
|
@ -4,20 +4,18 @@ import { useI18n } from 'vue-i18n';
|
|||
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 FetchData from 'src/components/FetchData.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import EntryStockBoughtFilter from './EntryStockBoughtFilter.vue';
|
||||
import VnTable from 'components/VnTable/VnTable.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',
|
||||
|
@ -31,8 +29,17 @@ const columns = [
|
|||
align: 'left',
|
||||
name: 'workerFk',
|
||||
label: t('Buyer'),
|
||||
isTitle: true,
|
||||
columnFilter: false,
|
||||
component: 'select',
|
||||
create: true,
|
||||
attrs: {
|
||||
url: 'Workers/activeWithInheritedRole',
|
||||
fields: ['id', 'name'],
|
||||
where: { role: 'buyer' },
|
||||
optionFilter: 'firstName',
|
||||
optionLabel: 'name',
|
||||
optionValue: 'id',
|
||||
useLike: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
|
@ -44,31 +51,13 @@ const columns = [
|
|||
summation: true,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'workerFk',
|
||||
label: t('Buyer'),
|
||||
component: 'select',
|
||||
create: true,
|
||||
visible: false,
|
||||
columnFilter: false,
|
||||
attrs: {
|
||||
url: 'Workers/activeWithInheritedRole',
|
||||
fields: ['id', 'name'],
|
||||
where: { role: 'buyer' },
|
||||
optionFilter: 'firstName',
|
||||
optionLabel: 'name',
|
||||
optionValue: 'id',
|
||||
useLike: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('Bought'),
|
||||
name: 'bought',
|
||||
columnFilter: false,
|
||||
summation: true,
|
||||
cardVisible: true,
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
|
@ -92,7 +81,6 @@ const columns = [
|
|||
componentProps: {
|
||||
workerFk: row.workerFk,
|
||||
},
|
||||
maximized: true,
|
||||
});
|
||||
},
|
||||
},
|
||||
|
@ -100,10 +88,6 @@ const columns = [
|
|||
},
|
||||
];
|
||||
|
||||
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);
|
||||
|
@ -119,11 +103,46 @@ function getFilter(dated) {
|
|||
],
|
||||
};
|
||||
}
|
||||
const travel = ref();
|
||||
const fetchDataRef = ref();
|
||||
const userParams = ref({
|
||||
dated: Date.vnNew(),
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<VnSubToolbar />
|
||||
<VnSubToolbar>
|
||||
<template #st-data="{ params }">
|
||||
<FetchData
|
||||
ref="fetchDataRef"
|
||||
url="Travels"
|
||||
limit="1"
|
||||
auto-load
|
||||
:filter="getFilter(params?.dated)"
|
||||
@on-fetch="(data) => (travel = data)"
|
||||
/>
|
||||
<div>
|
||||
<div>
|
||||
<span style="color: var(--vn-label-color)">
|
||||
{{ t('Booked trucks') + ': ' }}
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="travel">
|
||||
<span>
|
||||
{{ travel[0]?.m3 }}
|
||||
</span>
|
||||
<QBtn
|
||||
style="max-width: 20%"
|
||||
flat
|
||||
icon="edit"
|
||||
@click="navigate(travel[0]?.id)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<EntryStockBoughtFilter data-key="StockBoughts" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
|
@ -131,6 +150,7 @@ const fetchDataRef = ref();
|
|||
url="StockBoughts/getStockBought"
|
||||
save-url="StockBoughts/crud"
|
||||
order="reserve DESC"
|
||||
:right-search="false"
|
||||
:is-editable="true"
|
||||
:create="{
|
||||
urlCreate: 'StockBoughts',
|
||||
|
@ -142,39 +162,10 @@ const fetchDataRef = ref();
|
|||
},
|
||||
}"
|
||||
:columns="columns"
|
||||
:user-params="userParams"
|
||||
auto-load
|
||||
@on-fetch="() => console.log('fetching...', fetchDataRef.fetch())"
|
||||
style="max-width: 40%"
|
||||
:footer="true"
|
||||
>
|
||||
<template #moreFilterPanel="{ params }">
|
||||
<FetchData
|
||||
ref="fetchDataRef"
|
||||
url="Travels"
|
||||
limit="1"
|
||||
auto-load
|
||||
:filter="getFilter(params?.dated)"
|
||||
@on-fetch="(data) => (travel = data)"
|
||||
/>
|
||||
<div class="trucks">
|
||||
<div>
|
||||
<span style="color: var(--vn-label-color)">
|
||||
{{ t('Booked trucks') + ': ' }}
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="travel">
|
||||
<span>
|
||||
{{ travel[0]?.m3 }}
|
||||
</span>
|
||||
<QBtn
|
||||
style="max-width: 20%"
|
||||
flat
|
||||
icon="edit"
|
||||
@click="navigate(travel[0]?.id)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #column-workerFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row?.worker?.user?.name }}
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { onMounted } from 'vue';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
dataKey: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const companiesOptions = ref([]);
|
||||
const stateStore = useStateStore();
|
||||
onMounted(async () => {
|
||||
stateStore.rightDrawer = true;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
ref="buyer"
|
||||
url="Workers/activeWithInheritedRole"
|
||||
:filter="{
|
||||
fields: ['id', 'name'],
|
||||
where: { role: 'buyer' },
|
||||
}"
|
||||
order="name"
|
||||
@on-fetch="(data) => (companiesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ params }">
|
||||
<QItem class="q-my-sm">
|
||||
<QItemSection>
|
||||
<VnInputDate v-model="params.dated" :label="t('Date')" is-outlined />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
<i18n>
|
||||
es:
|
||||
Date: Fecha
|
||||
</i18n>
|
|
@ -3,7 +3,6 @@ import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnSearchbar
|
||||
data-key="RouteList"
|
||||
|
|
|
@ -409,5 +409,4 @@ es:
|
|||
Route is not served: La ruta no está servida
|
||||
hourStarted: Hora de inicio
|
||||
hourFinished: Hora de fin
|
||||
Volume: Volumen
|
||||
</i18n>
|
||||
|
|
Loading…
Reference in New Issue