forked from verdnatura/salix-front
Remove unused route
This commit is contained in:
parent
1073512aae
commit
31911be3ba
|
@ -1,207 +0,0 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnSubToolbar from 'components/ui/VnSubToolbar.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import { computed, onBeforeMount, ref } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnSelectFilter from 'components/common/VnSelectFilter.vue';
|
||||
import VnInput from 'components/common/VnInput.vue';
|
||||
import axios from 'axios';
|
||||
import { useState } from 'composables/useState';
|
||||
|
||||
const state = useState();
|
||||
const user = state.getUser();
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
|
||||
const formData = ref({});
|
||||
const queryParams = JSON.parse(decodeURI(route.query.q || ''));
|
||||
|
||||
const companyList = ref([]);
|
||||
const warehouseList = ref([]);
|
||||
const dmsList = ref([]);
|
||||
const file = ref(null);
|
||||
const validContentType = ref('');
|
||||
|
||||
onBeforeMount(async () => {
|
||||
const [allowedContentTypes, dmsType] = await Promise.all([
|
||||
axios.get('DmsContainers/allowedContentTypes').then((res) => res.data),
|
||||
axios
|
||||
.get('DmsTypes/findOne', {
|
||||
filter: {
|
||||
where: { code: 'invoiceIn' },
|
||||
},
|
||||
})
|
||||
.then((res) => res.data),
|
||||
]);
|
||||
validContentType.value = (allowedContentTypes || []).join(', ');
|
||||
formData.value = {
|
||||
warehouseId: user.value.warehouseFk,
|
||||
companyId: user.value.companyFk,
|
||||
dmsTypeId: dmsType.id,
|
||||
description: queryParams.supplierName,
|
||||
hasFileAttached: false,
|
||||
hasFile: false,
|
||||
};
|
||||
});
|
||||
|
||||
const requestConfig = computed(() => {
|
||||
console.log(file.value);
|
||||
console.log(file.value?.name);
|
||||
let requestBody = {};
|
||||
if (file.value?.length >= 1) {
|
||||
requestBody = new FormData();
|
||||
requestBody.append('file', file.value[0], file.value[0].name);
|
||||
}
|
||||
return {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
params: {
|
||||
...formData.value,
|
||||
},
|
||||
data: requestBody,
|
||||
};
|
||||
});
|
||||
|
||||
const onSave = (...params) => {
|
||||
console.log('onSave', ...params);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnSubToolbar />
|
||||
<FetchData
|
||||
url="Companies"
|
||||
sort-by="code"
|
||||
limit="30"
|
||||
@on-fetch="(data) => (companyList = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Warehouses"
|
||||
sort-by="name"
|
||||
limit="30"
|
||||
@on-fetch="(data) => (warehouseList = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="DmsTypes"
|
||||
sort-by="name"
|
||||
limit="30"
|
||||
@on-fetch="(data) => (dmsList = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FormModel
|
||||
url-create="dms/uploadFile"
|
||||
model="dms"
|
||||
:observe-form-changes="false"
|
||||
:auto-load="false"
|
||||
:form-initial-data="formData"
|
||||
:request-config="requestConfig"
|
||||
@on-data-saved="onSave"
|
||||
>
|
||||
<template #form>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnInput
|
||||
v-model="formData.reference"
|
||||
:label="t('Reference')"
|
||||
clearable
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('Company')"
|
||||
v-model="formData.companyId"
|
||||
:options="companyList"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
emit-value
|
||||
map-options
|
||||
use-input
|
||||
:input-debounce="0"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('Warehouse')"
|
||||
v-model="formData.warehouseId"
|
||||
:options="warehouseList"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
emit-value
|
||||
map-options
|
||||
use-input
|
||||
:input-debounce="0"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('Type')"
|
||||
v-model="formData.dmsTypeId"
|
||||
:options="dmsList"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
emit-value
|
||||
map-options
|
||||
use-input
|
||||
:input-debounce="0"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnInput
|
||||
v-model="formData.description"
|
||||
:label="t('Description')"
|
||||
clearable
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<QFile
|
||||
v-model="file"
|
||||
:label="t('File')"
|
||||
clearable
|
||||
required
|
||||
:accept="validContentType"
|
||||
multiple
|
||||
:rules="[(value) => value || t('Enter a value')]"
|
||||
@update:model-value="
|
||||
(value) => {
|
||||
console.log(value);
|
||||
formData.hasFileAttached = Boolean(value);
|
||||
}
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<QCheckbox
|
||||
v-model="formData.hasFile"
|
||||
:label="t('Generate identifier for original file')"
|
||||
multiple
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormModel>
|
||||
</template>
|
||||
<i18n>
|
||||
es:
|
||||
Reference: Referencia
|
||||
Company: Empresa
|
||||
Warehouse: Almacén
|
||||
Type: Tipo
|
||||
Description: Descripción
|
||||
File: Fichero
|
||||
Generate identifier for original file: Generar identificador para archivo original
|
||||
</i18n>
|
|
@ -46,14 +46,6 @@ export default {
|
|||
},
|
||||
component: () => import('src/pages/Route/RouteAutonomous.vue'),
|
||||
},
|
||||
{
|
||||
path: 'agency-term/createInvoiceIn',
|
||||
name: 'RouteAutonomousCreateInvoiceIn',
|
||||
meta: {
|
||||
title: 'autonomous',
|
||||
},
|
||||
component: () => import('src/pages/Route/RouteAutonomousCreateInvoiceIn.vue'),
|
||||
},
|
||||
{
|
||||
path: 'roadmap',
|
||||
name: 'RouteRoadmap',
|
||||
|
|
Loading…
Reference in New Issue