0
0
Fork 0

Merge branch 'dev' into 7671_dense_itemFixedPrices

This commit is contained in:
Javier Segarra 2024-07-11 09:54:19 +02:00
commit f038f0a60f
3 changed files with 44 additions and 40 deletions

View File

@ -152,7 +152,7 @@ function splitColumns(columns) {
columns: [], columns: [],
chips: [], chips: [],
create: [], create: [],
visible: [], cardVisible: [],
}; };
for (const col of columns) { for (const col of columns) {
@ -160,7 +160,7 @@ function splitColumns(columns) {
if (col.chip) splittedColumns.value.chips.push(col); if (col.chip) splittedColumns.value.chips.push(col);
if (col.isTitle) splittedColumns.value.title = col; if (col.isTitle) splittedColumns.value.title = col;
if (col.create) splittedColumns.value.create.push(col); if (col.create) splittedColumns.value.create.push(col);
if (col.cardVisible) splittedColumns.value.visible.push(col); if (col.cardVisible) splittedColumns.value.cardVisible.push(col);
if ($props.isEditable && col.disable == null) col.disable = false; if ($props.isEditable && col.disable == null) col.disable = false;
if ($props.useModel) col.columnFilter = { ...col.columnFilter, inWhere: true }; if ($props.useModel) col.columnFilter = { ...col.columnFilter, inWhere: true };
splittedColumns.value.columns.push(col); splittedColumns.value.columns.push(col);
@ -311,7 +311,11 @@ defineExpose({
/> />
</template> </template>
<template #header-cell="{ col }"> <template #header-cell="{ col }">
<QTh v-if="col.visible" auto-width style="min-width: 100px"> <QTh
v-if="col.visible ?? true"
auto-width
style="min-width: 100px"
>
<div <div
class="q-pt-sm q-px-sm ellipsis" class="q-pt-sm q-px-sm ellipsis"
:class="`text-${col?.align ?? 'left'}`" :class="`text-${col?.align ?? 'left'}`"
@ -354,7 +358,7 @@ defineExpose({
auto-width auto-width
class="no-margin q-px-xs" class="no-margin q-px-xs"
:class="getColAlign(col)" :class="getColAlign(col)"
v-if="col.visible" v-if="col.visible ?? true"
> >
<slot :name="`column-${col.name}`" :col="col" :row="row"> <slot :name="`column-${col.name}`" :col="col" :row="row">
<VnTableColumn <VnTableColumn
@ -443,7 +447,7 @@ defineExpose({
:class="$props.cardClass" :class="$props.cardClass"
> >
<div <div
v-for="col of splittedColumns.visible" v-for="col of splittedColumns.cardVisible"
:key="col.name" :key="col.name"
class="fields" class="fields"
> >

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',
@ -196,6 +163,39 @@ const columns = computed(() => [
], ],
}, },
]); ]);
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>

View File

@ -71,7 +71,7 @@ watch(
const data = ref(useCardDescription()); const data = ref(useCardDescription());
const setData = (entity) => { const setData = (entity) => {
if (!entity) return; if (!entity) return;
data.value = useCardDescription(entity.user.nickname, entity.id); data.value = useCardDescription(entity.user?.nickname, entity.id);
}; };
const openChangePasswordForm = () => changePasswordFormDialog.value.show(); const openChangePasswordForm = () => changePasswordFormDialog.value.show();