feat: refs #8381 add toCelsius filter and update temperature fields in entry forms and summaries
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Javi Gallego 2025-01-16 09:09:05 +01:00
parent 803b8d508d
commit 8c7747999d
7 changed files with 43 additions and 39 deletions

View File

@ -16,6 +16,7 @@ import getUpdatedValues from './getUpdatedValues';
import getParamWhere from './getParamWhere';
import parsePhone from './parsePhone';
import isDialogOpened from './isDialogOpened';
import toCelsius from './toCelsius';
export {
getUpdatedValues,
@ -36,4 +37,5 @@ export {
dashIfEmpty,
dateRange,
getParamWhere,
toCelsius,
};

3
src/filters/toCelsius.js Normal file
View File

@ -0,0 +1,3 @@
export default function toCelsius(value) {
return value ? `${value}°C` : '';
}

View File

@ -3,7 +3,6 @@ import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { useRole } from 'src/composables/useRole';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
@ -11,7 +10,7 @@ import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
import FilterTravelForm from 'src/components/FilterTravelForm.vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
import { toDate } from 'src/filters';
const route = useRoute();
@ -26,6 +25,7 @@ const onFilterTravelSelected = (formData, id) => {
formData.travelFk = id;
};
</script>
<template>
<FetchData
ref="companiesRef"
@ -93,14 +93,13 @@ const onFilterTravelSelected = (formData, id) => {
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel
>{{ scope.opt?.agencyModeName }} -
{{ scope.opt?.warehouseInName }} ({{
toDate(scope.opt?.shipped)
}}) &#x2192; {{ scope.opt?.warehouseOutName }} ({{
toDate(scope.opt?.landed)
}})</QItemLabel
>
<QItemLabel>
{{ scope.opt?.agencyModeName }} -
{{ scope.opt?.warehouseInName }}
({{ toDate(scope.opt?.shipped) }})
{{ scope.opt?.warehouseOutName }}
({{ toDate(scope.opt?.landed) }})
</QItemLabel>
</QItemSection>
</QItem>
</template>
@ -126,6 +125,13 @@ const onFilterTravelSelected = (formData, id) => {
/>
</VnRow>
<VnRow>
<VnInputNumber
:label="t('entry.summary.commission')"
v-model="data.commission"
step="1"
autofocus
:positive="false"
/>
<VnSelect
:label="t('entry.summary.currency')"
v-model="data.currencyFk"
@ -133,28 +139,23 @@ const onFilterTravelSelected = (formData, id) => {
option-value="id"
option-label="code"
/>
<QInput
:label="t('entry.summary.commission')"
v-model="data.commission"
type="number"
autofocus
min="0"
/>
</VnRow>
<VnRow>
<QInput
<VnInputNumber
v-model="data.initialTemperature"
name="initialTemperature"
:label="t('entry.basicData.initialTemperature')"
type="number"
step="0.1"
:step="0.5"
:decimal-places="2"
:positive="false"
/>
<QInput
<VnInputNumber
v-model="data.finalTemperature"
name="finalTemperature"
:label="t('entry.basicData.finalTemperature')"
type="number"
step="0.1"
:step="0.5"
:decimal-places="2"
:positive="false"
/>
</VnRow>
<VnRow>

View File

@ -7,7 +7,7 @@ import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import TravelDescriptorProxy from 'src/pages/Travel/Card/TravelDescriptorProxy.vue';
import { toDate, toCurrency } from 'src/filters';
import { toDate, toCurrency, toCelsius } from 'src/filters';
import { getUrl } from 'src/composables/getUrl';
import axios from 'axios';
import FetchedTags from 'src/components/ui/FetchedTags.vue';
@ -191,13 +191,11 @@ const fetchEntryBuys = async () => {
/>
<VnLv
:label="t('entry.basicData.initialTemperature')"
:value="
entry.initialTemperature ? `${entry.initialTemperature}°` : ''
"
:value="toCelsius(entry.initialTemperature)"
/>
<VnLv
:label="t('entry.basicData.finalTemperature')"
:value="entry.finalTemperature ? `${entry.finalTemperature}°` : ''"
:value="toCelsius(entry.finalTemperature)"
/>
</QCard>
<QCard class="vn-one">

View File

@ -5,7 +5,7 @@ import EntryFilter from './EntryFilter.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import VnTable from 'components/VnTable/VnTable.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import { toDate } from 'src/filters';
import { toCelsius, toDate } from 'src/filters';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import EntrySummary from './Card/EntrySummary.vue';
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
@ -162,14 +162,14 @@ const columns = computed(() => [
name: 'initialTemperature',
label: t('entry.basicData.initialTemperature'),
field: 'initialTemperature',
format: (row) => (row.initialTemperature ? `${row.initialTemperature}°` : ''),
format: (row) => toCelsius(row.initialTemperature),
},
{
align: 'left',
name: 'finalTemperature',
label: t('entry.basicData.finalTemperature'),
field: 'finalTemperature',
format: (row) => (row.finalTemperature ? `${row.finalTemperature}°` : ''),
format: (row) => toCelsius(row.finalTemperature),
},
{
label: t('entry.list.tableVisibleColumns.isExcludedFromAvailable'),

View File

@ -9,7 +9,7 @@ import VnTitle from 'src/components/common/VnTitle.vue';
import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
import FetchData from 'src/components/FetchData.vue';
import VnRow from 'components/ui/VnRow.vue';
import { toDate, toCurrency } from 'src/filters';
import { toDate, toCurrency, toCelsius } from 'src/filters';
import axios from 'axios';
const $props = defineProps({
@ -101,14 +101,14 @@ const entriesTableColumns = computed(() => {
field: 'initialTemperature',
name: 'initialTemperature',
align: 'left',
format: (val) => (val ? `${val}°` : ''),
format: (val) => toCelsius(val),
},
{
label: t('entry.basicData.finalTemperature'),
field: 'finalTemperature',
name: 'finalTemperature',
align: 'left',
format: (val) => (val ? `${val}°` : ''),
format: (val) => toCelsius(val),
},
{
label: '',
@ -140,14 +140,14 @@ const thermographsTableColumns = computed(() => {
field: 'maxTemperature',
name: 'maxTemperature',
align: 'left',
format: (val) => (val ? `${val}°` : ''),
format: (val) => toCelsius(val),
},
{
label: t('globals.minTemperature'),
field: 'minTemperature',
name: 'minTemperature',
align: 'left',
format: (val) => (val ? `${val}°` : ''),
format: (val) => toCelsius(val),
},
{
label: t('globals.state'),

View File

@ -10,7 +10,7 @@ import FetchData from 'src/components/FetchData.vue';
import axios from 'axios';
import useNotify from 'src/composables/useNotify.js';
import { toDate } from 'src/filters';
import { toDate, toCelsius } from 'src/filters';
import { downloadFile } from 'src/composables/downloadFile';
const route = useRoute();
@ -52,14 +52,14 @@ const TableColumns = computed(() => {
field: 'maxTemperature',
name: 'maxTemperature',
align: 'left',
format: (val) => (val ? `${val}°` : ''),
format: (val) => toCelsius(val),
},
{
label: t('globals.minTemperature'),
field: 'minTemperature',
name: 'minTemperature',
align: 'left',
format: (val) => (val ? `${val}°` : ''),
format: (val) => toCelsius(val),
},
{
label: t('globals.state'),