73 lines
2.2 KiB
Vue
73 lines
2.2 KiB
Vue
<script setup>
|
|
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
|
import CardList from 'src/components/ui/CardList.vue';
|
|
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
|
import { useRouter } from 'vue-router';
|
|
import { useI18n } from 'vue-i18n';
|
|
|
|
const { t } = useI18n();
|
|
const router = useRouter();
|
|
function navigate(id) {
|
|
router.push({ path: `/agency/${id}` });
|
|
}
|
|
function exprBuilder(param, value) {
|
|
if (!value) return;
|
|
if (param !== 'search') return;
|
|
|
|
if (!isNaN(value)) return { id: value };
|
|
|
|
return { name: { like: `%${value}%` } };
|
|
}
|
|
</script>
|
|
<template>
|
|
<VnSearchbar
|
|
:info="t('You can search by name')"
|
|
:label="t('Search agency')"
|
|
data-key="AgencyList"
|
|
url="Agencies"
|
|
/>
|
|
<QPage class="column items-center q-pa-md">
|
|
<div class="vn-card-list">
|
|
<VnPaginate
|
|
data-key="AgencyList"
|
|
url="Agencies"
|
|
order="name"
|
|
:expr-builder="exprBuilder"
|
|
>
|
|
<template #body="{ rows }">
|
|
<CardList
|
|
:id="row.id"
|
|
:key="row.id"
|
|
:title="row.name"
|
|
@click="navigate(row.id)"
|
|
v-for="row of rows"
|
|
>
|
|
<template #list-items>
|
|
<QCheckbox
|
|
:label="t('isOwn')"
|
|
v-model="row.isOwn"
|
|
:disable="true"
|
|
/>
|
|
<QCheckbox
|
|
:label="t('isAnyVolumeAllowed')"
|
|
v-model="row.isAnyVolumeAllowed"
|
|
:disable="true"
|
|
/>
|
|
</template>
|
|
</CardList>
|
|
</template>
|
|
</VnPaginate>
|
|
</div>
|
|
</QPage>
|
|
</template>
|
|
<i18n>
|
|
es:
|
|
isOwn: Tiene propietario
|
|
isAnyVolumeAllowed: Permite cualquier volumen
|
|
Search agency: Buscar agencia
|
|
You can search by name: Puedes buscar por nombre
|
|
en:
|
|
isOwn: Has owner
|
|
isAnyVolumeAllowed: Allows any volume
|
|
</i18n>
|