Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix-front into test
This commit is contained in:
commit
aaf749db6c
|
@ -316,6 +316,7 @@ defineExpose({
|
||||||
selected,
|
selected,
|
||||||
CrudModelRef,
|
CrudModelRef,
|
||||||
params,
|
params,
|
||||||
|
tableRef,
|
||||||
});
|
});
|
||||||
|
|
||||||
function handleOnDataSaved(_) {
|
function handleOnDataSaved(_) {
|
||||||
|
@ -815,6 +816,7 @@ es:
|
||||||
top: 0;
|
top: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.vnTable {
|
.vnTable {
|
||||||
thead tr th {
|
thead tr th {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
<script setup>
|
||||||
|
import VnSelect from './VnSelect.vue';
|
||||||
|
|
||||||
|
defineProps({
|
||||||
|
selectProps: { type: Object, required: true },
|
||||||
|
promise: { type: Function, default: () => {} },
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<QBtnDropdown v-bind="$attrs" color="primary">
|
||||||
|
<VnSelect
|
||||||
|
v-bind="selectProps"
|
||||||
|
hide-selected
|
||||||
|
hide-dropdown-icon
|
||||||
|
focus-on-mount
|
||||||
|
@update:model-value="promise"
|
||||||
|
/>
|
||||||
|
</QBtnDropdown>
|
||||||
|
</template>
|
|
@ -308,8 +308,11 @@ globals:
|
||||||
email: Email
|
email: Email
|
||||||
SSN: SSN
|
SSN: SSN
|
||||||
fi: FI
|
fi: FI
|
||||||
|
myTeam: My team
|
||||||
|
departmentFk: Department
|
||||||
changePass: Change password
|
changePass: Change password
|
||||||
deleteConfirmTitle: Delete selected elements
|
deleteConfirmTitle: Delete selected elements
|
||||||
|
changeState: Change state
|
||||||
errors:
|
errors:
|
||||||
statusUnauthorized: Access denied
|
statusUnauthorized: Access denied
|
||||||
statusInternalServerError: An internal server error has ocurred
|
statusInternalServerError: An internal server error has ocurred
|
||||||
|
@ -556,7 +559,6 @@ ticket:
|
||||||
package: Package
|
package: Package
|
||||||
taxClass: Tax class
|
taxClass: Tax class
|
||||||
services: Services
|
services: Services
|
||||||
changeState: Change state
|
|
||||||
requester: Requester
|
requester: Requester
|
||||||
atender: Atender
|
atender: Atender
|
||||||
request: Request
|
request: Request
|
||||||
|
|
|
@ -312,8 +312,11 @@ globals:
|
||||||
email: Correo
|
email: Correo
|
||||||
SSN: NSS
|
SSN: NSS
|
||||||
fi: NIF
|
fi: NIF
|
||||||
|
myTeam: Mi equipo
|
||||||
|
departmentFk: Departamento
|
||||||
changePass: Cambiar contraseña
|
changePass: Cambiar contraseña
|
||||||
deleteConfirmTitle: Eliminar los elementos seleccionados
|
deleteConfirmTitle: Eliminar los elementos seleccionados
|
||||||
|
changeState: Cambiar estado
|
||||||
errors:
|
errors:
|
||||||
statusUnauthorized: Acceso denegado
|
statusUnauthorized: Acceso denegado
|
||||||
statusInternalServerError: Ha ocurrido un error interno del servidor
|
statusInternalServerError: Ha ocurrido un error interno del servidor
|
||||||
|
@ -565,7 +568,6 @@ ticket:
|
||||||
package: Embalaje
|
package: Embalaje
|
||||||
taxClass: Tipo IVA
|
taxClass: Tipo IVA
|
||||||
services: Servicios
|
services: Servicios
|
||||||
changeState: Cambiar estado
|
|
||||||
requester: Solicitante
|
requester: Solicitante
|
||||||
atender: Comprador
|
atender: Comprador
|
||||||
request: Petición de compra
|
request: Petición de compra
|
||||||
|
|
|
@ -204,7 +204,7 @@ function claimUrl(section) {
|
||||||
top
|
top
|
||||||
color="black"
|
color="black"
|
||||||
text-color="white"
|
text-color="white"
|
||||||
:label="t('ticket.summary.changeState')"
|
:label="t('globals.changeState')"
|
||||||
>
|
>
|
||||||
<QList>
|
<QList>
|
||||||
<QVirtualScroll
|
<QVirtualScroll
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref, computed, onUnmounted, watch } from 'vue';
|
import { onMounted, ref, computed, onUnmounted } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@ import useNotify from 'src/composables/useNotify.js';
|
||||||
import { toDateTimeFormat } from 'src/filters/date';
|
import { toDateTimeFormat } from 'src/filters/date';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
import VnBtnSelect from 'src/components/common/VnBtnSelect.vue';
|
||||||
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
|
@ -23,50 +25,24 @@ const { notify } = useNotify();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
const newTicketDialogRef = ref(null);
|
const newTicketDialogRef = ref(null);
|
||||||
const logsTableDialogRef = ref(null);
|
const logsTableDialogRef = ref(null);
|
||||||
const tableRef = ref();
|
const vnTableRef = ref();
|
||||||
const expeditionsLogsData = ref([]);
|
const expeditionsLogsData = ref([]);
|
||||||
const selectedExpeditions = ref([]);
|
const selectedExpeditions = ref([]);
|
||||||
const allColumnNames = ref([]);
|
const allColumnNames = ref([]);
|
||||||
const newTicketWithRoute = ref(false);
|
const newTicketWithRoute = ref(false);
|
||||||
const selectedRows = ref([]);
|
const selectedRows = ref([]);
|
||||||
const hasSelectedRows = computed(() => selectedRows.value.length > 0);
|
const hasSelectedRows = computed(() => selectedRows.value.length > 0);
|
||||||
|
const expeditionStateTypes = ref([]);
|
||||||
const exprBuilder = (param, value) => {
|
|
||||||
switch (param) {
|
|
||||||
case 'expeditionFk':
|
|
||||||
return { id: value };
|
|
||||||
case 'packageItemName':
|
|
||||||
return { packagingItemFk: value };
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const expeditionsFilter = computed(() => ({
|
const expeditionsFilter = computed(() => ({
|
||||||
where: { ticketFk: route.params.id },
|
where: { ticketFk: route.params.id },
|
||||||
order: ['created DESC'],
|
order: ['created DESC'],
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const expeditionsArrayData = useArrayData('ticketExpeditions', {
|
|
||||||
url: 'Expeditions/filter',
|
|
||||||
filter: expeditionsFilter.value,
|
|
||||||
exprBuilder: exprBuilder,
|
|
||||||
});
|
|
||||||
|
|
||||||
const ticketArrayData = useArrayData('ticketData');
|
const ticketArrayData = useArrayData('ticketData');
|
||||||
const ticketStore = ticketArrayData.store;
|
const ticketStore = ticketArrayData.store;
|
||||||
const ticketData = computed(() => ticketStore.data);
|
const ticketData = computed(() => ticketStore.data);
|
||||||
|
|
||||||
const refetchExpeditions = async () => {
|
|
||||||
await expeditionsArrayData.applyFilter({
|
|
||||||
filter: expeditionsFilter.value,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => route.params.id,
|
|
||||||
async () => await refetchExpeditions(),
|
|
||||||
{ immediate: true }
|
|
||||||
);
|
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -188,12 +164,10 @@ const showNewTicketDialog = (withRoute = false) => {
|
||||||
|
|
||||||
const deleteExpedition = async () => {
|
const deleteExpedition = async () => {
|
||||||
try {
|
try {
|
||||||
const expeditionIds = selectedExpeditions.value.map(
|
const expeditionIds = selectedRows.value.map((expedition) => expedition.id);
|
||||||
(expedition) => expedition.id
|
|
||||||
);
|
|
||||||
const params = { expeditionIds };
|
const params = { expeditionIds };
|
||||||
await axios.post('Expeditions/deleteExpeditions', params);
|
await axios.post('Expeditions/deleteExpeditions', params);
|
||||||
await refetchExpeditions();
|
vnTableRef.value.reload();
|
||||||
selectedExpeditions.value = [];
|
selectedExpeditions.value = [];
|
||||||
notify(t('expedition.expeditionRemoved'), 'positive');
|
notify(t('expedition.expeditionRemoved'), 'positive');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -242,9 +216,34 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<FetchData
|
||||||
|
url="expeditionStateTypes"
|
||||||
|
@on-fetch="(data) => (expeditionStateTypes = data)"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
<VnSubToolbar>
|
<VnSubToolbar>
|
||||||
<template #st-actions>
|
<template #st-actions>
|
||||||
<QBtnGroup push class="q-gutter-x-sm" flat>
|
<QBtnGroup push class="q-gutter-x-sm" flat>
|
||||||
|
<VnBtnSelect
|
||||||
|
:disable="!hasSelectedRows"
|
||||||
|
color="primary"
|
||||||
|
:label="t('globals.changeState')"
|
||||||
|
:select-props="{
|
||||||
|
options: expeditionStateTypes,
|
||||||
|
optionLabel: 'description',
|
||||||
|
}"
|
||||||
|
:promise="
|
||||||
|
async (stateTypeFk) => {
|
||||||
|
await vnTableRef.CrudModelRef.saveChanges({
|
||||||
|
updates: selectedRows.map(({ id }) => ({
|
||||||
|
data: { stateTypeFk },
|
||||||
|
where: { id },
|
||||||
|
})),
|
||||||
|
});
|
||||||
|
vnTableRef.tableRef.clearSelection();
|
||||||
|
}
|
||||||
|
"
|
||||||
|
/>
|
||||||
<QBtnDropdown
|
<QBtnDropdown
|
||||||
ref="btnDropdownRef"
|
ref="btnDropdownRef"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
@ -298,11 +297,11 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
</QBtnGroup>
|
</QBtnGroup>
|
||||||
</template>
|
</template>
|
||||||
</VnSubToolbar>
|
</VnSubToolbar>
|
||||||
|
|
||||||
<VnTable
|
<VnTable
|
||||||
ref="tableRef"
|
ref="vnTableRef"
|
||||||
data-key="TicketExpedition"
|
data-key="TicketExpedition"
|
||||||
url="Expeditions/filter"
|
url="Expeditions/filter"
|
||||||
|
search-url="expeditions"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:filter="expeditionsFilter"
|
:filter="expeditionsFilter"
|
||||||
v-model:selected="selectedRows"
|
v-model:selected="selectedRows"
|
||||||
|
@ -310,7 +309,18 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
'row-key': 'id',
|
'row-key': 'id',
|
||||||
selection: 'multiple',
|
selection: 'multiple',
|
||||||
}"
|
}"
|
||||||
|
save-url="Expeditions/crud"
|
||||||
auto-load
|
auto-load
|
||||||
|
:expr-builder="
|
||||||
|
(param, value) => {
|
||||||
|
switch (param) {
|
||||||
|
case 'expeditionFk':
|
||||||
|
return { id: value };
|
||||||
|
case 'packageItemName':
|
||||||
|
return { packagingItemFk: value };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"
|
||||||
order="created DESC"
|
order="created DESC"
|
||||||
>
|
>
|
||||||
<template #column-packagingItemFk="{ row }">
|
<template #column-packagingItemFk="{ row }">
|
||||||
|
@ -324,7 +334,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
<ExpeditionNewTicket
|
<ExpeditionNewTicket
|
||||||
:ticket="ticketData"
|
:ticket="ticketData"
|
||||||
:with-route="newTicketWithRoute"
|
:with-route="newTicketWithRoute"
|
||||||
:selected-expeditions="selectedExpeditions"
|
:selected-expeditions="selectedRows"
|
||||||
/>
|
/>
|
||||||
</QDialog>
|
</QDialog>
|
||||||
<QDialog ref="logsTableDialogRef" transition-show="scale" transition-hide="scale">
|
<QDialog ref="logsTableDialogRef" transition-show="scale" transition-hide="scale">
|
||||||
|
|
|
@ -122,37 +122,23 @@ function isOnTicketCard() {
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #header-right>
|
<template #header-right>
|
||||||
<div class="flex items-end">
|
<QBtnDropdown
|
||||||
<QBtnDropdown
|
ref="stateBtnDropdownRef"
|
||||||
ref="stateBtnDropdownRef"
|
color="black"
|
||||||
color="black"
|
text-color="white"
|
||||||
text-color="white"
|
:label="t('globals.changeState')"
|
||||||
:label="t('ticket.summary.changeState')"
|
:disable="!isEditable()"
|
||||||
:disable="!isEditable()"
|
>
|
||||||
>
|
<VnSelect
|
||||||
<VnSelect
|
:options="editableStates"
|
||||||
:options="editableStates"
|
hide-selected
|
||||||
hide-selected
|
option-label="name"
|
||||||
option-label="name"
|
option-value="code"
|
||||||
option-value="code"
|
hide-dropdown-icon
|
||||||
hide-dropdown-icon
|
focus-on-mount
|
||||||
focus-on-mount
|
@update:model-value="changeState"
|
||||||
@update:model-value="changeState"
|
/>
|
||||||
/>
|
</QBtnDropdown>
|
||||||
</QBtnDropdown>
|
|
||||||
<QBtn
|
|
||||||
v-if="!isOnTicketCard()"
|
|
||||||
icon="more_vert"
|
|
||||||
round
|
|
||||||
size="md"
|
|
||||||
flat
|
|
||||||
color="white"
|
|
||||||
>
|
|
||||||
<QMenu>
|
|
||||||
<TicketDescriptorMenu :ticket="entityId" />
|
|
||||||
</QMenu>
|
|
||||||
</QBtn>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ entity }">
|
<template #body="{ entity }">
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
|
|
|
@ -463,6 +463,9 @@ onMounted(async () => {
|
||||||
userParams.dateToAdvance = today;
|
userParams.dateToAdvance = today;
|
||||||
userParams.scopeDays = 1;
|
userParams.scopeDays = 1;
|
||||||
userParams.warehouseFk = user.value.warehouseFk;
|
userParams.warehouseFk = user.value.warehouseFk;
|
||||||
|
userParams.ipt = 'H';
|
||||||
|
userParams.futureIpt = 'H';
|
||||||
|
userParams.isFullMovable = true;
|
||||||
const filter = { limit: 0 };
|
const filter = { limit: 0 };
|
||||||
await arrayData.addFilter({ filter, userParams });
|
await arrayData.addFilter({ filter, userParams });
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,7 +11,7 @@ import axios from 'axios';
|
||||||
import { onMounted } from 'vue';
|
import { onMounted } from 'vue';
|
||||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t, te } = useI18n();
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
dataKey: {
|
dataKey: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -43,6 +43,11 @@ const getItemPackingTypes = async () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getLocale = (val) => {
|
||||||
|
const param = `params.${val}`;
|
||||||
|
return te(param) ? t(param) : t(`globals.${param}`);
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(async () => await getItemPackingTypes());
|
onMounted(async () => await getItemPackingTypes());
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -60,7 +65,7 @@ onMounted(async () => await getItemPackingTypes());
|
||||||
>
|
>
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
<strong>{{ getLocale(tag.label) }}: </strong>
|
||||||
<span>{{ formatFn(tag.value) }}</span>
|
<span>{{ formatFn(tag.value) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -136,6 +141,19 @@ onMounted(async () => await getItemPackingTypes());
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<VnSelect
|
||||||
|
:label="t('globals.params.departmentFk')"
|
||||||
|
v-model="params.departmentFk"
|
||||||
|
url="Departments"
|
||||||
|
:fields="['id', 'name']"
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
rounded
|
||||||
|
/>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
|
|
@ -100,7 +100,7 @@ weeklyTickets:
|
||||||
advanceTickets:
|
advanceTickets:
|
||||||
preparation: Preparación
|
preparation: Preparación
|
||||||
origin: Origen
|
origin: Origen
|
||||||
destination: Destinatario
|
destination: Destino
|
||||||
originAgency: 'Agencia origen: {agency}'
|
originAgency: 'Agencia origen: {agency}'
|
||||||
destinationAgency: 'Agencia destino: {agency}'
|
destinationAgency: 'Agencia destino: {agency}'
|
||||||
ticketId: ID
|
ticketId: ID
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
|
describe('Ticket expedtion', () => {
|
||||||
|
const tableContent = '.q-table .q-virtual-scroll__content';
|
||||||
|
const stateTd = 'td:nth-child(9)';
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should change the state', () => {
|
||||||
|
cy.visit('#/ticket/1/expedition');
|
||||||
|
cy.intercept('GET', /\/api\/Expeditions\/filter/).as('expeditions');
|
||||||
|
cy.intercept('POST', /\/api\/Expeditions\/crud/).as('crud');
|
||||||
|
|
||||||
|
cy.wait('@expeditions');
|
||||||
|
|
||||||
|
cy.selectRows([1, 2]);
|
||||||
|
cy.get('#subToolbar [aria-controls]:nth-child(1)').click();
|
||||||
|
cy.get('.q-menu .q-item').contains('Perdida').click();
|
||||||
|
cy.wait('@crud');
|
||||||
|
|
||||||
|
cy.get(`${tableContent} tr:nth-child(-n+2) ${stateTd}`).each(($el) => {
|
||||||
|
cy.wrap($el).contains('Perdida');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -152,6 +152,14 @@ Cypress.Commands.add('notificationHas', (selector, text) => {
|
||||||
cy.get(selector).should('have.text', text);
|
cy.get(selector).should('have.text', text);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add('selectRows', (rows) => {
|
||||||
|
rows.forEach((row) => {
|
||||||
|
cy.get('.q-table .q-virtual-scroll__content tr .q-checkbox__inner')
|
||||||
|
.eq(row - 1)
|
||||||
|
.click();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('fillRow', (rowSelector, data) => {
|
Cypress.Commands.add('fillRow', (rowSelector, data) => {
|
||||||
// Usar el selector proporcionado para obtener la fila deseada
|
// Usar el selector proporcionado para obtener la fila deseada
|
||||||
cy.waitForElement('tbody');
|
cy.waitForElement('tbody');
|
||||||
|
|
Loading…
Reference in New Issue