Merge branch 'dev' into 6321_negative_tickets

This commit is contained in:
Javier Segarra 2024-07-20 00:22:37 +02:00
commit 7c8ddf9c2b
30 changed files with 445 additions and 170 deletions

View File

@ -48,6 +48,17 @@ const forceAttrs = {
label: $props.showTitle ? '' : $props.column.label, label: $props.showTitle ? '' : $props.column.label,
}; };
const selectComponent = {
component: markRaw(VnSelect),
event: updateEvent,
attrs: {
class: 'q-px-sm q-pb-xs q-pt-none fit',
dense: true,
filled: !$props.showTitle,
},
forceAttrs,
};
const components = { const components = {
input: { input: {
component: markRaw(VnInput), component: markRaw(VnInput),
@ -97,16 +108,8 @@ const components = {
}, },
forceAttrs, forceAttrs,
}, },
select: { select: selectComponent,
component: markRaw(VnSelect), rawSelect: selectComponent,
event: updateEvent,
attrs: {
class: 'q-px-sm q-pb-xs q-pt-none fit',
dense: true,
filled: !$props.showTitle,
},
forceAttrs,
},
}; };
async function addFilter(value) { async function addFilter(value) {

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, computed, watch } from 'vue'; import { ref, onBeforeMount, onMounted, computed, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
@ -96,6 +96,7 @@ const DEFAULT_MODE = 'card';
const TABLE_MODE = 'table'; const TABLE_MODE = 'table';
const mode = ref(DEFAULT_MODE); const mode = ref(DEFAULT_MODE);
const selected = ref([]); const selected = ref([]);
const hasParams = ref(false);
const routeQuery = JSON.parse(route?.query[$props.searchUrl] ?? '{}'); const routeQuery = JSON.parse(route?.query[$props.searchUrl] ?? '{}');
const params = ref({ ...routeQuery, ...routeQuery.filter?.where }); const params = ref({ ...routeQuery, ...routeQuery.filter?.where });
const orders = ref(parseOrder(routeQuery.filter?.order)); const orders = ref(parseOrder(routeQuery.filter?.order));
@ -117,11 +118,14 @@ const tableModes = [
disable: $props.disableOption?.card, disable: $props.disableOption?.card,
}, },
]; ];
onBeforeMount(() => {
setUserParams(route.query[$props.searchUrl]);
hasParams.value = Object.keys(params.value).length !== 0;
});
onMounted(() => { onMounted(() => {
mode.value = quasar.platform.is.mobile ? DEFAULT_MODE : $props.defaultMode; mode.value = quasar.platform.is.mobile ? DEFAULT_MODE : $props.defaultMode;
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
setUserParams(route.query[$props.searchUrl]);
columnsVisibilitySkiped.value = [ columnsVisibilitySkiped.value = [
...splittedColumns.value.columns ...splittedColumns.value.columns
.filter((c) => c.visible == false) .filter((c) => c.visible == false)
@ -281,6 +285,11 @@ defineExpose({
:params="params" :params="params"
:columns="splittedColumns.columns" :columns="splittedColumns.columns"
/> />
<slot
name="moreFilterPanel"
:params="params"
:columns="splittedColumns.columns"
/>
</template> </template>
</VnFilterPanel> </VnFilterPanel>
</QScrollArea> </QScrollArea>
@ -295,6 +304,7 @@ defineExpose({
:disable-infinite-scroll="isTableMode" :disable-infinite-scroll="isTableMode"
@save-changes="reload" @save-changes="reload"
:has-sub-toolbar="$attrs['hasSubToolbar'] ?? isEditable" :has-sub-toolbar="$attrs['hasSubToolbar'] ?? isEditable"
:auto-load="hasParams || $attrs['auto-load']"
> >
<template <template
v-for="(_, slotName) in $slots" v-for="(_, slotName) in $slots"

View File

@ -50,7 +50,7 @@ const formattedTime = computed({
} }
if (!props.timeOnly) { if (!props.timeOnly) {
const [hh, mm] = time.split(':'); const [hh, mm] = time.split(':');
const date = new Date(model.value ? model.value : null); const date = model.value ?? Date.vnNew();
date.setHours(hh, mm, 0); date.setHours(hh, mm, 0);
time = date?.toISOString(); time = date?.toISOString();
} }
@ -62,7 +62,7 @@ const formattedTime = computed({
function dateToTime(newDate) { function dateToTime(newDate) {
return date.formatDate(new Date(newDate), dateFormat); return date.formatDate(new Date(newDate), dateFormat);
} }
const timeField = ref();
watch( watch(
() => model.value, () => model.value,
(val) => (formattedTime.value = val), (val) => (formattedTime.value = val),

View File

@ -129,7 +129,8 @@ function filter(val, options) {
}); });
} }
const id = row.id; if (!row) return;
const id = row[$props.optionValue];
const optionLabel = String(row[$props.optionLabel]).toLowerCase(); const optionLabel = String(row[$props.optionLabel]).toLowerCase();
return id == search || optionLabel.includes(search); return id == search || optionLabel.includes(search);

View File

@ -8,24 +8,25 @@ const $props = defineProps({
default: null, default: null,
}, },
find: { find: {
type: [String, Array], type: [String, Object],
default: null, default: null,
description: 'search in row to add default options', description: 'search in row to add default options',
}, },
}); });
const options = ref([]); const options = ref([]);
onBeforeMount(async () => { onBeforeMount(async () => {
const { url, optionValue, optionLabel } = useAttrs(); const { url, optionValue, optionLabel } = useAttrs();
const findBy = $props.find ?? url?.charAt(0)?.toLocaleLowerCase() + url?.slice(1, -1); const findBy = $props.find ?? url?.charAt(0)?.toLocaleLowerCase() + url?.slice(1, -1);
if (!findBy || !$props.row) return; if (!findBy || !$props.row) return;
// is array // is object
if (Array.isArray(findBy)) { if (typeof findBy == 'object') {
const [id, name] = findBy; const { value, label } = findBy;
if (!$props.row[id] || !$props.row[name]) return; if (!$props.row[value] || !$props.row[label]) return;
return (options.value = [ return (options.value = [
{ {
[optionValue ?? 'id']: $props.row[id], [optionValue ?? 'id']: $props.row[value],
[optionLabel ?? 'name']: $props.row[name], [optionLabel ?? 'name']: $props.row[label],
}, },
]); ]);
} }
@ -33,7 +34,6 @@ onBeforeMount(async () => {
if ($props.row[findBy]) options.value = [$props.row[findBy]]; if ($props.row[findBy]) options.value = [$props.row[findBy]];
}); });
</script> </script>
<template> <template>
<VnSelect v-bind="$attrs" :options="$attrs.options ?? options" /> <VnSelect v-bind="$attrs" :options="$attrs.options ?? options" />
</template> </template>

View File

@ -120,7 +120,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
@ -70,8 +70,27 @@ const containerClasses = computed(() => {
text-transform: capitalize; text-transform: capitalize;
} }
.q-calendar-month__head--workweek,
.q-calendar-month__head--weekday,
// .q-calendar-month__workweek.q-past-day,
.q-calendar-month__week :nth-child(6),
:nth-child(7) {
color: var(--vn-label-color);
}
.q-calendar-month__head--weekdays > div[aria-label='miércoles'] > span {
/* color: transparent; */
visibility: hidden;
// position: absolute;
}
.q-calendar-month__head--weekdays > div[aria-label='miércoles'] > span:after {
content: 'X';
visibility: visible;
left: 33%;
position: absolute;
}
.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;
} }
@ -110,11 +129,6 @@ const containerClasses = computed(() => {
cursor: pointer; cursor: pointer;
} }
} }
.q-calendar-month__week--days > div:nth-child(6),
.q-calendar-month__week--days > div:nth-child(7) {
// Cambia el color de los días sábado y domingo
color: #777777;
}
.q-calendar-month__week--wrapper { .q-calendar-month__week--wrapper {
margin-bottom: 4px; margin-bottom: 4px;
@ -124,6 +138,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 +162,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

@ -110,9 +110,11 @@ async function search(evt) {
store.filter.where = {}; store.filter.where = {};
isLoading.value = true; isLoading.value = true;
const filter = { ...userParams.value }; const filter = { ...userParams.value, ...$props.modelValue };
store.userParamsChanged = true; store.userParamsChanged = true;
const { params: newParams } = await arrayData.addFilter({ params: userParams.value }); const { params: newParams } = await arrayData.addFilter({
params: filter,
});
userParams.value = newParams; userParams.value = newParams;
if (!$props.showAll && !Object.values(filter).length) store.data = []; if (!$props.showAll && !Object.values(filter).length) store.data = [];

View File

@ -251,6 +251,7 @@ globals:
mailForwarding: Mail forwarding mailForwarding: Mail forwarding
mailAlias: Mail alias mailAlias: Mail alias
privileges: Privileges privileges: Privileges
labeler: Labeler
created: Created created: Created
worker: Worker worker: Worker
now: Now now: Now

View File

@ -254,6 +254,7 @@ globals:
components: Componentes components: Componentes
pictures: Fotos pictures: Fotos
packages: Bultos packages: Bultos
labeler: Etiquetas
created: Fecha creación created: Fecha creación
worker: Trabajador worker: Trabajador
now: Ahora now: Ahora

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

@ -98,7 +98,6 @@ const printBuys = (rowId) => {
ref="myEntriesRef" ref="myEntriesRef"
data-key="myEntriesList" data-key="myEntriesList"
url="Entries/filter" url="Entries/filter"
:order="['landed DESC', 'id DESC']"
:columns="columns" :columns="columns"
default-mode="card" default-mode="card"
auto-load auto-load

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

@ -72,10 +72,7 @@ const columns = computed(() => [
label: t('globals.warehouse'), label: t('globals.warehouse'),
component: 'select', component: 'select',
attrs: { attrs: {
url: 'warehouses', options: warehouses.value,
fields: ['id', 'name'],
optionLabel: 'name',
optionValue: 'id',
}, },
}, },
{ {

View File

@ -57,9 +57,13 @@ const columns = computed(() => [
component: 'select', component: 'select',
attrs: { attrs: {
url: 'Workers/activeWithInheritedRole', url: 'Workers/activeWithInheritedRole',
fields: ['id', 'nickname'], fields: ['id', 'name'],
optionValue: 'id', useLike: false,
optionLabel: 'nickname', optionFilter: 'firstName',
find: {
value: 'workerFk',
label: 'workerUserName',
},
}, },
useLike: false, useLike: false,
cardVisible: true, cardVisible: true,
@ -76,8 +80,10 @@ const columns = computed(() => [
attrs: { attrs: {
url: 'agencyModes', url: 'agencyModes',
fields: ['id', 'name'], fields: ['id', 'name'],
optionLabel: 'name', find: {
optionValue: 'id', value: 'agencyModeFk',
label: 'agencyName',
},
}, },
}, },
{ {
@ -91,7 +97,10 @@ const columns = computed(() => [
url: 'vehicles', url: 'vehicles',
fields: ['id', 'numberPlate'], fields: ['id', 'numberPlate'],
optionLabel: 'numberPlate', optionLabel: 'numberPlate',
optionValue: 'id', find: {
value: 'vehicleFk',
label: 'vehiclePlateNumber',
},
}, },
}, },
{ {
@ -248,6 +257,7 @@ const openTicketsDialog = (id) => {
:is-editable="true" :is-editable="true"
:filter="routeFilter" :filter="routeFilter"
redirect="route" redirect="route"
:row-click="false"
:create="{ :create="{
urlCreate: 'Routes', urlCreate: 'Routes',
title: t('Create route'), title: t('Create route'),

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

@ -5,7 +5,7 @@ import WorkerFilter from '../WorkerFilter.vue';
</script> </script>
<template> <template>
<VnCard <VnCard
data-key="Worker" data-key="Workers"
base-url="Workers" base-url="Workers"
:descriptor="WorkerDescriptor" :descriptor="WorkerDescriptor"
:filter-panel="WorkerFilter" :filter-panel="WorkerFilter"

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

@ -4,7 +4,6 @@ import { useI18n } from 'vue-i18n';
import { QCalendarMonth } from '@quasar/quasar-ui-qcalendar/src/index.js'; import { QCalendarMonth } from '@quasar/quasar-ui-qcalendar/src/index.js';
import QCalendarMonthWrapper from 'src/components/ui/QCalendarMonthWrapper.vue'; import QCalendarMonthWrapper from 'src/components/ui/QCalendarMonthWrapper.vue';
const $props = defineProps({ const $props = defineProps({
modelValue: { modelValue: {
type: String, type: String,
@ -139,7 +138,9 @@ const paintWorkWeeks = async () => {
show-work-weeks show-work-weeks
:weekdays="[1, 2, 3, 4, 5, 6, 0]" :weekdays="[1, 2, 3, 4, 5, 6, 0]"
:selected-dates="selectedDates" :selected-dates="selectedDates"
:min-weekday-label="1"
:locale="locale" :locale="locale"
animated
mini-mode mini-mode
enable-outside-days enable-outside-days
class="q-py-sm" class="q-py-sm"

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,8 @@ const entryDirections = [
const closeButton = ref(null); const closeButton = ref(null);
const onDataSaved = () => { const onDataSaved = (dataSaved) => {
emit('onDataSaved'); emit('onDataSaved', dataSaved);
closeForm(); closeForm();
}; };
@ -73,7 +73,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 +91,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,86 +1,297 @@
<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';
import VnRow from 'src/components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnRadio from 'src/components/common/VnRadio.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnLocation from 'src/components/common/VnLocation.vue';
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
import FetchData from 'src/components/FetchData.vue';
const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
const tableRef = ref();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
const companiesOptions = ref([]);
const workersOptions = ref([]);
const payMethodsOptions = ref([]);
const bankEntitiesOptions = ref([]);
const postcodesOptions = ref([]);
function navigate(id) { const columns = computed(() => [
router.push({ path: `/worker/${id}` }); {
align: 'left',
name: 'id',
label: t('tableColumns.id'),
columnFilter: {
alias: 'w',
inWhere: true,
},
chip: {
condition: () => true,
},
isId: true,
},
{
align: 'left',
name: 'nickname',
label: t('tableColumns.name'),
isTitle: true,
columnFilter: {
name: 'search',
},
},
{
align: 'left',
name: 'departmentFk',
label: t('tableColumns.department'),
cardVisible: true,
columnFilter: {
component: 'select',
inWhere: true,
alias: 'wd',
attrs: {
url: 'Departments',
},
},
format: (row, dashIfEmpty) => dashIfEmpty(row.department),
},
{
align: 'left',
name: 'email',
label: t('tableColumns.email'),
cardVisible: true,
columnFilter: {
alias: 'mu',
inWhere: true,
},
hidden: true,
},
{
align: 'right',
label: '',
name: 'tableActions',
actions: [
{
title: t('InvoiceOutSummary'),
icon: 'preview',
action: (row) => viewSummary(row.id, WorkerSummary),
},
],
},
]);
function handleLocation(data, location) {
const { town, code, provinceFk, countryFk } = location ?? {};
data.postcode = code;
data.city = town;
data.provinceFk = provinceFk;
data.countryFk = countryFk;
} }
const redirectToCreateView = () => { function uppercaseStreetModel(data) {
router.push({ name: 'WorkerCreate' }); return {
get: () => (data.street ? data.street.toUpperCase() : ''),
set: (value) => {
data.street = value.toUpperCase();
},
}; };
}
</script> </script>
<template> <template>
<VnSearchbar <VnSearchbar
data-key="WorkerList" data-key="Worker"
: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> <FetchData
<template #right-panel> url="Companies"
<WorkerFilter data-key="WorkerList" /> @on-fetch="(data) => (companiesOptions = data)"
</template> auto-load
</RightMenu> />
<QPage class="column items-center q-pa-md"> <FetchData
<div class="vn-card-list"> url="Workers/search"
<VnPaginate @on-fetch="(data) => (workersOptions = data)"
data-key="WorkerList" auto-load
/>
<FetchData
url="Paymethods"
@on-fetch="(data) => (payMethodsOptions = data)"
auto-load
/>
<FetchData
url="BankEntities"
@on-fetch="(data) => (bankEntitiesOptions = data)"
auto-load
/>
<VnTable
ref="tableRef"
data-key="Worker"
url="Workers/filter" url="Workers/filter"
order="id DESC" :create="{
urlCreate: 'Workers/new',
title: t('Create worker'),
onDataSaved: ({ id }) => tableRef.redirect(id),
formInitialData: {
isFreelance: false,
},
}"
:columns="columns"
default-mode="table"
redirect="worker"
auto-load auto-load
> >
<template #body="{ rows }"> <template #more-create-dialog="{ data }">
<CardList <div class="q-pa-lg full-width" style="max-width: 1200px">
v-for="row of rows" <VnRadio
:key="row.id" v-model="data.isFreelance"
:id="row.id" :val="false"
:title="row.nickname" :label="`${t('Internal')}`"
@click="navigate(row.id)" @update:model-value="data.payMethodFk = defaultPayMethod"
/>
<VnRadio
v-model="data.isFreelance"
:val="true"
:label="`${t('External')}`"
@update:model-value="delete data.payMethodFk"
/>
<VnRow>
<VnInput v-model="data.firstName" :label="t('worker.create.name')" />
<VnInput
v-model="data.lastNames"
:label="t('worker.create.lastName')"
/>
<VnInput v-model="data.code" :label="t('worker.create.code')" />
</VnRow>
<VnRow>
<VnInput v-model="data.name" :label="t('worker.create.webUser')" />
<VnInput
v-model="data.email"
:label="t('worker.create.personalEmail')"
/>
</VnRow>
<VnRow>
<VnSelect
:label="t('worker.create.company')"
v-model="data.companyFk"
:options="companiesOptions"
option-value="id"
option-label="code"
hide-selected
/>
<VnSelect
:label="t('worker.create.boss')"
v-model="data.bossFk"
:options="workersOptions"
option-value="id"
option-label="name"
hide-selected
> >
<template #list-items> <template #option="scope">
<VnLv :label="t('worker.list.name')" :value="row.userName" /> <QItem v-bind="scope.itemProps">
<VnLv :label="t('worker.list.email')" :value="row.email" /> <QItemSection>
<VnLv <QItemLabel>{{ scope.opt.name }}</QItemLabel>
:label="t('worker.list.department')" <QItemLabel caption
:value="row.department" >{{ scope.opt.nickname }},
{{ scope.opt.code }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</VnRow>
<VnRow>
<VnInput v-model="data.fi" :label="t('worker.create.fi')" />
<VnInputDate
v-model="data.birth"
:label="t('worker.create.birth')"
:disable="data.isFreelance"
/>
<VnInput
v-model="data.phone"
:label="t('worker.create.phone')"
:disable="data.isFreelance"
/>
</VnRow>
<VnRow>
<VnLocation
:roles-allowed-to-create="['deliveryAssistant']"
:options="postcodesOptions"
v-model="data.location"
@update:model-value="(location) => handleLocation(data, location)"
:disable="data.isFreelance"
>
</VnLocation>
</VnRow>
<VnRow>
<VnInput
:label="t('worker.create.street')"
:model-value="uppercaseStreetModel(data).get()"
@update:model-value="uppercaseStreetModel(data).set"
:disable="data.isFreelance"
/>
</VnRow>
<VnRow>
<VnSelect
:label="t('worker.create.payMethods')"
v-model="data.payMethodFk"
:options="payMethodsOptions"
option-value="id"
option-label="name"
map-options
hide-selected
:disable="data.isFreelance"
@update:model-value="(val) => !val && delete data.payMethodFk"
/>
<VnInput
v-model="data.iban"
:label="t('worker.create.iban')"
:disable="data.isFreelance"
>
<template #append>
<QIcon name="info" class="cursor-info">
<QTooltip>{{ t('components.iban_tooltip') }}</QTooltip>
</QIcon>
</template>
</VnInput>
</VnRow>
<VnRow>
<VnSelectDialog
:label="t('worker.create.bankEntity')"
v-model="data.bankEntityFk"
:options="bankEntitiesOptions"
option-label="name"
option-value="id"
hide-selected
:roles-allowed-to-create="['salesAssistant', 'hr']"
:disable="data.isFreelance"
>
<template #form>
<CreateBankEntityForm
@on-data-saved="(data) => bankEntitiesOptions.push(data)"
/> />
</template> </template>
<template #actions> <template #option="scope">
<QBtn <QItem v-bind="scope.itemProps">
:label="t('components.smartCard.openCard')" <QItemSection v-if="scope.opt">
@click.stop="navigate(row.id)" <QItemLabel
outline >{{ scope.opt.bic }}
/> {{ scope.opt.name }}</QItemLabel
<QBtn >
:label="t('components.smartCard.openSummary')" </QItemSection>
@click.stop="viewSummary(row.id, WorkerSummary)" </QItem>
color="primary"
style="margin-top: 15px"
/>
</template> </template>
</CardList> </VnSelectDialog>
</template> </VnRow>
</VnPaginate>
</div> </div>
<QPageSticky :offset="[20, 20]"> </template>
<QBtn fab icon="add" color="primary" @click="redirectToCreateView()" /> </VnTable>
<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" />

View File

@ -104,6 +104,25 @@ export default {
}, },
], ],
}, },
{
name: 'WorkerTimeControl',
path: 'time-control',
meta: {
title: 'timeControl',
icon: 'access_time',
},
component: () =>
import('src/pages/Worker/Card/WorkerTimeControl.vue'),
},
{
name: 'WorkerCalendar',
path: 'calendar',
meta: {
title: 'calendar',
icon: 'calendar_today',
},
component: () => import('src/pages/Worker/Card/WorkerCalendar.vue'),
},
{ {
name: 'WorkerPda', name: 'WorkerPda',
path: 'pda', path: 'pda',
@ -150,25 +169,6 @@ export default {
}, },
component: () => import('src/pages/Worker/Card/WorkerLog.vue'), component: () => import('src/pages/Worker/Card/WorkerLog.vue'),
}, },
{
name: 'WorkerCalendar',
path: 'calendar',
meta: {
title: 'calendar',
icon: 'calendar_today',
},
component: () => import('src/pages/Worker/Card/WorkerCalendar.vue'),
},
{
name: 'WorkerTimeControl',
path: 'time-control',
meta: {
title: 'timeControl',
icon: 'access_time',
},
component: () =>
import('src/pages/Worker/Card/WorkerTimeControl.vue'),
},
{ {
name: 'WorkerLocker', name: 'WorkerLocker',
path: 'locker', path: 'locker',

View File

@ -1,5 +1,5 @@
describe('WorkerCreate', () => { describe('WorkerCreate', () => {
const externalRadio = '.q-toolbar .q-radio:nth-child(2)'; const externalRadio = '.q-radio:nth-child(2)';
const notification = '.q-notification__message'; const notification = '.q-notification__message';
const developerBossId = 120; const developerBossId = 120;
@ -9,6 +9,7 @@ describe('WorkerCreate', () => {
Name: { val: 'Manolo' }, Name: { val: 'Manolo' },
'Last name': { val: 'Hurtado' }, 'Last name': { val: 'Hurtado' },
'Personal email': { val: 'manolo@mydomain.com' }, 'Personal email': { val: 'manolo@mydomain.com' },
Company: { val: 'VNL', type: 'select' },
Street: { val: 'S/ DEFAULTWORKERSTREET' }, Street: { val: 'S/ DEFAULTWORKERSTREET' },
Location: { val: 1, type: 'select' }, Location: { val: 1, type: 'select' },
Phone: { val: '123456789' }, Phone: { val: '123456789' },
@ -29,16 +30,14 @@ describe('WorkerCreate', () => {
beforeEach(() => { beforeEach(() => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
cy.login('hr'); cy.login('hr');
cy.visit('/#/worker/create'); cy.visit('/#/worker/list');
cy.get('.q-page-sticky > div > .q-btn').click();
}); });
it('should throw an error if a pay method has not been selected', () => { it('should throw an error if a pay method has not been selected', () => {
cy.fillInForm(internal); cy.fillInForm(internal);
cy.saveCard(); cy.get('.q-mt-lg > .q-btn--standard').click();
cy.get(notification).should( cy.get(notification).should('contains.text', 'Payment method is required');
'contains.text',
'That payment method requires an IBAN'
);
}); });
it('should create an internal', () => { it('should create an internal', () => {
@ -46,14 +45,14 @@ describe('WorkerCreate', () => {
...internal, ...internal,
'Pay method': { val: 'PayMethod one', type: 'select' }, 'Pay method': { val: 'PayMethod one', type: 'select' },
}); });
cy.saveCard(); cy.get('.q-mt-lg > .q-btn--standard').click();
cy.get(notification).should('contains.text', 'Data created'); cy.get(notification).should('contains.text', 'Data created');
}); });
it('should create an external', () => { it('should create an external', () => {
cy.get(externalRadio).click(); cy.get(externalRadio).click();
cy.fillInForm(external); cy.fillInForm(external);
cy.saveCard(); cy.get('.q-mt-lg > .q-btn--standard').click();
cy.get(notification).should('contains.text', 'Data created'); cy.get(notification).should('contains.text', 'Data created');
}); });
}); });

View File

@ -1,25 +1,13 @@
describe('WorkerList', () => { describe('WorkerList', () => {
const workerFieldNames =
'.card-list-body > .list-items > :nth-child(1) > .value > span';
beforeEach(() => { beforeEach(() => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
cy.login('developer'); cy.login('developer');
cy.visit('/#/worker/list'); cy.visit('/#/worker/list');
}); });
it('should load workers', () => {
cy.get(workerFieldNames).eq(2).should('have.text', 'jessicajones');
cy.get(workerFieldNames).eq(3).should('have.text', 'brucebanner');
cy.get(workerFieldNames).eq(4).should('have.text', 'charlesxavier');
});
it('should open the worker summary', () => { it('should open the worker summary', () => {
cy.openListSummary(2); cy.get('.bg-header > :nth-child(2) > .full-width > :nth-child(1) >').type(
cy.get('.summaryHeader div').should('have.text', '1110 - Jessica Jones'); 'jessica jones{enter}'
cy.get('.summary .header-link') );
.eq(0)
.invoke('text')
.should('include', 'Basic data');
cy.get('.summary .header-link').eq(2).should('have.text', 'User data ');
}); });
}); });