0
0
Fork 0

Merge branch '6900-addSerial' of https://gitea.verdnatura.es/verdnatura/salix-front into 6900-addSerial

This commit is contained in:
Jorge Penadés 2024-08-14 14:27:57 +02:00
commit 760dc0e6f4
14 changed files with 72 additions and 70 deletions

View File

@ -159,6 +159,14 @@ const isEmployee = computed(() => useRole().isEmployee());
size="xxl" size="xxl"
color="transparent" color="transparent"
/> />
<QBtn
v-if="isEmployee"
class="q-mt-sm q-px-md"
:to="`/worker/${user.id}`"
color="primary"
:label="t('globals.myAccount')"
dense
/>
<div class="text-subtitle1 q-mt-md"> <div class="text-subtitle1 q-mt-md">
<strong>{{ user.nickname }}</strong> <strong>{{ user.nickname }}</strong>
</div> </div>

View File

@ -407,9 +407,12 @@ watch(
@on-fetch=" @on-fetch="
(data) => (data) =>
(actions = data.map((item) => { (actions = data.map((item) => {
const changedModel = item.changedModel;
return { return {
locale: useCapitalize(validations[item.changedModel].locale.name), locale: useCapitalize(
value: item.changedModel, validations[changedModel]?.locale?.name ?? changedModel
),
value: changedModel,
}; };
})) }))
" "

View File

@ -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 {

View File

@ -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>

View File

@ -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;
} }

View File

@ -264,6 +264,7 @@ globals:
title: Unsaved changes will be lost title: Unsaved changes will be lost
subtitle: Are you sure exit without saving? subtitle: Are you sure exit without saving?
createInvoiceIn: Create invoice in createInvoiceIn: Create invoice in
myAccount: My account
errors: errors:
statusUnauthorized: Access denied statusUnauthorized: Access denied
statusInternalServerError: An internal server error has ocurred statusInternalServerError: An internal server error has ocurred

View File

@ -266,7 +266,7 @@ globals:
title: Los cambios que no haya guardado se perderán title: Los cambios que no haya guardado se perderán
subtitle: ¿Seguro que quiere salir sin guardar? subtitle: ¿Seguro que quiere salir sin guardar?
createInvoiceIn: Crear factura recibida createInvoiceIn: Crear factura recibida
myAccount: Mi cuenta
errors: errors:
statusUnauthorized: Acceso denegado statusUnauthorized: Acceso denegado
statusInternalServerError: Ha ocurrido un error interno del servidor statusInternalServerError: Ha ocurrido un error interno del servidor

View File

@ -298,6 +298,7 @@ onMounted(() => (stateStore.rightDrawer = true));
<div class="col"> <div class="col">
<VnSelect <VnSelect
url="Warehouses" url="Warehouses"
:sort-by="['name']"
:label="t('ticket.create.warehouse')" :label="t('ticket.create.warehouse')"
v-model="data.warehouseId" v-model="data.warehouseId"
:options="warehousesOptions" :options="warehousesOptions"

View File

@ -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"

View File

@ -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>

View File

@ -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

View File

@ -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 }">

View File

@ -8,7 +8,7 @@ describe('Logout', () => {
describe('by user', () => { describe('by user', () => {
it('should logout', () => { it('should logout', () => {
cy.get('#user').click(); cy.get('#user').click();
cy.get('.block').click(); cy.get('#logout').click();
}); });
}); });
describe('not user', () => { describe('not user', () => {

View File

@ -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')
);
}); });
}); });