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

View File

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

View File

@ -5,7 +5,7 @@ import EntryFilter from './EntryFilter.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import RightMenu from 'src/components/common/RightMenu.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 { useSummaryDialog } from 'src/composables/useSummaryDialog';
import EntrySummary from './Card/EntrySummary.vue'; import EntrySummary from './Card/EntrySummary.vue';
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue'; import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
@ -162,14 +162,14 @@ const columns = computed(() => [
name: 'initialTemperature', name: 'initialTemperature',
label: t('entry.basicData.initialTemperature'), label: t('entry.basicData.initialTemperature'),
field: 'initialTemperature', field: 'initialTemperature',
format: (row) => (row.initialTemperature ? `${row.initialTemperature}°` : ''), format: (row) => toCelsius(row.initialTemperature),
}, },
{ {
align: 'left', align: 'left',
name: 'finalTemperature', name: 'finalTemperature',
label: t('entry.basicData.finalTemperature'), label: t('entry.basicData.finalTemperature'),
field: 'finalTemperature', field: 'finalTemperature',
format: (row) => (row.finalTemperature ? `${row.finalTemperature}°` : ''), format: (row) => toCelsius(row.finalTemperature),
}, },
{ {
label: t('entry.list.tableVisibleColumns.isExcludedFromAvailable'), 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 EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
import VnRow from 'components/ui/VnRow.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'; import axios from 'axios';
const $props = defineProps({ const $props = defineProps({
@ -101,14 +101,14 @@ const entriesTableColumns = computed(() => {
field: 'initialTemperature', field: 'initialTemperature',
name: 'initialTemperature', name: 'initialTemperature',
align: 'left', align: 'left',
format: (val) => (val ? `${val}°` : ''), format: (val) => toCelsius(val),
}, },
{ {
label: t('entry.basicData.finalTemperature'), label: t('entry.basicData.finalTemperature'),
field: 'finalTemperature', field: 'finalTemperature',
name: 'finalTemperature', name: 'finalTemperature',
align: 'left', align: 'left',
format: (val) => (val ? `${val}°` : ''), format: (val) => toCelsius(val),
}, },
{ {
label: '', label: '',
@ -140,14 +140,14 @@ const thermographsTableColumns = computed(() => {
field: 'maxTemperature', field: 'maxTemperature',
name: 'maxTemperature', name: 'maxTemperature',
align: 'left', align: 'left',
format: (val) => (val ? `${val}°` : ''), format: (val) => toCelsius(val),
}, },
{ {
label: t('globals.minTemperature'), label: t('globals.minTemperature'),
field: 'minTemperature', field: 'minTemperature',
name: 'minTemperature', name: 'minTemperature',
align: 'left', align: 'left',
format: (val) => (val ? `${val}°` : ''), format: (val) => toCelsius(val),
}, },
{ {
label: t('globals.state'), label: t('globals.state'),

View File

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