Schuldnerauswahlmöglichkeit
This commit is contained in:
parent
02b38cbd8b
commit
f04d75e7c0
@ -86,9 +86,12 @@
|
|||||||
</template>
|
</template>
|
||||||
<template #body-cell-geblecht="props">
|
<template #body-cell-geblecht="props">
|
||||||
<q-td
|
<q-td
|
||||||
v-if="props.row.geblecht.length && witzigeEffekte"
|
v-if="props.row.geblecht.length"
|
||||||
:props="props"
|
:props="props"
|
||||||
class="cursor-pointer ichGehInDieDisko"
|
class="cursor-pointer"
|
||||||
|
:class="{
|
||||||
|
ichGehInDieDisko: witzigeEffekte
|
||||||
|
}"
|
||||||
@click="blechGesprächÖffnen(props.key)"
|
@click="blechGesprächÖffnen(props.key)"
|
||||||
>
|
>
|
||||||
{{ props.value }}
|
{{ props.value }}
|
||||||
@ -139,6 +142,16 @@
|
|||||||
counter
|
counter
|
||||||
outlined
|
outlined
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<q-select
|
||||||
|
v-model="schuldnerAuswähler"
|
||||||
|
multiple
|
||||||
|
class="q-my-md"
|
||||||
|
label="Schuldnerauswahl"
|
||||||
|
outlined
|
||||||
|
use-chips
|
||||||
|
:options="personenAuswahlMöglichkeitenMinusDerBlechner"
|
||||||
|
/>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
|
|
||||||
<q-card-actions vertical>
|
<q-card-actions vertical>
|
||||||
@ -172,12 +185,14 @@
|
|||||||
:rows-per-page-options="[0]"
|
:rows-per-page-options="[0]"
|
||||||
virtual-scroll
|
virtual-scroll
|
||||||
>
|
>
|
||||||
<!-- ZÜRLEDIGEN: Gespräch / Platzen-Hoch mit den einzelnen Blechwerten -->
|
|
||||||
<template #body-cell-geblecht="props">
|
<template #body-cell-geblecht="props">
|
||||||
<q-td
|
<q-td
|
||||||
v-if="props.row.geblecht.length && witzigeEffekte"
|
v-if="props.row.geblecht.length"
|
||||||
:props="props"
|
:props="props"
|
||||||
class="cursor-pointer ichGehInDieDisko"
|
class="cursor-pointer"
|
||||||
|
:class="{
|
||||||
|
ichGehInDieDisko: witzigeEffekte
|
||||||
|
}"
|
||||||
@click="blechGesprächÖffnen(props.key)"
|
@click="blechGesprächÖffnen(props.key)"
|
||||||
>
|
>
|
||||||
{{ props.value }}
|
{{ props.value }}
|
||||||
@ -199,7 +214,7 @@
|
|||||||
v-model="blechGespräch"
|
v-model="blechGespräch"
|
||||||
full-width
|
full-width
|
||||||
>
|
>
|
||||||
<q-card>
|
<q-card full-width>
|
||||||
<q-card-section class="row items-center q-pb-none">
|
<q-card-section class="row items-center q-pb-none">
|
||||||
<q-space />
|
<q-space />
|
||||||
<q-btn
|
<q-btn
|
||||||
@ -219,7 +234,24 @@
|
|||||||
row-key="grund"
|
row-key="grund"
|
||||||
:rows-per-page-options="[0]"
|
:rows-per-page-options="[0]"
|
||||||
virtual-scroll
|
virtual-scroll
|
||||||
/>
|
>
|
||||||
|
<template #body-cell-grund="props">
|
||||||
|
<q-td
|
||||||
|
:props="props"
|
||||||
|
>
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
color="red"
|
||||||
|
size="small"
|
||||||
|
padding="xs"
|
||||||
|
icon="delete"
|
||||||
|
:disabled="!wirdDieShiftTasteGehalten"
|
||||||
|
@click="blechungLöschen(props.rowIndex)"
|
||||||
|
/>
|
||||||
|
{{ props.value }}
|
||||||
|
</q-td>
|
||||||
|
</template>
|
||||||
|
</q-table>
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
</template>
|
</template>
|
||||||
@ -227,13 +259,32 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
// TODO: Multiselect wenn Geld blechen um nur bestimmte Personen mit einzubeziehen
|
// TODO: Multiselect wenn Geld blechen um nur bestimmte Personen mit einzubeziehen
|
||||||
|
|
||||||
import { computed, onMounted, ref } from 'vue';
|
import { computed, onMounted, ref, watch } from 'vue';
|
||||||
|
|
||||||
const personen = ref({});
|
const personen = ref({});
|
||||||
|
|
||||||
const personenNamensEingabeFeld = ref('');
|
const personenNamensEingabeFeld = ref('');
|
||||||
const personenAuswähler = ref(null);
|
const personenAuswähler = ref(null);
|
||||||
|
|
||||||
|
const schuldnerAuswähler = ref(null);
|
||||||
|
const personenAuswahlMöglichkeitenMinusDerBlechner = computed(() => {
|
||||||
|
return personenAuswahlMöglichkeiten.value.filter(nameDerPerson => nameDerPerson !== personenAuswähler.value);
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(personenAuswähler, () => {
|
||||||
|
schuldnerAuswähler.value = personenAuswahlMöglichkeitenMinusDerBlechner.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
const blechungLöschen = (reihenNummerDerBlechung) => {
|
||||||
|
const person = personen.value[blechGesprächPerson.value];
|
||||||
|
|
||||||
|
person.geblecht.splice(reihenNummerDerBlechung, 1);
|
||||||
|
|
||||||
|
if (!person.geblecht.length) {
|
||||||
|
blechGespräch.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const geldEingabeFeld = ref(0.0);
|
const geldEingabeFeld = ref(0.0);
|
||||||
const grundEingabeFeld = ref('');
|
const grundEingabeFeld = ref('');
|
||||||
|
|
||||||
@ -252,10 +303,10 @@ const schuldenDiskoGeschwindigkeit = computed(() => {
|
|||||||
return `${DISKORUTSCHER.value}ms`;
|
return `${DISKORUTSCHER.value}ms`;
|
||||||
});
|
});
|
||||||
|
|
||||||
function blechGesprächÖffnen (nameDerPerson) {
|
const blechGesprächÖffnen = (nameDerPerson) => {
|
||||||
blechGespräch.value = true;
|
blechGespräch.value = true;
|
||||||
blechGesprächPerson.value = nameDerPerson;
|
blechGesprächPerson.value = nameDerPerson;
|
||||||
}
|
};
|
||||||
|
|
||||||
const blechGesprächZeilen = computed(() => {
|
const blechGesprächZeilen = computed(() => {
|
||||||
if (!blechGesprächPerson.value) return [];
|
if (!blechGesprächPerson.value) return [];
|
||||||
@ -312,6 +363,7 @@ function geldBlechen () {
|
|||||||
p.geblecht.push({
|
p.geblecht.push({
|
||||||
grund: grundEingabeFeld.value,
|
grund: grundEingabeFeld.value,
|
||||||
geld: geldEingabeFeld.value,
|
geld: geldEingabeFeld.value,
|
||||||
|
schuldner: schuldnerAuswähler.value,
|
||||||
});
|
});
|
||||||
|
|
||||||
grundEingabeFeld.value = '';
|
grundEingabeFeld.value = '';
|
||||||
@ -320,10 +372,22 @@ function geldBlechen () {
|
|||||||
speicherLeute();
|
speicherLeute();
|
||||||
}
|
}
|
||||||
|
|
||||||
function blechSumme (gesamtBlech) {
|
function blechSumme (blechListe, nameDerPerson = false) {
|
||||||
let gesamtBlechGeld = 0;
|
let gesamtBlechGeld = 0;
|
||||||
|
|
||||||
for (const blech of gesamtBlech) gesamtBlechGeld += blech.geld;
|
// / Object.keys(personen.value).length;
|
||||||
|
|
||||||
|
for (const blech of blechListe) {
|
||||||
|
if (!nameDerPerson) {
|
||||||
|
gesamtBlechGeld += blech.geld;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!blech.schuldner.includes(nameDerPerson)) continue;
|
||||||
|
|
||||||
|
// + 1, da wir uns selber ja auch mit einbeziehen
|
||||||
|
gesamtBlechGeld += blech.geld / (blech.schuldner.length + 1);
|
||||||
|
}
|
||||||
|
|
||||||
return gesamtBlechGeld;
|
return gesamtBlechGeld;
|
||||||
}
|
}
|
||||||
@ -344,6 +408,13 @@ const blechGesprächSpalten = [
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
format: (reihenWert) => reihenWert ? `${gleitzahlenAnalysierer(reihenWert) || '0.00'} €` : '',
|
format: (reihenWert) => reihenWert ? `${gleitzahlenAnalysierer(reihenWert) || '0.00'} €` : '',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'schuldner',
|
||||||
|
label: 'Schuldner',
|
||||||
|
field: 'schuldner',
|
||||||
|
sortable: false,
|
||||||
|
format: (reihenWert) => reihenWert.join(', '),
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const tabellenSpalten = computed(() => {
|
const tabellenSpalten = computed(() => {
|
||||||
@ -370,12 +441,6 @@ const tabellenSpalten = computed(() => {
|
|||||||
name: `an-${name}`,
|
name: `an-${name}`,
|
||||||
label: `An ${name}`,
|
label: `An ${name}`,
|
||||||
classes: reihe => witzigeEffekte.value && reihe.an[name] ? 'duMusstNochGeldZahlenDuLackaffe' : '',
|
classes: reihe => witzigeEffekte.value && reihe.an[name] ? 'duMusstNochGeldZahlenDuLackaffe' : '',
|
||||||
// classes: reihe => {
|
|
||||||
// if (!witzigeEffekte.value) return '';
|
|
||||||
// if (!reihe.an[name]) return '';
|
|
||||||
|
|
||||||
// return DISKOMODUS.value ? 'ZAHLMIRENDLICHDASGELDDUAFFE' : 'duMusstNochGeldZahlenDuLackaffe';
|
|
||||||
// },
|
|
||||||
field: reihe => reihe.an[name],
|
field: reihe => reihe.an[name],
|
||||||
format: (reihenWert) => reihenWert ? `${gleitzahlenAnalysierer(reihenWert) || '0.00'} €` : '',
|
format: (reihenWert) => reihenWert ? `${gleitzahlenAnalysierer(reihenWert) || '0.00'} €` : '',
|
||||||
});
|
});
|
||||||
@ -402,7 +467,7 @@ function reihenRechner () {
|
|||||||
for(const [nameDerAnderenPerson, datenDerAnderenPerson] of personenEinträge) {
|
for(const [nameDerAnderenPerson, datenDerAnderenPerson] of personenEinträge) {
|
||||||
if (name === nameDerAnderenPerson) continue;
|
if (name === nameDerAnderenPerson) continue;
|
||||||
|
|
||||||
const blechTeiler = blechSumme(datenDerAnderenPerson.geblecht) / Object.keys(personen.value).length;
|
const blechTeiler = blechSumme(datenDerAnderenPerson.geblecht, name); // / Object.keys(personen.value).length;
|
||||||
personenObjekt.an[nameDerAnderenPerson] = blechTeiler;
|
personenObjekt.an[nameDerAnderenPerson] = blechTeiler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user