0
0
Fork 0

fix: refs #6896 fixed list & lines error

This commit is contained in:
Jon Elias 2024-07-09 14:09:04 +02:00
parent 1978157a08
commit 24368d99b5
2 changed files with 37 additions and 37 deletions

View File

@ -60,7 +60,7 @@ const filter = {
const data = ref(useCardDescription()); const data = ref(useCardDescription());
const setData = (entity) => { const setData = (entity) => {
if (!entity) return; if (!entity) return;
data.value = useCardDescription(entity.client.name, entity.id); data.value = useCardDescription(entity?.client?.name, entity?.id);
state.set('OrderDescriptor', entity); state.set('OrderDescriptor', entity);
}; };

View File

@ -21,9 +21,6 @@ const quasar = useQuasar();
const componentKey = ref(0); const componentKey = ref(0);
const tableLinesRef = ref(); const tableLinesRef = ref();
const order = ref(); const order = ref();
const refresh = () => {
componentKey.value += 1;
};
const orderSummary = ref({ const orderSummary = ref({
total: null, total: null,
vat: null, vat: null,
@ -66,37 +63,6 @@ const lineFilter = ref({
where: { orderFk: route.params.id }, where: { orderFk: route.params.id },
}); });
function confirmRemove(item) {
quasar.dialog({
component: VnConfirm,
componentProps: {
title: t('confirmDeletion'),
message: t('confirmDeletionMessage'),
promise: async () => remove(item),
},
});
}
async function remove(item) {
await axios.post('OrderRows/removes', {
actualOrderId: route.params.id,
rows: [item.id],
});
quasar.notify({
message: t('globals.dataDeleted'),
type: 'positive',
});
refresh();
}
async function confirmOrder() {
await axios.post(`Orders/${route.params.id}/confirm`);
quasar.notify({
message: t('globals.confirm'),
type: 'positive',
});
}
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'center', align: 'center',
@ -121,6 +87,7 @@ const columns = computed(() => [
condition: () => true, condition: () => true,
}, },
isId: true, isId: true,
format: (row) => row?.item?.id,
}, },
{ {
align: 'left', align: 'left',
@ -190,12 +157,45 @@ const columns = computed(() => [
{ {
title: t('delete'), title: t('delete'),
icon: 'delete', icon: 'delete',
click: (row) => confirmRemove(row.item), action: (row) => confirmRemove(row),
isPrimary: true, isPrimary: true,
}, },
], ],
}, },
]); ]);
function confirmRemove(item) {
quasar.dialog({
component: VnConfirm,
componentProps: {
title: t('confirmDeletion'),
message: t('confirmDeletionMessage'),
promise: async () => remove(item),
},
});
}
async function remove(item) {
console.log('item: ', item);
console.log('id: ', route.params.id);
await axios.post('OrderRows/removes', {
actualOrderId: route.params.id,
rows: [item.id],
});
quasar.notify({
message: t('globals.dataDeleted'),
type: 'positive',
});
tableLinesRef.value.reload();
}
async function confirmOrder() {
await axios.post(`Orders/${route.params.id}/confirm`);
quasar.notify({
message: t('globals.confirm'),
type: 'positive',
});
}
</script> </script>
<template> <template>
@ -272,7 +272,7 @@ const columns = computed(() => [
</template> </template>
</VnTable> </VnTable>
</div> </div>
<QPageSticky :offset="[20, 20]" v-if="!order?.isConfirmed"> <QPageSticky :offset="[20, 20]" v-if="!order?.isConfirmed" style="z-index: 2">
<QBtn fab icon="check" color="primary" @click="confirmOrder()" /> <QBtn fab icon="check" color="primary" @click="confirmOrder()" />
<QTooltip> <QTooltip>
{{ t('confirm') }} {{ t('confirm') }}