8144-devToTest_2444 #852
|
@ -21,7 +21,7 @@ const customer = computed(() => state.get('customer'));
|
|||
const bankEntityFormData = reactive({
|
||||
name: null,
|
||||
bic: null,
|
||||
countryFk: customer.value.countryFk,
|
||||
countryFk: customer.value?.countryFk,
|
||||
id: null,
|
||||
});
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ const onDataSaved = (dataSaved) => {
|
|||
model="thermograph"
|
||||
:title="t('New thermograph')"
|
||||
:form-initial-data="thermographFormData"
|
||||
@on-data-saved="onDataSaved($event)"
|
||||
@on-data-saved="(_, response) => onDataSaved(response)"
|
||||
>
|
||||
<template #form-inputs="{ data, validate }">
|
||||
<VnRow>
|
||||
|
|
|
@ -10,8 +10,6 @@ import VnInputDate from 'components/common/VnInputDate.vue';
|
|||
import VnInputTime from 'components/common/VnInputTime.vue';
|
||||
import VnTableColumn from 'components/VnTable/VnColumn.vue';
|
||||
|
||||
defineExpose({ addFilter });
|
||||
|
||||
const $props = defineProps({
|
||||
column: {
|
||||
type: Object,
|
||||
|
@ -30,6 +28,9 @@ const $props = defineProps({
|
|||
default: 'params',
|
||||
},
|
||||
});
|
||||
|
||||
defineExpose({ addFilter, props: $props });
|
||||
|
||||
const model = defineModel(undefined, { required: true });
|
||||
const arrayData = useArrayData($props.dataKey, { searchUrl: $props.searchUrl });
|
||||
const columnFilter = computed(() => $props.column?.columnFilter);
|
||||
|
@ -115,11 +116,11 @@ const components = {
|
|||
rawSelect: selectComponent,
|
||||
};
|
||||
|
||||
async function addFilter(value) {
|
||||
async function addFilter(value, name) {
|
||||
value ??= undefined;
|
||||
if (value && typeof value === 'object') value = model.value;
|
||||
value = value === '' ? undefined : value;
|
||||
let field = columnFilter.value?.name ?? $props.column.name;
|
||||
let field = columnFilter.value?.name ?? $props.column.name ?? name;
|
||||
|
||||
if (columnFilter.value?.inWhere) {
|
||||
if (columnFilter.value.alias) field = columnFilter.value.alias + '.' + field;
|
||||
|
|
|
@ -102,6 +102,10 @@ const $props = defineProps({
|
|||
type: String,
|
||||
default: '90vh',
|
||||
},
|
||||
chipLocale: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
footer: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
|
@ -130,6 +134,7 @@ const showForm = ref(false);
|
|||
const splittedColumns = ref({ columns: [] });
|
||||
const columnsVisibilitySkipped = ref();
|
||||
const createForm = ref();
|
||||
const tableFilterRef = ref([]);
|
||||
|
||||
const tableModes = [
|
||||
{
|
||||
|
@ -232,7 +237,7 @@ function splitColumns(columns) {
|
|||
if (col.cardVisible) splittedColumns.value.cardVisible.push(col);
|
||||
if ($props.isEditable && col.disable == null) col.disable = false;
|
||||
if ($props.useModel && col.columnFilter != false)
|
||||
col.columnFilter = { ...col.columnFilter, inWhere: true };
|
||||
col.columnFilter = { inWhere: true, ...col.columnFilter };
|
||||
splittedColumns.value.columns.push(col);
|
||||
}
|
||||
// Status column
|
||||
|
@ -334,6 +339,13 @@ function handleOnDataSaved(_) {
|
|||
:search-url="searchUrl"
|
||||
:redirect="!!redirect"
|
||||
@set-user-params="setUserParams"
|
||||
:disable-submit-event="true"
|
||||
@remove="
|
||||
(key) =>
|
||||
tableFilterRef
|
||||
.find((f) => f.props?.column.name == key)
|
||||
?.addFilter()
|
||||
"
|
||||
>
|
||||
<template #body>
|
||||
<div
|
||||
|
@ -344,6 +356,7 @@ function handleOnDataSaved(_) {
|
|||
:key="col.id"
|
||||
>
|
||||
<VnTableFilter
|
||||
ref="tableFilterRef"
|
||||
:column="col"
|
||||
:data-key="$attrs['data-key']"
|
||||
v-model="params[columnName(col)]"
|
||||
|
@ -367,10 +380,15 @@ function handleOnDataSaved(_) {
|
|||
:columns="splittedColumns.columns"
|
||||
/>
|
||||
</template>
|
||||
<template #tags="{ tag, formatFn }" v-if="chipLocale">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`${chipLocale}.${tag.label}`) }}: </strong>
|
||||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<!-- class in div to fix warn-->
|
||||
<CrudModel
|
||||
v-bind="$attrs"
|
||||
:class="$attrs['class'] ?? 'q-px-md'"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { computed } from 'vue';
|
||||
import { useRole } from 'src/composables/useRole';
|
||||
import { useAcl } from 'src/composables/useAcl';
|
||||
|
||||
|
|
|
@ -114,9 +114,9 @@ watch(
|
|||
);
|
||||
|
||||
const isLoading = ref(false);
|
||||
async function search(evt) {
|
||||
async function search() {
|
||||
try {
|
||||
if (evt && $props.disableSubmitEvent) return;
|
||||
if ($props.disableSubmitEvent) return;
|
||||
|
||||
store.filter.where = {};
|
||||
isLoading.value = true;
|
||||
|
@ -167,7 +167,7 @@ const tagsList = computed(() => {
|
|||
for (const key of Object.keys(userParams.value)) {
|
||||
const value = userParams.value[key];
|
||||
if (value == null || ($props.hiddenTags || []).includes(key)) continue;
|
||||
tagList.push({ label: key, value });
|
||||
tagList.push({ label: aliasField(key), value });
|
||||
}
|
||||
return tagList;
|
||||
});
|
||||
|
@ -203,6 +203,11 @@ function sanitizer(params) {
|
|||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
function aliasField(field) {
|
||||
const split = field.split('.');
|
||||
return split[1] ?? split[0];
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -119,10 +119,9 @@ watch(
|
|||
);
|
||||
|
||||
watch(
|
||||
() => [props.url, props.filter, props.userParams],
|
||||
([url, filter, userParams]) => mounted.value && fetch({ url, filter, userParams })
|
||||
() => [props.url, props.filter],
|
||||
([url, filter]) => mounted.value && fetch({ url, filter })
|
||||
);
|
||||
|
||||
const addFilter = async (filter, params) => {
|
||||
await arrayData.addFilter({ filter, params });
|
||||
};
|
||||
|
|
|
@ -26,7 +26,8 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
const params = JSON.parse(query[searchUrl]);
|
||||
const filter = params?.filter && JSON.parse(params?.filter ?? '{}');
|
||||
delete params.filter;
|
||||
store.userParams = { ...params, ...store.userParams };
|
||||
|
||||
store.userParams = { ...store.userParams, ...params };
|
||||
store.userFilter = { ...filter, ...store.userFilter };
|
||||
if (filter?.order) store.order = filter.order;
|
||||
}
|
||||
|
|
|
@ -288,6 +288,8 @@ globals:
|
|||
createInvoiceIn: Create invoice in
|
||||
myAccount: My account
|
||||
noOne: No one
|
||||
maxTemperature: Maximum Temperature
|
||||
minTemperature: Minimum Temperatura
|
||||
params:
|
||||
clientFk: Client id
|
||||
salesPersonFk: Sales person
|
||||
|
@ -1007,6 +1009,7 @@ travel:
|
|||
warehouseOut: Warehouse out
|
||||
totalEntries: Total entries
|
||||
totalEntriesTooltip: Total entries
|
||||
daysOnward: Landed days onwards
|
||||
summary:
|
||||
confirmed: Confirmed
|
||||
entryId: Entry Id
|
||||
|
|
|
@ -292,6 +292,8 @@ globals:
|
|||
createInvoiceIn: Crear factura recibida
|
||||
myAccount: Mi cuenta
|
||||
noOne: Nadie
|
||||
maxTemperature: Temperatura máxima
|
||||
minTemperature: Temperatura mínima
|
||||
params:
|
||||
clientFk: Id cliente
|
||||
salesPersonFk: Comercial
|
||||
|
@ -992,6 +994,7 @@ travel:
|
|||
warehouseOut: Alm.entrada
|
||||
totalEntries: ∑
|
||||
totalEntriesTooltip: Entradas totales
|
||||
daysOnward: Días de llegada en adelante
|
||||
summary:
|
||||
confirmed: Confirmado
|
||||
entryId: Id entrada
|
||||
|
|
|
@ -113,6 +113,7 @@ const setWireTransfer = async () => {
|
|||
option-label="bic"
|
||||
option-value="id"
|
||||
hide-selected
|
||||
:roles-allowed-to-create="['financial']"
|
||||
>
|
||||
<template #form>
|
||||
<CreateBankEntityForm
|
||||
|
|
|
@ -47,6 +47,18 @@ const TableColumns = computed(() => {
|
|||
name: 'temperatureFk',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('globals.maxTemperature'),
|
||||
field: 'maxTemperature',
|
||||
name: 'maxTemperature',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('globals.minTemperature'),
|
||||
field: 'minTemperature',
|
||||
name: 'minTemperature',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('travel.thermographs.state'),
|
||||
field: 'result',
|
||||
|
@ -92,11 +104,7 @@ const openRemoveDialog = async (id) => {
|
|||
},
|
||||
})
|
||||
.onOk(async () => {
|
||||
try {
|
||||
await removeThermograph(id);
|
||||
} catch (err) {
|
||||
console.error('Error removing thermograph');
|
||||
}
|
||||
await removeThermograph(id);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -106,9 +114,7 @@ const redirectToThermographForm = (action, id) => {
|
|||
};
|
||||
|
||||
if (action === 'edit' && id) {
|
||||
const params = {};
|
||||
params.thermographId = id;
|
||||
routeDetails.params = params;
|
||||
routeDetails.query = { travelThermographFk: id };
|
||||
}
|
||||
router.push(routeDetails);
|
||||
};
|
||||
|
@ -213,4 +219,6 @@ es:
|
|||
Thermograph removed: Termógrafo eliminado
|
||||
Are you sure you want to remove the thermograph?: ¿Seguro que quieres quitar el termógrafo?
|
||||
No results: Sin resultados
|
||||
Max Temperature: Temperatura máxima
|
||||
Min Temperature: Temperatura mínima
|
||||
</i18n>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { reactive, ref, onBeforeMount } from 'vue';
|
||||
import { ref, onBeforeMount } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
@ -14,6 +14,7 @@ import { useState } from 'src/composables/useState';
|
|||
import { useStateStore } from 'stores/useStateStore';
|
||||
import axios from 'axios';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
|
||||
const props = defineProps({
|
||||
viewAction: {
|
||||
|
@ -28,24 +29,26 @@ const route = useRoute();
|
|||
const router = useRouter();
|
||||
const state = useState();
|
||||
const { notify } = useNotify();
|
||||
|
||||
const thermographFilter = {
|
||||
fields: ['id', 'thermographFk'],
|
||||
where: {
|
||||
or: [{ travelFk: null }, { travelFk: route.params.id }],
|
||||
},
|
||||
order: 'thermographFk ASC',
|
||||
};
|
||||
|
||||
const fetchTravelThermographsRef = ref(null);
|
||||
const allowedContentTypes = ref('');
|
||||
const user = state.getUser();
|
||||
const thermographsOptions = ref([]);
|
||||
const dmsTypesOptions = ref([]);
|
||||
const companiesOptions = ref([]);
|
||||
const warehousesOptions = ref([]);
|
||||
const temperaturesOptions = ref([]);
|
||||
const thermographForm = ref({});
|
||||
const inputFileRef = ref(null);
|
||||
|
||||
const thermographForm = reactive({
|
||||
thermographId: null,
|
||||
state: null,
|
||||
reference: null,
|
||||
dmsTypeId: null,
|
||||
companyId: null,
|
||||
warehouseId: null,
|
||||
files: [],
|
||||
description: null,
|
||||
});
|
||||
|
||||
onBeforeMount(async () => {
|
||||
if (props.viewAction === 'create') {
|
||||
setCreateDefaultParams();
|
||||
|
@ -65,7 +68,7 @@ const fetchDmsTypes = async () => {
|
|||
try {
|
||||
const params = {
|
||||
filter: {
|
||||
where: { code: 'miscellaneous' },
|
||||
where: { code: 'thermograph' },
|
||||
},
|
||||
};
|
||||
const { data } = await axios.get('DmsTypes/findOne', { params });
|
||||
|
@ -77,88 +80,67 @@ const fetchDmsTypes = async () => {
|
|||
|
||||
const setCreateDefaultParams = async () => {
|
||||
const dataResponse = await fetchDmsTypes();
|
||||
thermographForm.companyId = user.value.companyFk;
|
||||
thermographForm.warehouseId = user.value.warehouseFk;
|
||||
thermographForm.reference = route.params.id;
|
||||
thermographForm.dmsTypeId = dataResponse.id;
|
||||
thermographForm.state = 'Ok';
|
||||
thermographForm.description = t('travel.thermographs.travelFileDescription', {
|
||||
thermographForm.value.companyId = user.value.companyFk;
|
||||
thermographForm.value.warehouseId = user.value.warehouseFk;
|
||||
thermographForm.value.reference = route.params.id;
|
||||
thermographForm.value.dmsTypeId = dataResponse.id;
|
||||
thermographForm.value.state = 'Ok';
|
||||
thermographForm.value.description = t('travel.thermographs.travelFileDescription', {
|
||||
travelId: route.params.id,
|
||||
}).toUpperCase();
|
||||
};
|
||||
|
||||
const setEditDefaultParams = async () => {
|
||||
try {
|
||||
const filterObj = { include: { relation: 'dms' } };
|
||||
const filter = encodeURIComponent(JSON.stringify(filterObj));
|
||||
const { data } = await axios.get(
|
||||
`TravelThermographs/${route.params.thermographId}?filter=${filter}`
|
||||
);
|
||||
const filterObj = { include: { relation: 'dms' } };
|
||||
const filter = encodeURIComponent(JSON.stringify(filterObj));
|
||||
const { data } = await axios.get(
|
||||
`TravelThermographs/${route.query.travelThermographFk}?filter=${filter}`
|
||||
);
|
||||
|
||||
if (data) {
|
||||
thermographForm.thermographId = data.thermographFk;
|
||||
thermographForm.state = data.result;
|
||||
thermographForm.reference = data.dms?.reference;
|
||||
thermographForm.warehouseId = data.dms?.warehouseFk;
|
||||
thermographForm.companyId = data.dms?.companyFk;
|
||||
thermographForm.dmsTypeId = data.dms?.dmsTypeFk;
|
||||
thermographForm.description = data.dms?.description || '';
|
||||
thermographForm.hasFile = data.dms?.hasFile;
|
||||
thermographForm.hasFileAttached = false;
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error fetching termograph');
|
||||
if (data) {
|
||||
thermographForm.value.thermographFk = data.thermographFk;
|
||||
thermographForm.value.state = data.result;
|
||||
thermographForm.value.reference = data.dms?.reference;
|
||||
thermographForm.value.warehouseId = data.dms?.warehouseFk;
|
||||
thermographForm.value.companyId = data.dms?.companyFk;
|
||||
thermographForm.value.dmsTypeId = data.dms?.dmsTypeFk;
|
||||
thermographForm.value.description = data.dms?.description || '';
|
||||
thermographForm.value.hasFile = data.dms?.hasFile;
|
||||
thermographForm.value.hasFileAttached = false;
|
||||
thermographForm.value.maxTemperature = data.maxTemperature;
|
||||
thermographForm.value.minTemperature = data.minTemperature;
|
||||
thermographForm.value.temperatureFk = data.temperatureFk;
|
||||
thermographForm.value.travelThermographFk = data.id;
|
||||
}
|
||||
};
|
||||
|
||||
const onSubmit = () => {
|
||||
props.viewAction === 'create' ? createThermograph() : updateThermograph();
|
||||
};
|
||||
|
||||
const createThermograph = async () => {
|
||||
const onSubmit = async () => {
|
||||
const formData = new FormData();
|
||||
|
||||
thermographForm.files.forEach((file) => {
|
||||
formData.append(file.name, file);
|
||||
});
|
||||
|
||||
try {
|
||||
await axios.post(`/travels/${route.params.id}/createThermograph`, formData, {
|
||||
params: thermographForm,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
if (Array.isArray(thermographForm.value.files)) {
|
||||
thermographForm.value.hasFileAttached = true;
|
||||
thermographForm.value.files.forEach((file) => {
|
||||
formData.append(file.name, file);
|
||||
});
|
||||
router.push({ name: 'TravelThermographsIndex' });
|
||||
notify(t('Thermograph created'), 'positive');
|
||||
} catch (error) {
|
||||
console.error('Error creating thermograph');
|
||||
}
|
||||
};
|
||||
|
||||
const updateThermograph = async () => {
|
||||
const formData = new FormData();
|
||||
|
||||
thermographForm.files.forEach((file) => {
|
||||
formData.append(file.name, file);
|
||||
delete thermographForm.value.files;
|
||||
await axios.post(`/travels/${route.params.id}/saveThermograph`, formData, {
|
||||
params: thermographForm.value,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
await axios.post(`travels/${route.params.id}/updateThermograph`, formData, {
|
||||
params: thermographForm,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
});
|
||||
router.push({ name: 'TravelThermographsIndex' });
|
||||
notify(t('Thermograph created'), 'positive');
|
||||
} catch (error) {
|
||||
console.error('Error creating thermograph');
|
||||
}
|
||||
router.push({ name: 'TravelThermographsIndex' });
|
||||
notify(t('Thermograph created'), 'positive');
|
||||
};
|
||||
|
||||
const onThermographCreated = async (data) => {
|
||||
thermographForm.thermographId = data.id;
|
||||
await fetchTravelThermographsRef.value.fetch();
|
||||
thermographForm.value = {
|
||||
...thermographForm.value,
|
||||
...data,
|
||||
travelThermographFk: data.id,
|
||||
warehouseId: data.warehouseFk,
|
||||
};
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
|
@ -185,6 +167,18 @@ const onThermographCreated = async (data) => {
|
|||
:filter="{ order: 'name' }"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
@on-fetch="(data) => (temperaturesOptions = data)"
|
||||
auto-load
|
||||
url="Temperatures"
|
||||
/>
|
||||
<FetchData
|
||||
ref="fetchTravelThermographsRef"
|
||||
url="TravelThermographs"
|
||||
@on-fetch="(data) => (thermographsOptions = data)"
|
||||
:filter="thermographFilter"
|
||||
auto-load
|
||||
/>
|
||||
<QPage class="column items-center full-width">
|
||||
<QForm
|
||||
model="travel"
|
||||
|
@ -219,21 +213,15 @@ const onThermographCreated = async (data) => {
|
|||
<VnRow>
|
||||
<VnSelectDialog
|
||||
:label="t('travel.thermographs.thermograph')"
|
||||
v-model="thermographForm.thermographId"
|
||||
url="TravelThermographs"
|
||||
option-value="thermographFk"
|
||||
v-model="thermographForm.travelThermographFk"
|
||||
:options="thermographsOptions"
|
||||
option-label="thermographFk"
|
||||
:fields="['thermographFk']"
|
||||
:where="{ travelFk: null }"
|
||||
sort-by="thermographFk ASC"
|
||||
:disable="viewAction === 'edit'"
|
||||
:tooltip="t('New thermograph')"
|
||||
>
|
||||
<template #form>
|
||||
<CreateThermographForm
|
||||
@on-data-saved="
|
||||
(data) => (thermographForm.thermographId = data.id)
|
||||
"
|
||||
@on-data-saved="onThermographCreated"
|
||||
/>
|
||||
</template>
|
||||
</VnSelectDialog>
|
||||
|
@ -271,6 +259,26 @@ const onThermographCreated = async (data) => {
|
|||
option-label="name"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
:label="t('travel.thermographs.temperature')"
|
||||
:options="temperaturesOptions"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="code"
|
||||
v-model="thermographForm.temperatureFk"
|
||||
:required="true"
|
||||
/>
|
||||
<VnInputNumber
|
||||
v-model="thermographForm.maxTemperature"
|
||||
:label="t('globals.maxTemperature')"
|
||||
/>
|
||||
<VnInputNumber
|
||||
v-model="thermographForm.minTemperature"
|
||||
:label="t('globals.minTemperature')"
|
||||
/>
|
||||
</VnRow>
|
||||
|
||||
<VnRow v-if="viewAction === 'edit'" class="row q-gutter-md q-mb-md">
|
||||
<QInput
|
||||
:label="t('globals.description')"
|
||||
|
@ -310,8 +318,8 @@ const onThermographCreated = async (data) => {
|
|||
</QPage>
|
||||
</template>
|
||||
<i18n>
|
||||
es:
|
||||
Select files: Selecciona ficheros
|
||||
Thermograph created: Termógrafo creado
|
||||
New thermograph: Nuevo termógrafo
|
||||
es:
|
||||
Select files: Selecciona ficheros
|
||||
Thermograph created: Termógrafo creado
|
||||
New thermograph: Nuevo termógrafo
|
||||
</i18n>
|
||||
|
|
|
@ -1,18 +1,14 @@
|
|||
<script setup>
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { onMounted, ref, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useRouter, useRoute } from 'vue-router';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import { computed } from 'vue';
|
||||
import TravelSummary from './Card/TravelSummary.vue';
|
||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||
import { toDate } from 'src/filters';
|
||||
import { getDateQBadgeColor } from 'src/composables/getDateQBadgeColor.js';
|
||||
import { dateRange } from 'src/filters';
|
||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const router = useRouter();
|
||||
|
@ -30,7 +26,6 @@ const entityId = computed(() => $props.id || route.params.id);
|
|||
|
||||
onMounted(async () => {
|
||||
stateStore.rightDrawer = true;
|
||||
handleScopeDays();
|
||||
});
|
||||
|
||||
const cloneTravel = (travelData) => {
|
||||
|
@ -38,16 +33,6 @@ const cloneTravel = (travelData) => {
|
|||
redirectToCreateView(stringifiedTravelData);
|
||||
};
|
||||
|
||||
function handleScopeDays(days = 7) {
|
||||
days = +days;
|
||||
tableRef.value.params.scopeDays = days;
|
||||
const [landedFrom, landedTo] = dateRange(Date.vnNew());
|
||||
landedTo.setDate(landedTo.getDate() + days);
|
||||
|
||||
tableRef.value.params.landedFrom = landedFrom;
|
||||
tableRef.value.params.landedTo = landedTo;
|
||||
}
|
||||
|
||||
const redirectToCreateView = (queryParams) => {
|
||||
router.push({ name: 'TravelCreate', query: { travelData: queryParams } });
|
||||
};
|
||||
|
@ -173,6 +158,15 @@ const columns = computed(() => [
|
|||
cardVisible: true,
|
||||
create: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'daysOnward',
|
||||
label: t('travel.travelList.tableVisibleColumns.daysOnward'),
|
||||
visible: false,
|
||||
columnFilter: {
|
||||
inWhere: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
label: '',
|
||||
|
@ -219,12 +213,14 @@ const columns = computed(() => [
|
|||
editorFk: entityId,
|
||||
},
|
||||
}"
|
||||
:user-params="{ daysOnward: 7 }"
|
||||
order="landed DESC"
|
||||
:columns="columns"
|
||||
auto-load
|
||||
redirect="travel"
|
||||
:is-editable="false"
|
||||
:use-model="true"
|
||||
chip-locale="travel.travelList.tableVisibleColumns"
|
||||
>
|
||||
<template #column-shipped="{ row }">
|
||||
<QBadge
|
||||
|
|
Loading…
Reference in New Issue