fix: order catalog
gitea/salix-front/pipeline/pr-master This commit looks good
Details
gitea/salix-front/pipeline/pr-master This commit looks good
Details
This commit is contained in:
parent
195747b5a0
commit
3a21f6aadb
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue