#4560 - gastos-reparto #421
|
@ -257,6 +257,7 @@ export default {
|
||||||
deliveryManList: 'Delivery Men',
|
deliveryManList: 'Delivery Men',
|
||||||
basicData: 'Basic Data',
|
basicData: 'Basic Data',
|
||||||
deliveryManCreate: 'Create Delivery Man',
|
deliveryManCreate: 'Create Delivery Man',
|
||||||
|
invoiceAllocation: 'Invoice Allocation',
|
||||||
},
|
},
|
||||||
deliveryMan: {
|
deliveryMan: {
|
||||||
list: {
|
list: {
|
||||||
|
|
|
@ -256,6 +256,7 @@ export default {
|
||||||
deliveryManList: 'Repartidores',
|
deliveryManList: 'Repartidores',
|
||||||
basicData: 'Datos básicos',
|
basicData: 'Datos básicos',
|
||||||
deliveryManCreate: 'Crear Repartidor',
|
deliveryManCreate: 'Crear Repartidor',
|
||||||
|
invoiceAllocation: 'Imputación Facturas',
|
||||||
},
|
},
|
||||||
deliveryMan: {
|
deliveryMan: {
|
||||||
list: {
|
list: {
|
||||||
|
|
|
@ -1,44 +1,126 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { reactive } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
const deliveryMan = reactive({
|
const deliveryMan = reactive({
|
||||||
supplierFk: null,
|
supplierFk: null,
|
||||||
agencyMode: null,
|
agencyModeFk: null,
|
||||||
minCost: null,
|
minCost: null,
|
||||||
minM3: null,
|
minM3: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const suppliers = ref([]);
|
||||||
|
const agencyModes = ref([]);
|
||||||
|
|
||||||
|
function setSuppliers(data) {
|
||||||
|
suppliers.value = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setAgencyModes(data) {
|
||||||
|
agencyModes.value = data;
|
||||||
|
}
|
||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
await axios.post('DeliveryMans', {
|
try {
|
||||||
supplierFk: deliveryMan.supplierFk,
|
const newDeliveryMan = await axios.post('DeliveryMans', {
|
||||||
minCost: deliveryMan.minCost,
|
supplierFk: deliveryMan.supplierFk,
|
||||||
minM3: deliveryMan.minM3,
|
minCost: deliveryMan.minCost,
|
||||||
});
|
minM3: deliveryMan.minM3,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (deliveryMan.agencyModeFk) {
|
||||||
|
await axios.post(`DeliveryManAgencys/${newDeliveryMan.id}`, {
|
||||||
|
agencyModeFk: deliveryMan.agencyMode,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<q-page class="q-pa-md">
|
<fetch-data url="Suppliers" @on-fetch="setSuppliers" auto-load />
|
||||||
|
<fetch-data url="AgencyModes" @on-fetch="setAgencyModes" auto-load />
|
||||||
|
<div class="container">
|
||||||
<q-card class="q-pa-md">
|
<q-card class="q-pa-md">
|
||||||
<q-banner v-if="hasChanges" class="text-white bg-warning">
|
<q-banner v-if="hasChanges" class="text-white bg-warning">
|
||||||
<q-icon name="warning" size="md" class="q-mr-md" />
|
<q-icon name="warning" size="md" class="q-mr-md" />
|
||||||
<span>{{ t('globals.changesToSave') }}</span>
|
<span>{{ t('globals.changesToSave') }}</span>
|
||||||
</q-banner>
|
</q-banner>
|
||||||
<q-form @submit="onSubmit" @reset="onReset" class="q-gutter-md">
|
<q-form @submit="onSubmit" @reset="onReset" class="q-gutter-md">
|
||||||
<q-input filled v-model="deliveryMan.minCost" label="Your name *" lazy-rules />
|
<div class="row q-gutter-md q-mb-md">
|
||||||
<div>
|
<div class="col">
|
||||||
<q-btn label="Submit" type="submit" color="primary" />
|
<q-input
|
||||||
<q-btn label="Reset" type="reset" color="primary" flat class="q-ml-sm" />
|
filled
|
||||||
|
v-model="deliveryMan.minCost"
|
||||||
|
:label="t('route.deliveryMan.basicData.minCost')"
|
||||||
|
:rules="[(val) => val > 0]"
|
||||||
|
lazy-rules
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<q-input
|
||||||
|
filled
|
||||||
|
v-model="deliveryMan.minM3"
|
||||||
|
:label="t('route.deliveryMan.basicData.minM3')"
|
||||||
|
:rules="[(val) => val > 0]"
|
||||||
|
lazy-rules
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row q-gutter-md q-mb-md">
|
||||||
|
<div class="col">
|
||||||
|
<q-select
|
||||||
|
v-model="deliveryMan.supplierFk"
|
||||||
|
:options="suppliers"
|
||||||
|
option-value="id"
|
||||||
|
option-label="name"
|
||||||
|
emit-value
|
||||||
|
:label="t('route.deliveryMan.basicData.supplier')"
|
||||||
|
map-options
|
||||||
|
use-input
|
||||||
|
:input-debounce="0"
|
||||||
|
>
|
||||||
|
</q-select>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<q-select
|
||||||
|
v-model="deliveryMan.agencyModeFk"
|
||||||
|
:options="agencyModes"
|
||||||
|
option-value="id"
|
||||||
|
option-label="name"
|
||||||
|
emit-value
|
||||||
|
:label="t('route.deliveryMan.basicData.agency')"
|
||||||
|
map-options
|
||||||
|
use-input
|
||||||
|
:input-debounce="0"
|
||||||
|
>
|
||||||
|
</q-select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row q-gutter-md q-mb-md">
|
||||||
|
<div class="col">
|
||||||
|
<q-btn label="Submit" type="submit" color="primary" />
|
||||||
|
<q-btn label="Reset" type="reset" color="primary" flat class="q-ml-sm" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</q-form>
|
</q-form>
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-page>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.card {
|
.q-card {
|
||||||
width: 100%;
|
width: 800px;
|
||||||
max-width: 60em;
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -22,9 +22,13 @@ const filter = {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
function navigate(id) {
|
function navigateCard(id) {
|
||||||
router.push({ path: `/route/${id}` });
|
router.push({ path: `/route/${id}` });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function navigateCreate() {
|
||||||
|
router.push({ path: `/route/deliveryMan/create` });
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -33,7 +37,7 @@ function navigate(id) {
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows }">
|
||||||
<q-card class="card" v-for="row of rows" :key="row.id">
|
<q-card class="card" v-for="row of rows" :key="row.id">
|
||||||
<q-item class="q-pa-none items-start cursor-pointer q-hoverable" v-ripple clickable>
|
<q-item class="q-pa-none items-start cursor-pointer q-hoverable" v-ripple clickable>
|
||||||
<q-item-section class="q-pa-md" @click="navigate(row.id)">
|
<q-item-section class="q-pa-md" @click="navigateCard(row.id)">
|
||||||
<div class="text-h6 link">{{ t('route.deliveryMan.list.deliveryMan') }}</div>
|
<div class="text-h6 link">{{ t('route.deliveryMan.list.deliveryMan') }}</div>
|
||||||
<q-item-label caption>#{{ row.id }}</q-item-label>
|
<q-item-label caption>#{{ row.id }}</q-item-label>
|
||||||
<q-list>
|
<q-list>
|
||||||
|
@ -63,7 +67,7 @@ function navigate(id) {
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-separator vertical />
|
<q-separator vertical />
|
||||||
<q-card-actions vertical>
|
<q-card-actions vertical>
|
||||||
<q-btn flat round color="orange" icon="arrow_circle_right" @click="navigate(row.id)">
|
<q-btn flat round color="orange" icon="arrow_circle_right" @click="navigateCard(row.id)">
|
||||||
<q-tooltip>{{ t('components.smartCard.openCard') }}</q-tooltip>
|
<q-tooltip>{{ t('components.smartCard.openCard') }}</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</q-card-actions>
|
</q-card-actions>
|
||||||
|
@ -71,7 +75,8 @@ function navigate(id) {
|
||||||
</q-card>
|
</q-card>
|
||||||
</template>
|
</template>
|
||||||
</paginate>
|
</paginate>
|
||||||
<q-page-sticky position="bottom-right" :offset="[18, 18]">
|
<q-page-sticky position="bottom-right" :offset="[18, 18]" @click="navigateCreate()"
|
||||||
|
><q-tooltip>{{ t('route.pageTitles.deliveryManCreate') }}</q-tooltip>
|
||||||
<q-fab icon="person_add" direction="up" color="orange"> </q-fab>
|
<q-fab icon="person_add" direction="up" color="orange"> </q-fab>
|
||||||
</q-page-sticky>
|
</q-page-sticky>
|
||||||
</q-page>
|
</q-page>
|
||||||
|
|
|
@ -0,0 +1,126 @@
|
||||||
|
<script setup>
|
||||||
|
import axios from 'axios';
|
||||||
|
import { reactive, ref } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const deliveryMan = reactive({
|
||||||
|
supplierFk: null,
|
||||||
|
agencyModeFk: null,
|
||||||
|
minCost: null,
|
||||||
|
minM3: null,
|
||||||
|
});
|
||||||
|
|
||||||
|
const suppliers = ref([]);
|
||||||
|
const agencyModes = ref([]);
|
||||||
|
|
||||||
|
function setSuppliers(data) {
|
||||||
|
suppliers.value = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setAgencyModes(data) {
|
||||||
|
agencyModes.value = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onSubmit() {
|
||||||
|
try {
|
||||||
|
const newDeliveryMan = await axios.post('DeliveryMans', {
|
||||||
|
supplierFk: deliveryMan.supplierFk,
|
||||||
|
minCost: deliveryMan.minCost,
|
||||||
|
minM3: deliveryMan.minM3,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (deliveryMan.agencyModeFk) {
|
||||||
|
await axios.post(`DeliveryManAgencys/${newDeliveryMan.id}`, {
|
||||||
|
agencyModeFk: deliveryMan.agencyMode,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<fetch-data url="Suppliers" @on-fetch="setSuppliers" auto-load />
|
||||||
|
<fetch-data url="AgencyModes" @on-fetch="setAgencyModes" auto-load />
|
||||||
|
<div class="container">
|
||||||
|
<q-card class="q-pa-md">
|
||||||
|
<q-banner v-if="hasChanges" class="text-white bg-warning">
|
||||||
|
<q-icon name="warning" size="md" class="q-mr-md" />
|
||||||
|
<span>{{ t('globals.changesToSave') }}</span>
|
||||||
|
</q-banner>
|
||||||
|
<q-form @submit="onSubmit" @reset="onReset" class="q-gutter-md">
|
||||||
|
<div class="row q-gutter-md q-mb-md">
|
||||||
|
<div class="col">
|
||||||
|
<q-input
|
||||||
|
filled
|
||||||
|
v-model="deliveryMan.minCost"
|
||||||
|
:label="t('route.deliveryMan.basicData.minCost')"
|
||||||
|
:rules="[(val) => val > 0]"
|
||||||
|
lazy-rules
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<q-input
|
||||||
|
filled
|
||||||
|
v-model="deliveryMan.minM3"
|
||||||
|
:label="t('route.deliveryMan.basicData.minM3')"
|
||||||
|
:rules="[(val) => val > 0]"
|
||||||
|
lazy-rules
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row q-gutter-md q-mb-md">
|
||||||
|
<div class="col">
|
||||||
|
<q-select
|
||||||
|
v-model="deliveryMan.supplierFk"
|
||||||
|
:options="suppliers"
|
||||||
|
option-value="id"
|
||||||
|
option-label="name"
|
||||||
|
emit-value
|
||||||
|
:label="t('route.deliveryMan.basicData.supplier')"
|
||||||
|
map-options
|
||||||
|
use-input
|
||||||
|
:input-debounce="0"
|
||||||
|
>
|
||||||
|
</q-select>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<q-select
|
||||||
|
v-model="deliveryMan.agencyModeFk"
|
||||||
|
:options="agencyModes"
|
||||||
|
option-value="id"
|
||||||
|
option-label="name"
|
||||||
|
emit-value
|
||||||
|
:label="t('route.deliveryMan.basicData.agency')"
|
||||||
|
map-options
|
||||||
|
use-input
|
||||||
|
:input-debounce="0"
|
||||||
|
>
|
||||||
|
</q-select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row q-gutter-md q-mb-md">
|
||||||
|
<div class="col">
|
||||||
|
<q-btn label="Submit" type="submit" color="primary" />
|
||||||
|
<q-btn label="Reset" type="reset" color="primary" flat class="q-ml-sm" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</q-form>
|
||||||
|
</q-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.q-card {
|
||||||
|
width: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -34,6 +34,15 @@ export default {
|
||||||
},
|
},
|
||||||
component: () => import('src/pages/Route/DeliveryManCreate.vue'),
|
component: () => import('src/pages/Route/DeliveryManCreate.vue'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'InvoiceAllocation',
|
||||||
|
path: '/invoiceAllocation',
|
||||||
|
meta: {
|
||||||
|
title: 'invoiceAllocation',
|
||||||
|
icon: 'vn:invoice-in',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Route/InvoiceAllocation.vue'),
|
||||||
|
},
|
||||||
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue