forked from verdnatura/salix-front
feat: refs #7404 style dynamic text color
This commit is contained in:
parent
17bb144bce
commit
e700f6f4a8
|
@ -639,18 +639,10 @@ function handleOnDataSaved(_) {
|
|||
:key="col?.id"
|
||||
class="text-center"
|
||||
>
|
||||
<div
|
||||
v-if="col?.summation"
|
||||
:class="`text-${col?.align ?? 'left'}`"
|
||||
class="text-bold q-pa-sm"
|
||||
>
|
||||
{{
|
||||
rows.reduce(
|
||||
(sum, currentRow) => sum + currentRow[col.name],
|
||||
0
|
||||
)
|
||||
}}
|
||||
</div>
|
||||
<slot
|
||||
:name="`column-footer-${col.name}`"
|
||||
:class="getColAlign(col)"
|
||||
/>
|
||||
</QTh>
|
||||
</QTr>
|
||||
</template>
|
||||
|
|
|
@ -131,9 +131,8 @@ async function fetch(params) {
|
|||
useArrayData(props.dataKey, params);
|
||||
arrayData.reset(['filter.skip', 'skip']);
|
||||
await arrayData.fetch({ append: false });
|
||||
if (!store.hasMoreData) {
|
||||
isLoading.value = false;
|
||||
}
|
||||
if (!store.hasMoreData) isLoading.value = false;
|
||||
|
||||
emit('onFetch', store.data);
|
||||
return store.data;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ $color-font-secondary: #777;
|
|||
.bg-success {
|
||||
background-color: $positive;
|
||||
}
|
||||
|
||||
.bg-notice {
|
||||
background-color: $info;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import TravelDescriptorProxy from 'src/pages/Travel/Card/TravelDescriptorProxy.v
|
|||
import { toDate, toCurrency } from 'src/filters';
|
||||
import { getUrl } from 'src/composables/getUrl';
|
||||
import axios from 'axios';
|
||||
import FetchedTags from 'src/components/ui/FetchedTags.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
@ -163,7 +164,7 @@ const fetchEntryBuys = async () => {
|
|||
>
|
||||
<template #header-left>
|
||||
<router-link
|
||||
v-if="route.name !== 'EntrySummary'"
|
||||
v-if="route?.name !== 'EntrySummary'"
|
||||
:to="{ name: 'EntrySummary', params: { id: entityId } }"
|
||||
class="header link"
|
||||
:href="entryUrl"
|
||||
|
@ -184,7 +185,10 @@ const fetchEntryBuys = async () => {
|
|||
<QIcon name="open_in_new" />
|
||||
</router-link>
|
||||
<VnLv :label="t('entry.summary.commission')" :value="entry.commission" />
|
||||
<VnLv :label="t('entry.summary.currency')" :value="entry.currency.name" />
|
||||
<VnLv
|
||||
:label="t('entry.summary.currency')"
|
||||
:value="entry.currency?.name"
|
||||
/>
|
||||
<VnLv :label="t('entry.summary.company')" :value="entry.company.code" />
|
||||
<VnLv :label="t('entry.summary.reference')" :value="entry.reference" />
|
||||
<VnLv
|
||||
|
@ -210,12 +214,12 @@ const fetchEntryBuys = async () => {
|
|||
</VnLv>
|
||||
<VnLv
|
||||
:label="t('entry.summary.travelAgency')"
|
||||
:value="entry.travel.agency.name"
|
||||
:value="entry.travel.agency?.name"
|
||||
/>
|
||||
<VnLv :label="t('shipped')" :value="toDate(entry.travel.shipped)" />
|
||||
<VnLv
|
||||
:label="t('entry.summary.travelWarehouseOut')"
|
||||
:value="entry.travel.warehouseOut.name"
|
||||
:value="entry.travel.warehouseOut?.name"
|
||||
/>
|
||||
<QCheckbox
|
||||
:label="t('entry.summary.travelDelivered')"
|
||||
|
@ -225,7 +229,7 @@ const fetchEntryBuys = async () => {
|
|||
<VnLv :label="t('landed')" :value="toDate(entry.travel.landed)" />
|
||||
<VnLv
|
||||
:label="t('entry.summary.travelWarehouseIn')"
|
||||
:value="entry.travel.warehouseIn.name"
|
||||
:value="entry.travel.warehouseIn?.name"
|
||||
/>
|
||||
<QCheckbox
|
||||
:label="t('entry.summary.travelReceived')"
|
||||
|
@ -281,17 +285,17 @@ const fetchEntryBuys = async () => {
|
|||
>
|
||||
<template #body="{ cols, row, rowIndex }">
|
||||
<QTr no-hover>
|
||||
<QTd v-for="col in cols" :key="col.name">
|
||||
<QTd v-for="col in cols" :key="col?.name">
|
||||
<component
|
||||
:is="tableColumnComponents[col.name].component(props)"
|
||||
v-bind="tableColumnComponents[col.name].props(props)"
|
||||
@click="tableColumnComponents[col.name].event(props)"
|
||||
:is="tableColumnComponents[col?.name].component()"
|
||||
v-bind="tableColumnComponents[col?.name].props()"
|
||||
@click="tableColumnComponents[col?.name].event()"
|
||||
class="col-content"
|
||||
>
|
||||
<template
|
||||
v-if="
|
||||
col.name !== 'observation' &&
|
||||
col.name !== 'isConfirmed'
|
||||
col?.name !== 'observation' &&
|
||||
col?.name !== 'isConfirmed'
|
||||
"
|
||||
>{{ col.value }}</template
|
||||
>
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
<script setup>
|
||||
import { onMounted, onUnmounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import EntryLatestBuysFilter from './EntryLatestBuysFilter.vue';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { toDate } from 'src/filters';
|
||||
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import EntryLatestBuysFilter from './EntryLatestBuysFilter.vue';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
import { toDate } from 'src/filters';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
|
||||
const columns = [
|
||||
{
|
||||
align: 'center',
|
||||
|
|
|
@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n';
|
|||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import VnInput from 'components/common/VnInput.vue';
|
||||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
import ItemsFilterPanel from 'src/components/ItemsFilterPanel.vue';
|
||||
|
||||
|
@ -18,6 +19,7 @@ defineProps({
|
|||
|
||||
const itemTypeWorkersOptions = ref([]);
|
||||
const suppliersOptions = ref([]);
|
||||
const tagValues = ref([]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -56,7 +56,7 @@ const columns = [
|
|||
summation: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
label: t('Bought'),
|
||||
name: 'bought',
|
||||
summation: true,
|
||||
|
@ -129,6 +129,18 @@ const setUserParams = async ({ dated }) => {
|
|||
function openDialog() {
|
||||
travelDialogRef.value = true;
|
||||
}
|
||||
|
||||
function setFooter(data) {
|
||||
const footer = {
|
||||
bought: 0,
|
||||
reserve: 0,
|
||||
};
|
||||
data.forEach((row) => {
|
||||
footer.bought += row?.bought;
|
||||
footer.reserve += row?.reserve;
|
||||
});
|
||||
tableRef.value.footer = footer;
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<VnSubToolbar>
|
||||
|
@ -203,6 +215,7 @@ function openDialog() {
|
|||
order="reserve DESC"
|
||||
:right-search="false"
|
||||
:is-editable="true"
|
||||
@on-fetch="(data) => setFooter(data)"
|
||||
:create="{
|
||||
urlCreate: 'StockBoughts',
|
||||
title: t('Reserve some space'),
|
||||
|
@ -223,11 +236,31 @@ function openDialog() {
|
|||
<WorkerDescriptorProxy :id="row?.workerFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-bought="{ row }">
|
||||
<span :class="{ 'text-negative': row.reserve < row.bought }">
|
||||
{{ row?.bought }}
|
||||
</span>
|
||||
</template>
|
||||
<template #column-footer-reserve>
|
||||
<span>
|
||||
{{ tableRef.footer.reserve }}
|
||||
</span>
|
||||
</template>
|
||||
<template #column-footer-bought>
|
||||
<span
|
||||
:class="{
|
||||
'text-negative':
|
||||
tableRef.footer.reserve < tableRef.footer.bought,
|
||||
}"
|
||||
>
|
||||
{{ tableRef.footer.bought }}
|
||||
</span>
|
||||
</template>
|
||||
</VnTable>
|
||||
</QPage>
|
||||
</div>
|
||||
</template>
|
||||
<style lang="css" scoped>
|
||||
<style lang="scss" scoped>
|
||||
.travel {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
@ -241,6 +274,15 @@ function openDialog() {
|
|||
align-items: center;
|
||||
width: 40%;
|
||||
}
|
||||
.text-negative {
|
||||
color: $negative !important;
|
||||
}
|
||||
.input-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
|
|
|
@ -81,7 +81,13 @@ const columns = [
|
|||
auto-load
|
||||
>
|
||||
<template #top-left>
|
||||
<QBtn flat icon="Close" v-close-popup />
|
||||
<QBtn
|
||||
flat
|
||||
icon="Close"
|
||||
color="primary"
|
||||
class="bg-vn-section-color q-pa-xs"
|
||||
v-close-popup
|
||||
/>
|
||||
</template>
|
||||
<template #column-entryFk="{ row }">
|
||||
<span class="link">
|
||||
|
@ -103,10 +109,10 @@ const columns = [
|
|||
.container {
|
||||
max-width: 50vw;
|
||||
overflow: auto;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: auto;
|
||||
background-color: var(--vn-section-color);
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
|
|
Loading…
Reference in New Issue