91 lines
3.2 KiB
Vue
91 lines
3.2 KiB
Vue
<script setup>
|
|
import { useI18n } from 'vue-i18n';
|
|
import { useRouter } from 'vue-router';
|
|
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
|
import WorkerSummary from './Card/WorkerSummary.vue';
|
|
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
|
import WorkerFilter from './WorkerFilter.vue';
|
|
import VnLv from 'src/components/ui/VnLv.vue';
|
|
import CardList from 'src/components/ui/CardList.vue';
|
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
|
|
|
const router = useRouter();
|
|
const { t } = useI18n();
|
|
const { viewSummary } = useSummaryDialog();
|
|
|
|
function navigate(id) {
|
|
router.push({ path: `/worker/${id}` });
|
|
}
|
|
|
|
const redirectToCreateView = () => {
|
|
router.push({ name: 'WorkerCreate' });
|
|
};
|
|
</script>
|
|
<template>
|
|
<VnSearchbar
|
|
data-key="WorkerList"
|
|
:label="t('Search worker')"
|
|
:info="t('You can search by worker id or name')"
|
|
/>
|
|
<RightMenu>
|
|
<template #right-panel>
|
|
<WorkerFilter data-key="WorkerList" />
|
|
</template>
|
|
</RightMenu>
|
|
<QPage class="column items-center q-pa-md">
|
|
<div class="vn-card-list">
|
|
<VnPaginate
|
|
data-key="WorkerList"
|
|
url="Workers/filter"
|
|
order="id DESC"
|
|
auto-load
|
|
>
|
|
<template #body="{ rows }">
|
|
<CardList
|
|
v-for="row of rows"
|
|
:key="row.id"
|
|
:id="row.id"
|
|
:title="row.nickname"
|
|
@click="navigate(row.id)"
|
|
>
|
|
<template #list-items>
|
|
<VnLv :label="t('worker.list.name')" :value="row.userName" />
|
|
<VnLv :label="t('worker.list.email')" :value="row.email" />
|
|
<VnLv
|
|
:label="t('worker.list.department')"
|
|
:value="row.department"
|
|
/>
|
|
</template>
|
|
<template #actions>
|
|
<QBtn
|
|
:label="t('components.smartCard.openCard')"
|
|
@click.stop="navigate(row.id)"
|
|
outline
|
|
/>
|
|
<QBtn
|
|
:label="t('components.smartCard.openSummary')"
|
|
@click.stop="viewSummary(row.id, WorkerSummary)"
|
|
color="primary"
|
|
style="margin-top: 15px"
|
|
/>
|
|
</template>
|
|
</CardList>
|
|
</template>
|
|
</VnPaginate>
|
|
</div>
|
|
<QPageSticky :offset="[20, 20]">
|
|
<QBtn fab icon="add" color="primary" @click="redirectToCreateView()" />
|
|
<QTooltip>
|
|
{{ t('worker.list.newWorker') }}
|
|
</QTooltip>
|
|
</QPageSticky>
|
|
</QPage>
|
|
</template>
|
|
|
|
<i18n>
|
|
es:
|
|
Search worker: Buscar trabajador
|
|
You can search by worker id or name: Puedes buscar por id o nombre del trabajador
|
|
</i18n>
|