refactor(EntryCreate): refs #7527 remove unused EntryCreate component
gitea/salix-front/pipeline/pr-dev Build queued...
Details
gitea/salix-front/pipeline/pr-dev Build queued...
Details
This commit is contained in:
parent
9b692bd966
commit
dc52061cf2
|
@ -1,135 +0,0 @@
|
||||||
<script setup>
|
|
||||||
import { reactive, ref } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
|
||||||
|
|
||||||
import FormModel from 'components/FormModel.vue';
|
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
|
||||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
|
||||||
|
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
|
||||||
import { useState } from 'src/composables/useState';
|
|
||||||
import { toDate } from 'src/filters';
|
|
||||||
import VnSelectSupplier from 'src/components/common/VnSelectSupplier.vue';
|
|
||||||
|
|
||||||
const state = useState();
|
|
||||||
const { t } = useI18n();
|
|
||||||
const route = useRoute();
|
|
||||||
const router = useRouter();
|
|
||||||
const stateStore = useStateStore();
|
|
||||||
|
|
||||||
const user = state.getUser();
|
|
||||||
const newEntryForm = reactive({
|
|
||||||
supplierFk: null,
|
|
||||||
travelFk: Number(route.query?.travelFk) || null,
|
|
||||||
companyFk: user.value.companyFk || null,
|
|
||||||
});
|
|
||||||
const travelsOptions = ref([]);
|
|
||||||
const companiesOptions = ref([]);
|
|
||||||
|
|
||||||
const redirectToEntryBasicData = (_, { id }) => {
|
|
||||||
router.push({ name: 'EntryBasicData', params: { id } });
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<FetchData
|
|
||||||
url="Travels/filter"
|
|
||||||
:filter="{ fields: ['id', 'warehouseInName'] }"
|
|
||||||
order="id"
|
|
||||||
@on-fetch="(data) => (travelsOptions = data)"
|
|
||||||
auto-load
|
|
||||||
/>
|
|
||||||
<FetchData
|
|
||||||
ref="companiesRef"
|
|
||||||
url="Companies"
|
|
||||||
:filter="{ fields: ['id', 'code'] }"
|
|
||||||
order="code"
|
|
||||||
@on-fetch="(data) => (companiesOptions = data)"
|
|
||||||
auto-load
|
|
||||||
/>
|
|
||||||
<template v-if="stateStore.isHeaderMounted()">
|
|
||||||
<Teleport to="#searchbar">
|
|
||||||
<VnSearchbar
|
|
||||||
url="Entries/filter"
|
|
||||||
custom-route-redirect-name="EntrySummary"
|
|
||||||
data-key="Entry"
|
|
||||||
:label="t('Search entries')"
|
|
||||||
:info="t('You can search by entry reference')"
|
|
||||||
/>
|
|
||||||
</Teleport>
|
|
||||||
</template>
|
|
||||||
<QPage>
|
|
||||||
<VnSubToolbar />
|
|
||||||
<FormModel
|
|
||||||
url-create="Entries"
|
|
||||||
model="entry"
|
|
||||||
:form-initial-data="newEntryForm"
|
|
||||||
@on-data-saved="redirectToEntryBasicData"
|
|
||||||
>
|
|
||||||
<template #form="{ data, validate }">
|
|
||||||
<VnRow>
|
|
||||||
<VnSelectSupplier
|
|
||||||
class="full-width"
|
|
||||||
v-model="data.supplierFk"
|
|
||||||
hide-selected
|
|
||||||
:required="true"
|
|
||||||
:rules="validate('entry.supplierFk')"
|
|
||||||
/>
|
|
||||||
</VnRow>
|
|
||||||
<VnRow>
|
|
||||||
<VnSelect
|
|
||||||
:label="t('Travel')"
|
|
||||||
class="full-width"
|
|
||||||
v-model="data.travelFk"
|
|
||||||
:options="travelsOptions"
|
|
||||||
option-value="id"
|
|
||||||
option-label="warehouseInName"
|
|
||||||
map-options
|
|
||||||
hide-selected
|
|
||||||
:required="true"
|
|
||||||
:rules="validate('entry.travelFk')"
|
|
||||||
>
|
|
||||||
<template #option="scope">
|
|
||||||
<QItem v-bind="scope.itemProps">
|
|
||||||
<QItemSection>
|
|
||||||
<QItemLabel
|
|
||||||
>{{ scope.opt?.agencyModeName }} -
|
|
||||||
{{ scope.opt?.warehouseInName }} ({{
|
|
||||||
toDate(scope.opt?.shipped)
|
|
||||||
}}) → {{ scope.opt?.warehouseOutName }} ({{
|
|
||||||
toDate(scope.opt?.landed)
|
|
||||||
}})</QItemLabel
|
|
||||||
>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
</VnSelect>
|
|
||||||
</VnRow>
|
|
||||||
<VnRow>
|
|
||||||
<VnSelect
|
|
||||||
:label="t('Company')"
|
|
||||||
class="full-width"
|
|
||||||
v-model="data.companyFk"
|
|
||||||
:options="companiesOptions"
|
|
||||||
option-value="id"
|
|
||||||
option-label="code"
|
|
||||||
map-options
|
|
||||||
hide-selected
|
|
||||||
:required="true"
|
|
||||||
:rules="validate('entry.companyFk')"
|
|
||||||
/>
|
|
||||||
</VnRow>
|
|
||||||
</template>
|
|
||||||
</FormModel>
|
|
||||||
</QPage>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<i18n>
|
|
||||||
es:
|
|
||||||
Travel: Envío
|
|
||||||
Company: Empresa
|
|
||||||
</i18n>
|
|
Loading…
Reference in New Issue