156 lines
6.1 KiB
Vue
156 lines
6.1 KiB
Vue
<script setup>
|
|
import { useI18n } from 'vue-i18n';
|
|
import { useRouter } from 'vue-router';
|
|
import { useQuasar } from 'quasar';
|
|
import { useStateStore } from 'stores/useStateStore';
|
|
import Paginate from 'src/components/PaginateData.vue';
|
|
import WorkerSummaryDialog from './Card/WorkerSummaryDialog.vue';
|
|
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
|
import WorkerFilter from './WorkerFilter.vue';
|
|
|
|
const stateStore = useStateStore();
|
|
const router = useRouter();
|
|
const { t } = useI18n();
|
|
const quasar = useQuasar();
|
|
|
|
function navigate(id) {
|
|
router.push({ path: `/worker/${id}` });
|
|
}
|
|
|
|
function viewSummary(id) {
|
|
quasar.dialog({
|
|
component: WorkerSummaryDialog,
|
|
componentProps: {
|
|
id,
|
|
},
|
|
});
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<template v-if="stateStore.isHeaderMounted()">
|
|
<Teleport to="#searchbar">
|
|
<VnSearchbar
|
|
data-key="WorkerList"
|
|
:label="t('Search worker')"
|
|
:info="t('You can search by worker id or name')"
|
|
/>
|
|
</Teleport>
|
|
<Teleport to="#actions-append">
|
|
<div class="row q-gutter-x-sm">
|
|
<q-btn
|
|
flat
|
|
@click="stateStore.toggleRightDrawer()"
|
|
round
|
|
dense
|
|
icon="menu"
|
|
>
|
|
<q-tooltip bottom anchor="bottom right">
|
|
{{ t('globals.collapseMenu') }}
|
|
</q-tooltip>
|
|
</q-btn>
|
|
</div>
|
|
</Teleport>
|
|
</template>
|
|
<q-drawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
|
<q-scroll-area class="fit text-grey-8">
|
|
<WorkerFilter data-key="WorkerList" />
|
|
</q-scroll-area>
|
|
</q-drawer>
|
|
<q-page class="column items-center q-pa-md">
|
|
<div class="card-list">
|
|
<paginate
|
|
data-key="WorkerList"
|
|
url="Workers/filter"
|
|
order="id DESC"
|
|
auto-load
|
|
>
|
|
<template #body="{ rows }">
|
|
<q-card class="card q-mb-md" 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-section class="q-pa-md" @click="navigate(row.id)">
|
|
<q-item-label class="text-h6">
|
|
{{ row.nickname }}
|
|
</q-item-label>
|
|
<q-item-label caption>#{{ row.id }}</q-item-label>
|
|
<q-list>
|
|
<q-item class="q-pa-none">
|
|
<q-item-section>
|
|
<q-item-label caption>
|
|
{{ t('worker.list.name') }}
|
|
</q-item-label>
|
|
<q-item-label>{{
|
|
row.userName
|
|
}}</q-item-label>
|
|
</q-item-section>
|
|
</q-item>
|
|
<q-item class="q-pa-none">
|
|
<q-item-section>
|
|
<q-item-label caption>
|
|
{{ t('worker.list.email') }}
|
|
</q-item-label>
|
|
<q-item-label>{{ row.email }}</q-item-label>
|
|
</q-item-section>
|
|
</q-item>
|
|
<q-item class="q-pa-none">
|
|
<q-item-section>
|
|
<q-item-label caption>{{
|
|
t('worker.list.department')
|
|
}}</q-item-label>
|
|
<q-item-label>
|
|
{{ row.department }}
|
|
</q-item-label>
|
|
</q-item-section>
|
|
</q-item>
|
|
</q-list>
|
|
</q-item-section>
|
|
<q-separator vertical />
|
|
<q-card-actions vertical class="justify-between">
|
|
<q-btn
|
|
flat
|
|
round
|
|
color="primary"
|
|
icon="arrow_circle_right"
|
|
@click="navigate(row.id)"
|
|
>
|
|
<q-tooltip>
|
|
{{ t('components.smartCard.openCard') }}
|
|
</q-tooltip>
|
|
</q-btn>
|
|
<q-btn
|
|
flat
|
|
round
|
|
color="grey-7"
|
|
icon="preview"
|
|
@click="viewSummary(row.id)"
|
|
>
|
|
<q-tooltip>
|
|
{{ t('components.smartCard.openSummary') }}
|
|
</q-tooltip>
|
|
</q-btn>
|
|
</q-card-actions>
|
|
</q-item>
|
|
</q-card>
|
|
</template>
|
|
</paginate>
|
|
</div>
|
|
</q-page>
|
|
</template>
|
|
|
|
<style lang="scss" scoped>
|
|
.card-list {
|
|
width: 100%;
|
|
max-width: 60em;
|
|
}
|
|
</style>
|
|
|
|
<i18n>
|
|
es:
|
|
Search worker: Buscar trabajador
|
|
You can search by worker id or name: Puedes buscar por id o nombre del trabajador
|
|
</i18n>
|