Compare commits

...

2 Commits

11 changed files with 316 additions and 1 deletions

View File

@ -0,0 +1,52 @@
<script setup>
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import FormModel from 'components/FormModel.vue';
import FetchData from 'src/components/FetchData.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const { t } = useI18n();
const route = useRoute();
const routeId = route.params?.id || null;
const warehouses = ref([]);
</script>
<template>
<FetchData
url="warehouses"
sort-by="name"
@on-fetch="(data) => (warehouses = data)"
auto-load
/>
<FormModel :url="`Agencies/${routeId}`" model="agency" auto-load>
<template #form="{ data }">
<VnRow>
<VnInput v-model="data.name" :label="t('globals.name')" />
</VnRow>
<VnRow>
<VnSelect
v-model="data.warehouseFk"
option-value="id"
option-label="name"
:label="t('globals.warehouse')"
:options="warehouses"
use-input
input-debounce="0"
:is-clearable="false"
/>
</VnRow>
<VnRow>
<QCheckbox :label="t('agency.isOwn')" v-model="data.isOwn" />
</VnRow>
<VnRow>
<QCheckbox
:label="t('agency.isAnyVolumeAllowed')"
v-model="data.isAnyVolumeAllowed"
/>
</VnRow>
</template>
</FormModel>
</template>

View File

@ -0,0 +1,29 @@
<script setup>
import VehicleDescriptor from 'pages/Route/Vehicle/Card/VehicleDescriptor.vue';
import VnCard from 'components/common/VnCard.vue';
const exprBuilder = (param, value) => {
if (param !== 'search') return;
return {
or: [
{ numberPlate: { like: `%${value}%` } },
{ tradeMark: { like: `%${value}%` } },
{ model: { like: `%${value}%` } },
],
};
};
</script>
<template>
<VnCard
data-key="Vehicle"
base-url="Vehicles"
:descriptor="VehicleDescriptor"
search-data-key="VehicleList"
:searchbar-props="{
url: 'Vehicles',
label: 'vehicle.searchBar.label',
info: 'vehicle.searchBar.info',
exprBuilder,
}"
/>
</template>

View File

@ -0,0 +1,35 @@
<script setup>
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { useArrayData } from 'src/composables/useArrayData';
import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'components/ui/VnLv.vue';
const props = defineProps({
id: {
type: Number,
required: false,
default: null,
},
});
const { t } = useI18n();
const route = useRoute();
const entityId = computed(() => props.id || route.params.id);
const { store } = useArrayData('Parking');
const card = computed(() => store.data);
</script>
<template>
<CardDescriptor
module="Agency"
data-key="Agency"
:url="`Agencies/${entityId}`"
:title="card?.name"
:subtitle="props.id"
>
<template #body="{ entity: agency }">
<VnLv :label="t('globals.name')" :value="agency.name" />
</template>
</CardDescriptor>
</template>

View File

@ -0,0 +1,40 @@
<script setup>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'components/ui/VnLv.vue';
import VnTitle from 'src/components/common/VnTitle.vue';
const $props = defineProps({ id: { type: Number, default: 0 } });
const { t } = useI18n();
const entityId = computed(() => $props.id || useRoute().params.id);
</script>
<template>
<div class="q-pa-md">
<CardSummary :url="`Agencies/${entityId}`" data-key="Agency">
<template #header="{ entity: agency }">{{ agency.name }}</template>
<template #body="{ entity: agency }">
<QCard class="vn-one">
<VnTitle
:url="`#/agency/${entityId}/basic-data`"
:text="t('globals.pageTitles.basicData')"
/>
<VnLv :label="t('globals.name')" :value="agency.name" />
<QCheckbox
:label="t('agency.isOwn')"
v-model="agency.isOwn"
:disable="true"
/>
<QCheckbox
:label="t('agency.isAnyVolumeAllowed')"
v-model="agency.isAnyVolumeAllowed"
:disable="true"
/>
</QCard>
</template>
</CardSummary>
</div>
</template>

View File

@ -0,0 +1,84 @@
<script setup>
import { computed } from 'vue';
import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import VnTable from 'components/VnTable/VnTable.vue';
const { t } = useI18n();
const exprBuilder = (param, value) => {
if (param !== 'search') return;
return {
or: [
{ numberPlate: { like: `%${value}%` } },
{ tradeMark: { like: `%${value}%` } },
{ model: { like: `%${value}%` } },
],
};
};
const columns = computed(() => [
{
align: 'left',
name: 'numberPlate',
label: t('vehicle.numberPlate'),
isTitle: true,
},
{
align: 'left',
name: 'isActive',
label: t('vehicle.isActive'),
},
{
align: 'left',
name: 'tradeMark',
label: t('vehicle.tradeMark'),
cardVisible: true,
},
{
align: 'left',
name: 'model',
label: t('vehicle.model'),
cardVisible: true,
},
{
align: 'left',
name: 'chassis',
label: t('vehicle.chassis'),
cardVisible: true,
},
{
align: 'left',
name: 'deliveryPointFk',
label: t('vehicle.deliveryPoint'),
cardVisible: true,
format: (row) => row?.deliveryPoint?.name,
},
]);
</script>
<template>
<VnSearchbar
:info="t('You can search by numberPlate')"
:label="t('Search vehicle')"
data-key="VehicleList"
:expr-builder="exprBuilder"
/>
<VnTable
data-key="VehicleList"
url="Vehicles"
:user-filter="{ include: 'deliveryPoint' }"
:order="['tradeMark', 'model', 'numberPlate']"
:columns="columns"
:right-search="false"
:use-model="true"
redirect="vehicle"
default-mode="card"
auto-load
/>
</template>
<i18n>
es:
Search vehicle: Buscar vehículo
You can search by numberPlate: Puedes buscar por matricula
</i18n>

View File

@ -0,0 +1,7 @@
vehicle:
numberPlate: Number plate
isActive: Is active
tradeMark: Trade mark
model: Model
chassis: Chassis
deliveryPoint: Delivery point

View File

@ -0,0 +1,7 @@
vehicle:
numberPlate: Matrícula
isActive: Activo
tradeMark: Marca
model: Modelo
chassis: Número de bastidor
deliveryPoint: Punto de reparto

View File

@ -21,6 +21,7 @@ import Zone from './zone';
import Account from './account'; import Account from './account';
import Monitor from './monitor'; import Monitor from './monitor';
import MailAlias from './mailAlias'; import MailAlias from './mailAlias';
import Vehicle from './vehicle';
import Role from './role'; import Role from './role';
export default [ export default [
@ -46,6 +47,7 @@ export default [
Zone, Zone,
Account, Account,
MailAlias, MailAlias,
Vehicle,
Monitor, Monitor,
Role, Role,
]; ];

View File

@ -18,6 +18,7 @@ export default {
'RouteRoadmap', 'RouteRoadmap',
'CmrList', 'CmrList',
'AgencyList', 'AgencyList',
'VehicleList',
], ],
card: ['RouteBasicData', 'RouteTickets', 'RouteLog'], card: ['RouteBasicData', 'RouteTickets', 'RouteLog'],
}, },
@ -83,7 +84,7 @@ export default {
component: () => import('src/pages/Route/Cmr/CmrList.vue'), component: () => import('src/pages/Route/Cmr/CmrList.vue'),
}, },
{ {
path: '/agency', path: 'agency',
redirect: { name: 'AgencyList' }, redirect: { name: 'AgencyList' },
children: [ children: [
{ {
@ -98,6 +99,15 @@ export default {
}, },
], ],
}, },
{
path: 'vehicle',
name: 'VehicleList',
meta: {
title: 'vehicleList',
icon: 'directions_car',
},
component: () => import('src/pages/Route/Vehicle/VehicleList.vue'),
},
], ],
}, },
{ {

View File

@ -0,0 +1,47 @@
import { RouterView } from 'vue-router';
export default {
path: '/vehicle',
name: 'Vehicle',
meta: {
title: 'vehicle',
icon: 'directions_car',
moduleName: 'Vehicle',
},
component: RouterView,
redirect: { name: 'VehicleCard' },
menus: {
main: [],
card: ['VehicleBasicData'],
},
children: [
{
path: '/vehicle/:id',
name: 'VehicleCard',
component: () => import('src/pages/Route/Vehicle/Card/VehicleCard.vue'),
redirect: { name: 'VehicleSummary' },
children: [
{
name: 'VehicleSummary',
path: 'summary',
meta: {
title: 'summary',
icon: 'view_list',
},
component: () =>
import('src/pages/Route/Vehicle/Card/VehicleSummary.vue'),
},
{
name: 'VehicleBasicData',
path: 'basic-data',
meta: {
title: 'basicData',
icon: 'vn:settings',
},
component: () =>
import('pages/Route/Vehicle/Card/VehicleBasicData.vue'),
},
],
},
],
};

View File

@ -22,6 +22,7 @@ import zone from 'src/router/modules/zone';
import account from './modules/account'; import account from './modules/account';
import monitor from 'src/router/modules/monitor'; import monitor from 'src/router/modules/monitor';
import mailAlias from './modules/mailAlias'; import mailAlias from './modules/mailAlias';
import vehicle from './modules/vehicle';
const routes = [ const routes = [
{ {
@ -97,6 +98,7 @@ const routes = [
account, account,
role, role,
mailAlias, mailAlias,
vehicle,
{ {
path: '/:catchAll(.*)*', path: '/:catchAll(.*)*',
name: 'NotFound', name: 'NotFound',