Merge pull request 'New general improvements' (#24) from feature/new-improvements into dev

Reviewed-on: hyervoni/salix-front-mindshore#24
This commit is contained in:
William Buezas 2023-12-01 11:24:55 +00:00
commit cdcdd4c544
14 changed files with 282 additions and 309 deletions

View File

@ -6,6 +6,7 @@ import { useQuasar } from 'quasar';
import { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useValidator } from 'src/composables/useValidator'; import { useValidator } from 'src/composables/useValidator';
import useNotify from 'src/composables/useNotify.js';
import SkeletonForm from 'components/ui/SkeletonForm.vue'; import SkeletonForm from 'components/ui/SkeletonForm.vue';
const quasar = useQuasar(); const quasar = useQuasar();
@ -13,6 +14,7 @@ const state = useState();
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
const { validate } = useValidator(); const { validate } = useValidator();
const { notify } = useNotify();
const $props = defineProps({ const $props = defineProps({
url: { url: {
@ -31,6 +33,10 @@ const $props = defineProps({
type: String, type: String,
default: null, default: null,
}, },
urlCreate: {
type: String,
default: null,
},
defaultActions: { defaultActions: {
type: Boolean, type: Boolean,
default: true, default: true,
@ -39,6 +45,16 @@ const $props = defineProps({
type: Boolean, type: Boolean,
default: false, default: false,
}, },
formInitialData: {
type: Object,
default: () => {},
},
observeFormChanges: {
type: Boolean,
default: true,
description:
'Esto se usa principalmente para permitir guardar sin hacer cambios (Útil para la feature de clonar ya que en este caso queremos poder guardar de primeras)',
},
}); });
const emit = defineEmits(['onFetch']); const emit = defineEmits(['onFetch']);
@ -48,9 +64,17 @@ defineExpose({
}); });
onMounted(async () => { onMounted(async () => {
if ($props.autoLoad) { // Podemos enviarle al form la estructura de data inicial sin necesidad de fetchearla
if ($props.formInitialData && !$props.autoLoad) {
state.set($props.model, $props.formInitialData);
} else {
await fetch(); await fetch();
} }
// Disparamos el watcher del form después de que se haya cargado la data inicial, si así se desea
if ($props.observeFormChanges) {
startFormWatcher();
}
}); });
onUnmounted(() => { onUnmounted(() => {
@ -58,11 +82,22 @@ onUnmounted(() => {
}); });
const isLoading = ref(false); const isLoading = ref(false);
const hasChanges = ref(false); // Si elegimos observar los cambios del form significa que inicialmente las actions estaran deshabilitadas
const hasChanges = ref(!$props.observeFormChanges);
const originalData = ref(); const originalData = ref();
const formData = computed(() => state.get($props.model)); const formData = computed(() => state.get($props.model));
const formUrl = computed(() => $props.url); const formUrl = computed(() => $props.url);
const startFormWatcher = () => {
watch(
() => formData.value,
(val) => {
if (val) hasChanges.value = true;
},
{ deep: true }
);
};
function tMobile(...args) { function tMobile(...args) {
if (!quasar.platform.is.mobile) return t(...args); if (!quasar.platform.is.mobile) return t(...args);
} }
@ -75,20 +110,26 @@ async function fetch() {
state.set($props.model, data); state.set($props.model, data);
originalData.value = data && JSON.parse(JSON.stringify(data)); originalData.value = data && JSON.parse(JSON.stringify(data));
watch(formData.value, () => (hasChanges.value = true));
emit('onFetch', state.get($props.model)); emit('onFetch', state.get($props.model));
} }
async function save() { async function save() {
if (!hasChanges.value) { if (!hasChanges.value) {
return quasar.notify({ notify('globals.noChanges', 'negative');
type: 'negative', return;
message: t('globals.noChanges'),
});
} }
isLoading.value = true; isLoading.value = true;
await axios.patch($props.urlUpdate || $props.url, formData.value);
try {
if ($props.urlCreate) {
await axios.post($props.urlCreate, formData.value);
notify('globals.dataCreated', 'positive');
} else {
await axios.patch($props.urlUpdate || $props.url, formData.value);
}
} catch (err) {
notify('errors.create', 'negative');
}
originalData.value = JSON.parse(JSON.stringify(formData.value)); originalData.value = JSON.parse(JSON.stringify(formData.value));
hasChanges.value = false; hasChanges.value = false;
@ -99,8 +140,6 @@ function reset() {
state.set($props.model, originalData.value); state.set($props.model, originalData.value);
originalData.value = JSON.parse(JSON.stringify(originalData.value)); originalData.value = JSON.parse(JSON.stringify(originalData.value));
watch(formData.value, () => (hasChanges.value = true));
emit('onFetch', state.get($props.model)); emit('onFetch', state.get($props.model));
hasChanges.value = false; hasChanges.value = false;
} }

View File

@ -15,6 +15,7 @@ export default {
logOut: 'Log out', logOut: 'Log out',
dataSaved: 'Data saved', dataSaved: 'Data saved',
dataDeleted: 'Data deleted', dataDeleted: 'Data deleted',
dataCreated: 'Data created',
add: 'Add', add: 'Add',
create: 'Create', create: 'Create',
save: 'Save', save: 'Save',
@ -45,6 +46,7 @@ export default {
statusBadGateway: 'It seems that the server has fall down', statusBadGateway: 'It seems that the server has fall down',
statusGatewayTimeout: 'Could not contact the server', statusGatewayTimeout: 'Could not contact the server',
userConfig: 'Error fetching user config', userConfig: 'Error fetching user config',
create: 'Error during creation',
}, },
login: { login: {
title: 'Login', title: 'Login',
@ -629,11 +631,6 @@ export default {
create: 'Create', create: 'Create',
summary: 'Summary', summary: 'Summary',
}, },
list: {
clone: 'Clone',
addEntry: 'Add entry',
preview: 'Preview',
},
summary: { summary: {
confirmed: 'Confirmed', confirmed: 'Confirmed',
entryId: 'Entry Id', entryId: 'Entry Id',
@ -655,6 +652,7 @@ export default {
logOut: 'Log Out', logOut: 'Log Out',
}, },
smartCard: { smartCard: {
clone: 'Clone',
openCard: 'View', openCard: 'View',
openSummary: 'Summary', openSummary: 'Summary',
viewDescription: 'Description', viewDescription: 'Description',

View File

@ -15,6 +15,7 @@ export default {
logOut: 'Cerrar sesión', logOut: 'Cerrar sesión',
dataSaved: 'Datos guardados', dataSaved: 'Datos guardados',
dataDeleted: 'Datos eliminados', dataDeleted: 'Datos eliminados',
dataCreated: 'Datos creados',
add: 'Añadir', add: 'Añadir',
create: 'Crear', create: 'Crear',
save: 'Guardar', save: 'Guardar',
@ -45,6 +46,7 @@ export default {
statusBadGateway: 'Parece ser que el servidor ha caído', statusBadGateway: 'Parece ser que el servidor ha caído',
statusGatewayTimeout: 'No se ha podido contactar con el servidor', statusGatewayTimeout: 'No se ha podido contactar con el servidor',
userConfig: 'Error al obtener configuración de usuario', userConfig: 'Error al obtener configuración de usuario',
create: 'Error al crear',
}, },
login: { login: {
title: 'Inicio de sesión', title: 'Inicio de sesión',
@ -631,11 +633,6 @@ export default {
create: 'Crear', create: 'Crear',
summary: 'Resumen', summary: 'Resumen',
}, },
list: {
clone: 'Clonar',
addEntry: 'Añadir entrada',
preview: 'Vista previa',
},
summary: { summary: {
confirmed: 'Confirmado', confirmed: 'Confirmado',
entryId: 'Id entrada', entryId: 'Id entrada',
@ -657,6 +654,7 @@ export default {
logOut: 'Cerrar sesión', logOut: 'Cerrar sesión',
}, },
smartCard: { smartCard: {
clone: 'Clonar',
openCard: 'Ficha', openCard: 'Ficha',
openSummary: 'Detalles', openSummary: 'Detalles',
viewDescription: 'Descripción', viewDescription: 'Descripción',

View File

@ -160,7 +160,7 @@ onUnmounted(() => {
.status-text { .status-text {
font-size: 14px; font-size: 14px;
color: #eeeeee; color: white;
} }
.text { .text {

View File

@ -148,7 +148,7 @@ const downloadCsv = (rows) => {
flat flat
icon="cloud_download" icon="cloud_download"
round round
v-bind:class="{ dark_icon: !manageCheckboxes }" :class="{ dark_icon: !manageCheckboxes }"
> >
<QMenu> <QMenu>
<QList padding dense> <QList padding dense>
@ -178,11 +178,11 @@ const downloadCsv = (rows) => {
/> />
</div> </div>
<CardList <CardList
:addElement="addElement" :add-element="addElement"
:element="row" :element="row"
:id="row.id" :id="row.id"
:isSelected="manageCheckboxes" :is-selected="manageCheckboxes"
:showCheckbox="true" :show-checkbox="true"
:key="row.id" :key="row.id"
:title="row.ref" :title="row.ref"
@click="navigate(row.id)" @click="navigate(row.id)"
@ -252,18 +252,15 @@ const downloadCsv = (rows) => {
</style> </style>
<i18n> <i18n>
{ en:
"en": { searchInvoice: Search issued invoice
"searchInvoice": "Search issued invoice", fileDenied: Browser denied file download...
"fileDenied": "Browser denied file download...", fileAllowed: Successful download of CSV file
"fileAllowed": "Successful download of CSV file", youCanSearchByInvoiceReference: You can search by invoice reference
"youCanSearchByInvoiceReference": "You can search by invoice reference"
}, es:
"es": { searchInvoice: Buscar factura emitida
"searchInvoice": "Buscar factura emitida", fileDenied: El navegador denegó la descarga de archivos...
"fileDenied": "El navegador denegó la descarga de archivos...", fileAllowed: Descarga exitosa de archivo CSV
"fileAllowed": "Descarga exitosa de archivo CSV", youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura
"youCanSearchByInvoiceReference": "Puedes buscar por referencia de la factura"
}
}
</i18n> </i18n>

View File

@ -313,7 +313,7 @@ onMounted(async () => {
</template> </template>
<template #top-right> <template #top-right>
<div class="row justify-start items-center"> <div class="row justify-start items-center">
<span class="q-mr-md text-grey-7"> <span class="q-mr-md text-results">
{{ rows.length }} {{ t('results') }} {{ rows.length }} {{ t('results') }}
</span> </span>
<QBtn <QBtn
@ -332,24 +332,18 @@ onMounted(async () => {
<div class="column justify-start items-start full-height"> <div class="column justify-start items-start full-height">
{{ t(`invoiceOut.negativeBases.${col.label}`) }} {{ t(`invoiceOut.negativeBases.${col.label}`) }}
<QInput <QInput
:disable=" :class="{
[ invisible:
'isActive', col.field === 'isActive' ||
'hasToInvoice', col.field === 'hasToInvoice' ||
'isTaxDataChecked', col.field === 'isTaxDataChecked',
].includes(col.field) }"
"
:borderless="
[
'isActive',
'hasToInvoice',
'isTaxDataChecked',
].includes(col.field)
"
dense dense
standout outlined
rounded
v-model="filter[col.field]" v-model="filter[col.field]"
type="text" type="text"
@keyup.enter="search()"
/> />
</div> </div>
</QTh> </QTh>
@ -387,55 +381,14 @@ onMounted(async () => {
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.card {
display: flex;
justify-content: center;
width: 100%;
background-color: #292929;
padding: 16px;
.card-section {
display: flex;
flex-direction: column;
padding: 0px;
}
.status-text {
font-size: 14px;
color: #eeeeee;
}
.text {
font-size: 14px;
color: #aaaaaa;
}
}
.col-content { .col-content {
border-radius: 4px; border-radius: 4px;
padding: 6px 6px 6px 6px; padding: 6px 6px 6px 6px;
} }
.text-results {
color: var(--vn-label);
}
</style> </style>
<i18n> <i18n></i18n>
{
"en": {
"status": {
"packageInvoicing": "Build packaging tickets",
"invoicing": "Invoicing client",
"stopping": "Stopping process",
"done": "Ended process"
},
"of": "of"
},
"es": {
"status":{
"packageInvoicing": "Generación de tickets de empaque",
"invoicing": "Facturando a cliente",
"stopping": "Deteniendo proceso",
"done": "Proceso detenido",
},
"of": "de"
}
}
</i18n>

View File

@ -1,22 +1,17 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { ref } from 'vue'; import { reactive } from 'vue';
import suppliersService from 'src/services/suppliers.service';
import { useRouter } from 'vue-router';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
const { t } = useI18n(); const { t } = useI18n();
const router = useRouter();
const stateStore = useStateStore(); const stateStore = useStateStore();
const newSupplierName = ref(); const newSupplierForm = reactive({
name: null,
const createSupplier = async () => { });
const params = { name: newSupplierName.value };
const response = await suppliersService.createSupplier(params);
if (response.status === 200) router.push({ path: `/supplier/${response.data.id}` });
};
</script> </script>
<template> <template>
@ -30,27 +25,28 @@ const createSupplier = async () => {
</Teleport> </Teleport>
</template> </template>
<QPage class="q-pa-md"> <QPage>
<QForm <QToolbar class="bg-vn-dark justify-end">
@submit="createSupplier()" <div id="st-data"></div>
class="text-white q-mx-auto" <QSpace />
style="max-width: 800px" <div id="st-actions"></div>
</QToolbar>
<FormModel
url-create="Suppliers/newSupplier"
model="supplier"
:form-initial-data="newSupplierForm"
> >
<QCard class="card"> <template #form="{ data }">
<QInput <VnRow class="row q-gutter-md q-mb-md">
v-model="newSupplierName" <div class="col">
:label="t('supplier.create.supplierName')" <QInput
class="full-width" v-model="data.name"
/> :label="t('supplier.create.supplierName')"
</QCard> />
<QBtn </div>
:label="t('globals.create')" </VnRow>
type="submit" </template>
color="primary" </FormModel>
class="q-mt-md"
/>
<QBtn :label="t('globals.cancel')" class="q-mt-md" flat />
</QForm>
</QPage> </QPage>
</template> </template>

View File

@ -1,18 +1,19 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { reactive, computed, ref } from 'vue'; import { reactive, ref } from 'vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import { useTravelStore } from 'src/stores/travel'; import { useRoute } from 'vue-router';
import { useRouter, useRoute } from 'vue-router';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import { toDate } from 'src/filters';
import { onBeforeMount } from 'vue'; import { onBeforeMount } from 'vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const router = useRouter();
const travelStore = useTravelStore();
const newTravelDataForm = reactive({ const newTravelForm = reactive({
ref: null, ref: null,
agencyModeFk: null, agencyModeFk: null,
shipped: null, shipped: null,
@ -22,27 +23,26 @@ const newTravelDataForm = reactive({
}); });
const agenciesOptions = ref([]); const agenciesOptions = ref([]);
const viewAction = ref();
const warehousesOptions = ref([]); const warehousesOptions = ref([]);
onBeforeMount(() => { onBeforeMount(() => {
// Esto nos permite decirle a FormModel si queremos observar los cambios o no
// Ya que si queremos clonar queremos que nos permita guardar inmediatamente sin realizar cambios en el form
viewAction.value = route.query.travelData ? 'clone' : 'create';
if (route.query.travelData) { if (route.query.travelData) {
const travelData = JSON.parse(route.query.travelData); const travelData = JSON.parse(route.query.travelData);
for (let key in newTravelDataForm) { for (let key in newTravelForm) {
if (key === 'landed' || key === 'shipped') { if (key === 'landed' || key === 'shipped') {
newTravelDataForm[key] = travelData[key].substring(0, 10); newTravelForm[key] = travelData[key].substring(0, 10);
} else { } else {
newTravelDataForm[key] = travelData[key]; newTravelForm[key] = travelData[key];
} }
} }
} }
}); });
const createTravel = async () => {
const response = await travelStore.createTravel(newTravelDataForm);
if (response.status === 200) router.push({ path: `/travel/${response.data.id}` });
};
const onFetchAgencies = (agencies) => { const onFetchAgencies = (agencies) => {
agenciesOptions.value = [...agencies]; agenciesOptions.value = [...agencies];
}; };
@ -50,93 +50,126 @@ const onFetchAgencies = (agencies) => {
const onFetchWarehouses = (warehouses) => { const onFetchWarehouses = (warehouses) => {
warehousesOptions.value = [...warehouses]; warehousesOptions.value = [...warehouses];
}; };
const canSubmit = computed(() => {
for (const key in newTravelDataForm) {
if (!newTravelDataForm[key]) return false;
}
return true;
});
const redirectToTravelList = () => {
router.push({ name: 'TravelList' });
};
</script> </script>
<template> <template>
<FetchData url="AgencyModes" @on-fetch="(data) => onFetchAgencies(data)" auto-load /> <FetchData url="AgencyModes" @on-fetch="(data) => onFetchAgencies(data)" auto-load />
<FetchData url="Warehouses" @on-fetch="(data) => onFetchWarehouses(data)" auto-load /> <FetchData url="Warehouses" @on-fetch="(data) => onFetchWarehouses(data)" auto-load />
<QPage class="q-pa-md"> <QPage>
<QForm <QToolbar class="bg-vn-dark">
@submit="createTravel()" <div id="st-data"></div>
class="text-white column q-mx-auto" <QSpace />
style="max-width: 800px" <div id="st-actions"></div>
</QToolbar>
<FormModel
url-update="Travels"
model="travel"
:form-initial-data="newTravelForm"
:observe-form-changes="viewAction === 'create'"
> >
<QCard class="row q-pa-xl full-width card"> <template #form="{ data }">
<QInput <VnRow class="row q-gutter-md q-mb-md">
v-model="newTravelDataForm.ref" <div class="col">
:label="t('travel.shared.reference')" <QInput
filled v-model="data.ref"
/> :label="t('travel.shared.reference')"
<VnSelectFilter />
:label="t('travel.shared.agency')" </div>
v-model="newTravelDataForm.agencyModeFk" <div class="col">
:options="agenciesOptions" <VnSelectFilter
option-value="agencyFk" :label="t('travel.shared.agency')"
option-label="name" v-model="data.agencyModeFk"
hide-selected :options="agenciesOptions"
filled option-value="agencyFk"
/> option-label="name"
<QInput hide-selected
v-model="newTravelDataForm.shipped" />
type="date" </div>
filled </VnRow>
mask="date" <VnRow class="row q-gutter-md q-mb-md">
:label="t('travel.shared.shipped')" <div class="col">
/> <QInput
<QInput rounded
v-model="newTravelDataForm.landed" placeholder="dd-mm-aaa"
type="date" :label="t('travel.shared.landed')"
filled :model-value="toDate(data.shipped)"
mask="date" >
:label="t('travel.shared.landed')" <template #append>
/> <QIcon name="event" class="cursor-pointer">
<VnSelectFilter <QPopupProxy
:label="t('travel.shared.wareHouseOut')" cover
v-model="newTravelDataForm.warehouseOutFk" transition-show="scale"
:options="warehousesOptions" transition-hide="scale"
option-value="id" >
option-label="name" <QDate v-model="data.shipped">
hide-selected <div class="row items-center justify-end">
filled <QBtn
/> v-close-popup
<VnSelectFilter label="Close"
:label="t('travel.shared.wareHouseIn')" color="primary"
v-model="newTravelDataForm.warehouseInFk" flat
:options="warehousesOptions" />
option-value="id" </div>
option-label="name" </QDate>
hide-selected </QPopupProxy>
filled </QIcon>
/> </template>
</QCard> </QInput>
<div class="row"> </div>
<QBtn <div class="col">
:label="t('globals.create')" <QInput
type="submit" rounded
color="primary" placeholder="dd-mm-aaa"
class="q-mt-md" :label="t('travel.shared.landed')"
:disable="!canSubmit" :model-value="toDate(data.landed)"
/> >
<QBtn <template #append>
:label="t('globals.cancel')" <QIcon name="event" class="cursor-pointer">
class="q-mt-md" <QPopupProxy
flat cover
:disable="!canSubmit" transition-show="scale"
@click="redirectToTravelList()" transition-hide="scale"
/> >
</div> <QDate v-model="data.landed">
</QForm> <div class="row items-center justify-end">
<QBtn
v-close-popup
label="Close"
color="primary"
flat
/>
</div>
</QDate>
</QPopupProxy>
</QIcon>
</template>
</QInput>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelectFilter
:label="t('travel.shared.wareHouseOut')"
v-model="data.warehouseOutFk"
:options="warehousesOptions"
option-value="id"
option-label="name"
hide-selected
/>
</div>
<div class="col">
<VnSelectFilter
:label="t('travel.shared.wareHouseIn')"
v-model="data.warehouseInFk"
:options="warehousesOptions"
option-value="id"
option-label="name"
hide-selected
/>
</div>
</VnRow>
</template>
</FormModel>
</QPage> </QPage>
</template> </template>

View File

@ -66,7 +66,6 @@ const decrement = (paramsObj, key) => {
<QInput <QInput
:label="t('params.search')" :label="t('params.search')"
dense dense
lazy-rules
outlined outlined
rounded rounded
v-model="params.search" v-model="params.search"
@ -125,7 +124,6 @@ const decrement = (paramsObj, key) => {
type="number" type="number"
:label="t('params.scopeDays')" :label="t('params.scopeDays')"
dense dense
lazy-rules
outlined outlined
rounded rounded
class="input-number" class="input-number"
@ -153,7 +151,6 @@ const decrement = (paramsObj, key) => {
<QItemSection> <QItemSection>
<QInput <QInput
dense dense
lazy-rules
outlined outlined
rounded rounded
placeholder="dd-mm-aaa" placeholder="dd-mm-aaa"
@ -187,7 +184,6 @@ const decrement = (paramsObj, key) => {
<QItemSection> <QItemSection>
<QInput <QInput
dense dense
lazy-rules
outlined outlined
rounded rounded
placeholder="dd-mm-aaa" placeholder="dd-mm-aaa"
@ -239,7 +235,6 @@ const decrement = (paramsObj, key) => {
type="number" type="number"
:label="t('params.totalEntries')" :label="t('params.totalEntries')"
dense dense
lazy-rules
outlined outlined
rounded rounded
min="0" min="0"
@ -286,32 +281,27 @@ const decrement = (paramsObj, key) => {
</style> </style>
<i18n> <i18n>
{ en:
"en": { params:
"params": { search: Id/Reference
"search": "Id/Reference", agencyModeFk: Agency
"agencyModeFk": "Agency", warehouseInFk: Warehouse In
"warehouseInFk": "Warehouse In", warehouseOutFk: Warehouse Out
"warehouseOutFk": "Warehouse Out", scopeDays: Days onward
"scopeDays": "Days onward", landedFrom: Landed from
"landedFrom": "Landed from", landedTo: Landed to
"landedTo": "Landed to", continent: Continent out
"continent": "Continent out", totalEntries: Total entries
"totalEntries": "Total entries" es:
}, params:
}, search: Id/Referencia
"es": { agencyModeFk: Agencia
"params":{ warehouseInFk: Alm. entrada
"search": "Id/Referencia", warehouseOutFk: Alm. salida
"agencyModeFk": "Agencia", scopeDays: Días adelante
"warehouseInFk": "Alm. entrada", landedFrom: Llegada desde
"warehouseOutFk": "Alm. salida", landedTo: Llegada hasta
"scopeDays": "Días adelante", continent: Cont. Salida
"landedFrom": "Llegada desde", totalEntries: Ent. totales
"landedTo": "Llegada hasta",
"continent": "Cont. Salida",
"totalEntries": "Ent. totales"
},
}
}
</i18n> </i18n>

View File

@ -98,25 +98,23 @@ onMounted(async () => {
</template> </template>
<template #actions> <template #actions>
<QBtn <QBtn
:label="t('travel.list.clone')" :label="t('components.smartCard.clone')"
@click.stop="cloneTravel(row)" @click.stop="cloneTravel(row)"
color="white" color="white"
outline outline
type="reset"
/> />
<QBtn <QBtn
:label="t('travel.list.addEntry')" :label="t('addEntry')"
@click.stop="viewSummary(row.id)"
color="white"
outline
style="margin-top: 15px"
/>
<QBtn
:label="t('components.smartCard.openSummary')"
@click.stop="viewSummary(row.id)" @click.stop="viewSummary(row.id)"
color="primary" color="primary"
style="margin-top: 15px" style="margin-top: 15px"
type="submit"
/>
<QBtn
:label="t('travel.list.preview')"
@click.stop="viewSummary(row.id)"
color="primary"
style="margin-top: 15px"
type="submit"
/> />
</template> </template>
</CardList> </CardList>
@ -140,5 +138,12 @@ onMounted(async () => {
</style> </style>
<i18n> <i18n>
en:
addEntry: Add entry
es:
addEntry: Añadir entrada
</i18n> </i18n>

View File

@ -1,14 +0,0 @@
import axios from 'axios';
const suppliersService = {
createSupplier: async (formData) => {
try {
return await axios.post('Suppliers/newSupplier', formData);
} catch (err) {
console.error(`Error creating new supplier`, err);
return err.response;
}
},
};
export default suppliersService;

View File

@ -10,15 +10,6 @@ const travelService = {
} }
}, },
createTravel: async (params) => {
try {
return await axios.patch('Travels', params);
} catch (err) {
console.error(`Error creating travel`, err);
return err.response;
}
},
getTravelEntries: async (param) => { getTravelEntries: async (param) => {
try { try {
return await axios.get(`Travels/${param}/getEntries`); return await axios.get(`Travels/${param}/getEntries`);

View File

@ -17,19 +17,6 @@ export const useTravelStore = defineStore({
const { data } = await travelService.getTravels(); const { data } = await travelService.getTravels();
this.travels = data || []; this.travels = data || [];
}, },
async createTravel(travelData) {
const params = {
ref: travelData.ref,
agencyModeFk: travelData.agencyModeFk,
warehouseOutFk: travelData.warehouseOutFk,
warehouseInFk: travelData.warehouseInFk,
landed: new Date(travelData.landed),
shipped: new Date(travelData.shipped),
};
return await travelService.createTravel(params);
},
}, },
getters: {}, getters: {},