diff --git a/src/pages/Order/Card/OrderDescriptor.vue b/src/pages/Order/Card/OrderDescriptor.vue
index f70ba4520..4d84a32fc 100644
--- a/src/pages/Order/Card/OrderDescriptor.vue
+++ b/src/pages/Order/Card/OrderDescriptor.vue
@@ -60,7 +60,7 @@ const filter = {
const data = ref(useCardDescription());
const setData = (entity) => {
if (!entity) return;
- data.value = useCardDescription(entity.client.name, entity.id);
+ data.value = useCardDescription(entity?.client?.name, entity?.id);
state.set('OrderDescriptor', entity);
};
diff --git a/src/pages/Order/OrderLines.vue b/src/pages/Order/OrderLines.vue
index e66a3f7c4..aebc2ed85 100644
--- a/src/pages/Order/OrderLines.vue
+++ b/src/pages/Order/OrderLines.vue
@@ -21,9 +21,6 @@ const quasar = useQuasar();
const componentKey = ref(0);
const tableLinesRef = ref();
const order = ref();
-const refresh = () => {
- componentKey.value += 1;
-};
const orderSummary = ref({
total: null,
vat: null,
@@ -66,37 +63,6 @@ const lineFilter = ref({
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(() => [
{
align: 'center',
@@ -121,6 +87,7 @@ const columns = computed(() => [
condition: () => true,
},
isId: true,
+ format: (row) => row?.item?.id,
},
{
align: 'left',
@@ -190,12 +157,45 @@ const columns = computed(() => [
{
title: t('delete'),
icon: 'delete',
- click: (row) => confirmRemove(row.item),
+ action: (row) => confirmRemove(row),
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',
+ });
+}
@@ -272,7 +272,7 @@ const columns = computed(() => [
-
+
{{ t('confirm') }}