0
0
Fork 0

feat: refs #7323 fix descriptors, added VnTable and minor changes

This commit is contained in:
Jon Elias 2024-07-08 13:15:14 +02:00
parent 90da150d63
commit e70adce488
15 changed files with 132 additions and 90 deletions

View File

@ -115,7 +115,7 @@ const toModule = computed(() =>
:icon="iconModule" :icon="iconModule"
color="white" color="white"
class="link" class="link"
:to="toModule" :to="$attrs['to-module'] ?? toModule"
> >
<QTooltip> <QTooltip>
{{ t('globals.goToModuleIndex') }} {{ t('globals.goToModuleIndex') }}

View File

@ -52,8 +52,8 @@ const containerClasses = computed(() => {
--calendar-border-current: #84d0e2 2px solid; --calendar-border-current: #84d0e2 2px solid;
--calendar-current-color-dark: #84d0e2; --calendar-current-color-dark: #84d0e2;
// Colores de fondo del calendario en dark mode // Colores de fondo del calendario en dark mode
--calendar-outside-background-dark: #222; --calendar-outside-background-dark: var(--vn-section-color);
--calendar-background-dark: #222; --calendar-background-dark: var(--vn-section-color);
} }
// Clases para modificar el color de fecha seleccionada en componente QCalendarMonth // Clases para modificar el color de fecha seleccionada en componente QCalendarMonth
@ -68,10 +68,11 @@ const containerClasses = computed(() => {
.q-calendar-month__head--weekday { .q-calendar-month__head--weekday {
// Transforma los nombres de los días de la semana a mayúsculas // Transforma los nombres de los días de la semana a mayúsculas
text-transform: capitalize; text-transform: capitalize;
color: var(--vn-label-color);
} }
.transparent-background { .transparent-background {
--calendar-background-dark: transparent; // --calendar-background-dark: transparent;
--calendar-background: transparent; --calendar-background: transparent;
--calendar-outside-background-dark: transparent; --calendar-outside-background-dark: transparent;
} }
@ -124,6 +125,7 @@ const containerClasses = computed(() => {
height: 32px; height: 32px;
display: flex; display: flex;
justify-content: center; justify-content: center;
color: var(--vn-label-color);
} }
.q-calendar__button--bordered { .q-calendar__button--bordered {
@ -147,7 +149,7 @@ const containerClasses = computed(() => {
.q-calendar-month__head--workweek, .q-calendar-month__head--workweek,
.q-calendar-month__head--weekday.q-calendar__center.q-calendar__ellipsis { .q-calendar-month__head--weekday.q-calendar__center.q-calendar__ellipsis {
text-transform: capitalize; text-transform: capitalize;
color: $color-font-secondary; color: var(--vn-label-color);
font-weight: bold; font-weight: bold;
font-size: 0.8rem; font-size: 0.8rem;
text-align: center; text-align: center;

View File

@ -24,7 +24,7 @@ const $props = defineProps({
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const DepartmentDescriptorRef = ref();
const { t } = useI18n(); const { t } = useI18n();
const { notify } = useNotify(); const { notify } = useNotify();
@ -55,18 +55,20 @@ const { openConfirmationModal } = useVnConfirm();
</script> </script>
<template> <template>
<CardDescriptor <CardDescriptor
ref="DepartmentDescriptorRef"
module="Department" module="Department"
data-key="departmentData"
:url="`Departments/${entityId}`" :url="`Departments/${entityId}`"
:title="data.title" :title="data.title"
:subtitle="data.subtitle" :subtitle="data.subtitle"
:summary="$props.summary" :summary="$props.summary"
:to-module="{ name: 'WorkerDepartment' }"
@on-fetch=" @on-fetch="
(data) => { (data) => {
department = data; department = data;
setData(data); setData(data);
} }
" "
data-key="department"
> >
<template #menu="{}"> <template #menu="{}">
<QItem <QItem

View File

@ -115,7 +115,6 @@ watch;
:subtitle="data.subtitle" :subtitle="data.subtitle"
@on-fetch="setData" @on-fetch="setData"
data-key="entry" data-key="entry"
:summary="$attrs"
> >
<template #menu="{ entity }"> <template #menu="{ entity }">
<QItem v-ripple clickable @click="showEntryReport(entity)"> <QItem v-ripple clickable @click="showEntryReport(entity)">

View File

@ -84,7 +84,7 @@ const setData = (entity) => (data.value = useCardDescription(entity.ref, entity.
/> />
</template> </template>
<template #actions="{ entity }"> <template #actions="{ entity }">
<QCardActions> <QCardActions class="flex justify-center">
<QBtn <QBtn
v-if="entity.client" v-if="entity.client"
size="md" size="md"

View File

@ -76,7 +76,6 @@ const setData = (entity) => (data.value = useCardDescription(entity.code, entity
:subtitle="data.subtitle" :subtitle="data.subtitle"
data-key="routeData" data-key="routeData"
@on-fetch="setData" @on-fetch="setData"
:summary="$attrs"
> >
<template #body="{ entity }"> <template #body="{ entity }">
<VnLv :label="t('Date')" :value="toDate(entity?.created)" /> <VnLv :label="t('Date')" :value="toDate(entity?.created)" />

View File

@ -51,7 +51,6 @@ const setData = (entity) => (data.value = useCardDescription(entity.code, entity
:subtitle="data.subtitle" :subtitle="data.subtitle"
data-key="Shelvings" data-key="Shelvings"
@on-fetch="setData" @on-fetch="setData"
:summary="$attrs"
> >
<template #body="{ entity }"> <template #body="{ entity }">
<VnLv :label="t('shelving.summary.code')" :value="entity.code" /> <VnLv :label="t('shelving.summary.code')" :value="entity.code" />

View File

@ -65,7 +65,6 @@ const setData = (entity) => (data.value = useCardDescription(entity.ref, entity.
:subtitle="data.subtitle" :subtitle="data.subtitle"
:filter="filter" :filter="filter"
data-key="travelData" data-key="travelData"
:summary="$attrs"
@on-fetch="setData" @on-fetch="setData"
> >
<template #menu="{ entity }"> <template #menu="{ entity }">

View File

@ -111,7 +111,6 @@ const refetch = async () => await cardDescriptorRef.value.getData();
:filter="filter" :filter="filter"
:title="data.title" :title="data.title"
:subtitle="data.subtitle" :subtitle="data.subtitle"
:summary="$attrs"
@on-fetch=" @on-fetch="
(data) => { (data) => {
worker = data; worker = data;
@ -145,7 +144,12 @@ const refetch = async () => await cardDescriptorRef.value.getData();
</QItem> </QItem>
</template> </template>
<template #before> <template #before>
<VnImg :id="entityId" collection="user" size="160x160" class="photo"> <VnImg
:id="parseInt(entityId)"
collection="user"
size="160x160"
class="photo"
>
<template #error> <template #error>
<div <div
class="absolute-full picture text-center q-pa-md flex flex-center" class="absolute-full picture text-center q-pa-md flex flex-center"
@ -182,6 +186,32 @@ const refetch = async () => await cardDescriptorRef.value.getData();
</template> </template>
</VnLv> </VnLv>
</template> </template>
<template #actions="{ entity }">
<QCardActions class="flex justify-center">
<QBtn
:to="{
name: 'CustomerCard',
params: { id: entity.id },
}"
size="md"
icon="vn:Person"
color="primary"
>
<QTooltip>{{ t('Go to client') }}</QTooltip>
</QBtn>
<QBtn
:to="{
name: 'AccountCard',
params: { id: entity.user.id },
}"
size="md"
icon="face"
color="primary"
>
<QTooltip>{{ t('Go to user') }}</QTooltip>
</QBtn>
</QCardActions>
</template>
</CardDescriptor> </CardDescriptor>
</template> </template>

View File

@ -410,7 +410,7 @@ const resendEmail = async () => {
workerId: Number(route.params.id), workerId: Number(route.params.id),
state: 'SENDED', state: 'SENDED',
}; };
await axios.post('WorkerTimeControls/weekly-hour-hecord-email', params); await axios.post('WorkerTimeControls/weekly-hour-record-email', params);
await getMailStates(selectedDate.value); await getMailStates(selectedDate.value);
notify(t('Email sended'), 'positive'); notify(t('Email sended'), 'positive');
} catch (err) { } catch (err) {

View File

@ -5,7 +5,7 @@ import { useRoute } from 'vue-router';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import FormModelPopup from 'components/FormModelPopup.vue'; import FormModelPopup from 'components/FormModelPopup.vue';
import VnInputTime from 'components/common/VnInputTime.vue'; import VnInputTime from 'src/components/common/VnInputTime.vue';
const $props = defineProps({ const $props = defineProps({
entryId: { entryId: {
@ -37,8 +37,9 @@ const entryDirections = [
const closeButton = ref(null); const closeButton = ref(null);
const onDataSaved = () => { const onDataSaved = (dataSaved) => {
emit('onDataSaved'); console.log('formData: ', dataSaved);
emit('onDataSaved', dataSaved);
closeForm(); closeForm();
}; };
@ -73,7 +74,7 @@ onBeforeMount(() => {
:default-actions="false" :default-actions="false"
:title="title" :title="title"
:url-create="urlCreate" :url-create="urlCreate"
@on-data-saved="onDataSaved()" @on-data-saved="onDataSaved"
> >
<template #form-inputs="{ data }"> <template #form-inputs="{ data }">
<VnInputTime <VnInputTime
@ -91,7 +92,6 @@ onBeforeMount(() => {
option-value="code" option-value="code"
option-label="description" option-label="description"
hide-selected hide-selected
:required="true"
/> />
</template> </template>
</FormModelPopup> </FormModelPopup>

View File

@ -1,26 +1,68 @@
<script setup> <script setup>
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n'; 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 { useSummaryDialog } from 'src/composables/useSummaryDialog';
import RightMenu from 'src/components/common/RightMenu.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import VnTable from 'src/components/VnTable/VnTable.vue';
import WorkerSummary from './Card/WorkerSummary.vue';
const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
const tableRef = ref();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
function navigate(id) { const columns = computed(() => [
router.push({ path: `/worker/${id}` }); {
} align: 'left',
name: 'id',
const redirectToCreateView = () => { label: t('tableColumns.id'),
router.push({ name: 'WorkerCreate' }); chip: {
}; condition: () => true,
},
isId: true,
},
{
align: 'left',
name: 'nickname',
label: t('tableColumns.name'),
isTitle: true,
},
{
align: 'left',
name: 'department',
label: t('tableColumns.department'),
cardVisible: true,
component: 'select',
attrs: {
url: 'Departments',
fields: ['id', 'name'],
},
columnField: {
component: null,
},
},
{
align: 'left',
name: 'email',
label: t('tableColumns.email'),
component: 'input',
cardVisible: true,
columnField: {
component: null,
},
},
{
align: 'right',
label: '',
name: 'tableActions',
actions: [
{
title: t('InvoiceOutSummary'),
icon: 'preview',
action: (row) => viewSummary(row.id, WorkerSummary),
},
],
},
]);
</script> </script>
<template> <template>
<VnSearchbar <VnSearchbar
@ -28,59 +70,20 @@ const redirectToCreateView = () => {
:label="t('Search worker')" :label="t('Search worker')"
:info="t('You can search by worker id or name')" :info="t('You can search by worker id or name')"
/> />
<RightMenu> <VnTable
<template #right-panel> ref="tableRef"
<WorkerFilter data-key="WorkerList" /> data-key="worker"
</template>
</RightMenu>
<QPage class="column items-center q-pa-md">
<div class="vn-card-list">
<VnPaginate
data-key="WorkerList"
url="Workers/filter" url="Workers/filter"
order="id DESC" :create="{
urlCreate: 'WorkerCreate',
title: t('Create worker'),
onDataSaved: (id) => tableRef.redirect(id),
}"
:columns="columns"
default-mode="table"
redirect="worker"
auto-load 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> </template>
<i18n> <i18n>

View File

@ -1 +1,6 @@
passwordRequirements: 'The password must have at least { length } length characters, {nAlpha} alphabetic characters, {nUpper} capital letters, {nDigits} digits and {nPunct} symbols (Ex: $%&.)\n' passwordRequirements: 'The password must have at least { length } length characters, {nAlpha} alphabetic characters, {nUpper} capital letters, {nDigits} digits and {nPunct} symbols (Ex: $%&.)\n'
tableColumns:
id: ID
name: Name
department: Department
email: Email

View File

@ -4,3 +4,8 @@ Locker: Taquilla
Internal: Interno Internal: Interno
External: Externo External: Externo
passwordRequirements: 'La contraseña debe tener al menos { length } caracteres de longitud, {nAlpha} caracteres alfabéticos, {nUpper} letras mayúsculas, {nDigits} dígitos y {nPunct} símbolos (Ej: $%&.)' passwordRequirements: 'La contraseña debe tener al menos { length } caracteres de longitud, {nAlpha} caracteres alfabéticos, {nUpper} letras mayúsculas, {nDigits} dígitos y {nPunct} símbolos (Ej: $%&.)'
tableColumns:
id: ID
name: Nombre
department: Departamento
email: Email

View File

@ -52,7 +52,6 @@ const setData = (entity) => {
:filter="filter" :filter="filter"
@on-fetch="setData" @on-fetch="setData"
data-key="zoneData" data-key="zoneData"
:summary="$attrs"
> >
<template #menu="{ entity }"> <template #menu="{ entity }">
<ZoneDescriptorMenuItems :zone="entity" /> <ZoneDescriptorMenuItems :zone="entity" />