Reviewed-on: #621 Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
commit
7a27b9808f
|
@ -9,6 +9,9 @@
|
||||||
> :deep(*) {
|
> :deep(*) {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
&[wrap] {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@media screen and (max-width: 800px) {
|
@media screen and (max-width: 800px) {
|
||||||
.vn-row {
|
.vn-row {
|
||||||
|
|
|
@ -43,20 +43,9 @@ onBeforeUnmount(() => stateStore.toggleSubToolbar());
|
||||||
</slot>
|
</slot>
|
||||||
</QToolbar>
|
</QToolbar>
|
||||||
</template>
|
</template>
|
||||||
<style lang="scss">
|
|
||||||
.q-toolbar {
|
|
||||||
background: var(--vn-section-color);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.sticky {
|
.sticky {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 61px;
|
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
@media (max-width: $breakpoint-sm) {
|
|
||||||
.sticky {
|
|
||||||
top: 90px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -190,6 +190,10 @@ select:-webkit-autofill {
|
||||||
font-size: medium;
|
font-size: medium;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.q-toolbar {
|
||||||
|
background: var(--vn-section-color);
|
||||||
|
}
|
||||||
|
|
||||||
.q-card__actions {
|
.q-card__actions {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,12 @@ import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const workersOptions = ref([]);
|
const educationLevels = ref([]);
|
||||||
const countriesOptions = ref([]);
|
const countries = ref([]);
|
||||||
const educationLevelsOptions = ref([]);
|
const maritalStatus = [
|
||||||
|
{ code: 'M', name: t('Married') },
|
||||||
|
{ code: 'S', name: t('Single') },
|
||||||
|
];
|
||||||
|
|
||||||
const workerFilter = {
|
const workerFilter = {
|
||||||
include: [
|
include: [
|
||||||
|
@ -29,44 +32,21 @@ const workerFilter = {
|
||||||
{ relation: 'department', scope: { include: { relation: 'department' } } },
|
{ relation: 'department', scope: { include: { relation: 'department' } } },
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
const workersFilter = {
|
|
||||||
fields: ['id', 'nickname'],
|
|
||||||
order: 'nickname ASC',
|
|
||||||
limit: 30,
|
|
||||||
};
|
|
||||||
const countriesFilter = {
|
|
||||||
fields: ['id', 'name', 'code'],
|
|
||||||
order: 'name ASC',
|
|
||||||
limit: 30,
|
|
||||||
};
|
|
||||||
const educationLevelsFilter = { fields: ['id', 'name'], order: 'name ASC', limit: 30 };
|
|
||||||
|
|
||||||
const maritalStatus = [
|
|
||||||
{ code: 'M', name: t('Married') },
|
|
||||||
{ code: 'S', name: t('Single') },
|
|
||||||
];
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
:filter="workersFilter"
|
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
|
||||||
@on-fetch="(data) => (workersOptions = data)"
|
@on-fetch="(data) => (educationLevels = data)"
|
||||||
auto-load
|
|
||||||
url="Workers/search"
|
|
||||||
/>
|
|
||||||
<FetchData
|
|
||||||
:filter="countriesFilter"
|
|
||||||
@on-fetch="(data) => (countriesOptions = data)"
|
|
||||||
auto-load
|
|
||||||
url="Countries"
|
|
||||||
/>
|
|
||||||
<FetchData
|
|
||||||
:filter="educationLevelsFilter"
|
|
||||||
@on-fetch="(data) => (educationLevelsOptions = data)"
|
|
||||||
auto-load
|
auto-load
|
||||||
url="EducationLevels"
|
url="EducationLevels"
|
||||||
/>
|
/>
|
||||||
|
<FetchData
|
||||||
|
url="Countries"
|
||||||
|
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
|
||||||
|
@on-fetch="(data) => (countries = data)"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
<FormModel
|
<FormModel
|
||||||
:filter="workerFilter"
|
:filter="workerFilter"
|
||||||
:url="`Workers/${route.params.id}`"
|
:url="`Workers/${route.params.id}`"
|
||||||
|
@ -90,7 +70,7 @@ const maritalStatus = [
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Boss')"
|
:label="t('Boss')"
|
||||||
:options="workersOptions"
|
url="Workers/search"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="nickname"
|
option-label="nickname"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
@ -121,7 +101,7 @@ const maritalStatus = [
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Origin country')"
|
:label="t('Origin country')"
|
||||||
:options="countriesOptions"
|
:options="countries"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
@ -129,7 +109,7 @@ const maritalStatus = [
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Education level')"
|
:label="t('Education level')"
|
||||||
:options="educationLevelsOptions"
|
:options="educationLevels"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
|
|
@ -108,7 +108,7 @@ const columns = computed(() => [
|
||||||
:filter="courseFilter"
|
:filter="courseFilter"
|
||||||
:create="{
|
:create="{
|
||||||
urlCreate: 'trainingCourses',
|
urlCreate: 'trainingCourses',
|
||||||
title: 'Create trainingCourse',
|
title: t('Create training course'),
|
||||||
onDataSaved: () => tableRef.reload(),
|
onDataSaved: () => tableRef.reload(),
|
||||||
formInitialData: {
|
formInitialData: {
|
||||||
workerFk: entityId,
|
workerFk: entityId,
|
||||||
|
@ -122,3 +122,7 @@ const columns = computed(() => [
|
||||||
:use-model="true"
|
:use-model="true"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Create training course: Crear curso de formación
|
||||||
|
</i18n>
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { useI18n } from 'vue-i18n';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -26,7 +27,7 @@ const departments = ref();
|
||||||
<span>{{ formatFn(tag.value) }}</span>
|
<span>{{ formatFn(tag.value) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ params, searchFn }">
|
<template #body="{ params }">
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput :label="t('FI')" v-model="params.fi" is-outlined
|
<VnInput :label="t('FI')" v-model="params.fi" is-outlined
|
||||||
|
@ -67,20 +68,17 @@ const departments = ref();
|
||||||
<QSkeleton type="QInput" class="full-width" />
|
<QSkeleton type="QInput" class="full-width" />
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection v-if="departments">
|
<QItemSection v-if="departments">
|
||||||
<QSelect
|
<VnSelect
|
||||||
:label="t('Department')"
|
:label="t('Department')"
|
||||||
v-model="params.departmentFk"
|
v-model="params.departmentFk"
|
||||||
@update:model-value="searchFn()"
|
|
||||||
:options="departments"
|
:options="departments"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
use-input
|
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
:input-debounce="0"
|
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
@ -107,6 +105,7 @@ en:
|
||||||
userName: User
|
userName: User
|
||||||
extension: Extension
|
extension: Extension
|
||||||
departmentFk: Department
|
departmentFk: Department
|
||||||
|
id: ID
|
||||||
es:
|
es:
|
||||||
params:
|
params:
|
||||||
search: Contiene
|
search: Contiene
|
||||||
|
@ -116,6 +115,7 @@ es:
|
||||||
userName: Usuario
|
userName: Usuario
|
||||||
extension: Extensión
|
extension: Extensión
|
||||||
departmentFk: Departamento
|
departmentFk: Departamento
|
||||||
|
id: ID
|
||||||
FI: NIF
|
FI: NIF
|
||||||
First Name: Nombre
|
First Name: Nombre
|
||||||
Last Name: Apellidos
|
Last Name: Apellidos
|
||||||
|
|
|
@ -14,6 +14,8 @@ import VnLocation from 'src/components/common/VnLocation.vue';
|
||||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||||
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
|
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
|
import WorkerFilter from './WorkerFilter.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
|
@ -28,14 +30,8 @@ const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'id',
|
name: 'id',
|
||||||
label: t('tableColumns.id'),
|
label: t('id'),
|
||||||
columnFilter: {
|
field: 'id',
|
||||||
alias: 'w',
|
|
||||||
inWhere: true,
|
|
||||||
},
|
|
||||||
chip: {
|
|
||||||
condition: () => true,
|
|
||||||
},
|
|
||||||
isId: true,
|
isId: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -44,7 +40,7 @@ const columns = computed(() => [
|
||||||
label: t('tableColumns.name'),
|
label: t('tableColumns.name'),
|
||||||
isTitle: true,
|
isTitle: true,
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
name: 'search',
|
name: 'firstName',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -54,8 +50,7 @@ const columns = computed(() => [
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
component: 'select',
|
component: 'select',
|
||||||
inWhere: true,
|
name: 'departmentFk',
|
||||||
alias: 'wd',
|
|
||||||
attrs: {
|
attrs: {
|
||||||
url: 'Departments',
|
url: 'Departments',
|
||||||
},
|
},
|
||||||
|
@ -130,6 +125,11 @@ function uppercaseStreetModel(data) {
|
||||||
@on-fetch="(data) => (bankEntitiesOptions = data)"
|
@on-fetch="(data) => (bankEntitiesOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
|
<RightMenu>
|
||||||
|
<template #right-panel>
|
||||||
|
<WorkerFilter data-key="Worker" />
|
||||||
|
</template>
|
||||||
|
</RightMenu>
|
||||||
<VnTable
|
<VnTable
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="Worker"
|
data-key="Worker"
|
||||||
|
@ -145,6 +145,7 @@ function uppercaseStreetModel(data) {
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
default-mode="table"
|
default-mode="table"
|
||||||
redirect="worker"
|
redirect="worker"
|
||||||
|
:right-search="false"
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
<template #more-create-dialog="{ data }">
|
<template #more-create-dialog="{ data }">
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
describe('WorkerList', () => {
|
describe('WorkerList', () => {
|
||||||
|
const inputName = '.q-drawer .q-form input[aria-label="First Name"]';
|
||||||
|
const searchBtn = '.q-drawer button:nth-child(3)';
|
||||||
|
const descriptorTitle = '.descriptor .title span';
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.viewport(1280, 720);
|
cy.viewport(1280, 720);
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
|
@ -6,6 +9,11 @@ describe('WorkerList', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should open the worker summary', () => {
|
it('should open the worker summary', () => {
|
||||||
cy.get('.q-drawer .q-form input[aria-label="Name"]').type('jessica jones{enter}');
|
cy.get(inputName).type('jessica{enter}');
|
||||||
|
cy.get(searchBtn).click();
|
||||||
|
cy.intercept('GET', /\/api\/Workers\/\d+/).as('worker');
|
||||||
|
cy.wait('@worker').then(() =>
|
||||||
|
cy.get(descriptorTitle).should('include.text', 'Jessica')
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue