151 lines
5.2 KiB
Vue
151 lines
5.2 KiB
Vue
<script setup>
|
|
import { onMounted, ref } from 'vue';
|
|
import { useRoute } from 'vue-router';
|
|
import { useI18n } from 'vue-i18n';
|
|
import { useRole } from 'src/composables/useRole';
|
|
import { useState } from 'src/composables/useState';
|
|
import { checkEntryLock } from 'src/composables/checkEntryLock';
|
|
import FetchData from 'components/FetchData.vue';
|
|
import FormModel from 'components/FormModel.vue';
|
|
import VnRow from 'components/ui/VnRow.vue';
|
|
import VnInput from 'src/components/common/VnInput.vue';
|
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
|
import VnSelectTravelExtended from 'src/components/common/VnSelectTravelExtended.vue';
|
|
import VnSelectSupplier from 'src/components/common/VnSelectSupplier.vue';
|
|
|
|
const route = useRoute();
|
|
const { t } = useI18n();
|
|
const { hasAny } = useRole();
|
|
const isAdministrative = () => hasAny(['administrative']);
|
|
const state = useState();
|
|
const user = state.getUser().fn();
|
|
|
|
const companiesOptions = ref([]);
|
|
const currenciesOptions = ref([]);
|
|
|
|
onMounted(() => {
|
|
checkEntryLock(route.params.id, user.id);
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<FetchData
|
|
ref="companiesRef"
|
|
url="Companies"
|
|
:filter="{ fields: ['id', 'code'] }"
|
|
order="code"
|
|
@on-fetch="(data) => (companiesOptions = data)"
|
|
auto-load
|
|
/>
|
|
<FetchData
|
|
ref="currenciesRef"
|
|
url="Currencies"
|
|
:filter="{ fields: ['id', 'code'] }"
|
|
order="code"
|
|
@on-fetch="(data) => (currenciesOptions = data)"
|
|
auto-load
|
|
/>
|
|
<FormModel
|
|
:url-update="`Entries/${route.params.id}`"
|
|
model="Entry"
|
|
auto-load
|
|
:clear-store-on-unmount="false"
|
|
>
|
|
<template #form="{ data }">
|
|
<VnRow>
|
|
<VnSelectTravelExtended
|
|
:data="data"
|
|
v-model="data.travelFk"
|
|
:onFilterTravelSelected="(data, result) => (data.travelFk = result)"
|
|
/>
|
|
<VnSelectSupplier
|
|
v-model="data.supplierFk"
|
|
hide-selected
|
|
:required="true"
|
|
/>
|
|
</VnRow>
|
|
<VnRow>
|
|
<VnInput v-model="data.reference" :label="t('globals.reference')" />
|
|
<VnInputNumber
|
|
v-model="data.invoiceAmount"
|
|
:label="t('entry.summary.invoiceAmount')"
|
|
:positive="false"
|
|
/>
|
|
</VnRow>
|
|
<VnRow>
|
|
<VnInput
|
|
v-model="data.invoiceNumber"
|
|
:label="t('entry.summary.invoiceNumber')"
|
|
/>
|
|
<VnSelect
|
|
:label="t('globals.company')"
|
|
v-model="data.companyFk"
|
|
:options="companiesOptions"
|
|
option-value="id"
|
|
option-label="code"
|
|
map-options
|
|
hide-selected
|
|
:required="true"
|
|
/>
|
|
</VnRow>
|
|
<VnRow>
|
|
<VnInputNumber
|
|
:label="t('entry.summary.commission')"
|
|
v-model="data.commission"
|
|
:step="1"
|
|
:positive="false"
|
|
/>
|
|
<VnSelect
|
|
:label="t('entry.summary.currency')"
|
|
v-model="data.currencyFk"
|
|
:options="currenciesOptions"
|
|
option-value="id"
|
|
option-label="code"
|
|
/>
|
|
</VnRow>
|
|
<VnRow>
|
|
<VnInputNumber
|
|
v-model="data.initialTemperature"
|
|
name="initialTemperature"
|
|
:label="t('entry.basicData.initialTemperature')"
|
|
:step="0.5"
|
|
:decimal-places="2"
|
|
:positive="false"
|
|
/>
|
|
<VnInputNumber
|
|
v-model="data.finalTemperature"
|
|
name="finalTemperature"
|
|
:label="t('entry.basicData.finalTemperature')"
|
|
:step="0.5"
|
|
:decimal-places="2"
|
|
:positive="false"
|
|
/>
|
|
</VnRow>
|
|
<VnRow>
|
|
<QInput
|
|
:label="t('entry.basicData.observation')"
|
|
type="textarea"
|
|
v-model="data.observation"
|
|
:maxlength="45"
|
|
counter
|
|
fill-input
|
|
/>
|
|
</VnRow>
|
|
<VnRow>
|
|
<QCheckbox v-model="data.isOrdered" :label="t('entry.summary.ordered')" />
|
|
<QCheckbox v-model="data.isConfirmed" :label="t('globals.confirmed')" />
|
|
<QCheckbox
|
|
v-model="data.isExcludedFromAvailable"
|
|
:label="t('entry.summary.excludedFromAvailable')"
|
|
/>
|
|
<QCheckbox
|
|
:disable="!isAdministrative()"
|
|
v-model="data.isBooked"
|
|
:label="t('entry.basicData.booked')"
|
|
/>
|
|
</VnRow>
|
|
</template>
|
|
</FormModel>
|
|
</template>
|