0
0
Fork 0

Merge branch 'dev' into 7323-fineTunningWorker

This commit is contained in:
Jorge Penadés 2024-10-07 06:39:07 +00:00
commit 355c84ad06
6 changed files with 35 additions and 18 deletions

View File

@ -130,4 +130,5 @@ function extractValueTags(items) {
<i18n> <i18n>
es: es:
You can search items by name or id: Puedes buscar items por nombre o id You can search items by name or id: Puedes buscar items por nombre o id
Search items: Buscar items
</i18n> </i18n>

View File

@ -247,6 +247,7 @@ function addOrder(value, field, params) {
rounded rounded
emit-value emit-value
use-input use-input
sort-by="name ASC"
:disable="!selectedCategoryFk" :disable="!selectedCategoryFk"
@update:model-value=" @update:model-value="
(value) => { (value) => {

View File

@ -20,8 +20,10 @@ const props = defineProps({
const fields = ref((props.prices || []).map((item) => ({ ...item, quantity: 0 }))); const fields = ref((props.prices || []).map((item) => ({ ...item, quantity: 0 })));
const descriptorData = useArrayData('orderData'); const descriptorData = useArrayData('orderData');
const isLoading = ref(false);
const addToOrder = async () => { const addToOrder = async () => {
if (isLoading.value) return;
isLoading.value = true;
const items = (fields.value || []).filter((item) => Number(item.quantity) > 0); const items = (fields.value || []).filter((item) => Number(item.quantity) > 0);
await axios.post('/OrderRows/addToOrder', { await axios.post('/OrderRows/addToOrder', {
items, items,
@ -30,6 +32,10 @@ const addToOrder = async () => {
notify(t('globals.dataSaved'), 'positive'); notify(t('globals.dataSaved'), 'positive');
emit('added'); emit('added');
descriptorData.fetch({}); descriptorData.fetch({});
isLoading.value = false;
};
const canAddToOrder = () => {
return (fields.value || []).some((item) => Number(item.quantity) > 0);
}; };
</script> </script>
@ -68,7 +74,11 @@ const addToOrder = async () => {
</tbody> </tbody>
</QMarkupTable> </QMarkupTable>
<div class="flex justify-center q-mt-lg"> <div class="flex justify-center q-mt-lg">
<QBtn color="primary" type="submit"> <QBtn
color="primary"
type="submit"
:disable="!isLoading && !canAddToOrder()"
>
{{ t('globals.add') }} {{ t('globals.add') }}
</QBtn> </QBtn>
</div> </div>
@ -81,3 +91,10 @@ const addToOrder = async () => {
width: 200px; width: 200px;
} }
</style> </style>
<i18n>
es:
noAmount: La cantidad no puede ser 0
en:
noAmount: Amount can not be 0
</i18n>

View File

@ -46,13 +46,13 @@ async function deleteWorCenter(id) {
} }
</script> </script>
<template> <template>
<div class="centerCard">
<FetchData <FetchData
url="workCenters" url="workCenters"
sort-by="name" sort-by="name"
@on-fetch="(data) => (warehouses = data)" @on-fetch="(data) => (warehouses = data)"
auto-load auto-load
/> />
<div class="centerCard">
<VnPaginate <VnPaginate
ref="paginate" ref="paginate"
data-key="AgencyWorkCenters" data-key="AgencyWorkCenters"

View File

@ -4,12 +4,12 @@ describe('AgencyWorkCenter', () => {
cy.login('developer'); cy.login('developer');
cy.visit(`/#/agency/11/workCenter`); cy.visit(`/#/agency/11/workCenter`);
}); });
const createButton = '.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon';
const workCenterCombobox = 'input[role="combobox"]';
it('assign workCenter', () => { it('assign workCenter', () => {
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click(); cy.get(createButton).click();
cy.get( cy.get(workCenterCombobox).type('workCenterOne{enter}');
'.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container'
).type('workCenterOne{enter}');
cy.get('.q-notification__message').should('have.text', 'Data created'); cy.get('.q-notification__message').should('have.text', 'Data created');
}); });
@ -22,12 +22,10 @@ describe('AgencyWorkCenter', () => {
}); });
it('error on duplicate workCenter', () => { it('error on duplicate workCenter', () => {
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click(); cy.get(createButton).click();
cy.get( cy.get(workCenterCombobox).type('workCenterOne{enter}');
'.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container'
).type('workCenterOne{enter}');
cy.get('.q-notification__message').should('have.text', 'Data created'); cy.get('.q-notification__message').should('have.text', 'Data created');
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click(); cy.get(createButton).click();
cy.get( cy.get(
'.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container' '.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container'
).type('workCenterOne{enter}'); ).type('workCenterOne{enter}');

View File

@ -2,7 +2,7 @@ describe('Route', () => {
beforeEach(() => { beforeEach(() => {
cy.viewport(1920, 1080); cy.viewport(1920, 1080);
cy.login('developer'); cy.login('developer');
cy.visit(`/#/route/list`); cy.visit(`/#/route/extended-list`);
}); });
const getVnSelect = const getVnSelect =
'> :nth-child(1) > .column > .q-field > .q-field__inner > .q-field__control > .q-field__control-container'; '> :nth-child(1) > .column > .q-field > .q-field__inner > .q-field__control > .q-field__control-container';