Konto: Phrases

This commit is contained in:
cgfhtw
2024-04-25 11:36:37 +02:00
parent 1b19a0821f
commit f47f8d5da4
6 changed files with 817 additions and 163 deletions
@@ -3,7 +3,6 @@ import FormInput from "../../../Form/Input.js";
import KontoNew from "./Konto/New.js";
import KontoEdit from "./Konto/Edit.js";
// TODO(chris): Phrasen
export default {
components: {
@@ -52,130 +51,46 @@ export default {
}
},
tabulatorColumns() {
let columns = [];
if (Array.isArray(this.modelValue)) {
columns.push({
field: "person_id",
title: "Person ID"
});
columns.push({
field: "anrede",
title: "Anrede",
visible: false
});
columns.push({
field: "titelpost",
title: "Titelpost",
visible: false
});
columns.push({
field: "titelpre",
title: "Titelpre",
visible: false
});
columns.push({
field: "vorname",
title: "Vorname"
});
columns.push({
field: "vornamen",
title: "Vornamen",
visible: false
});
columns.push({
field: "nachname",
title: "Nachname"
});
}
const columns = { ...this.config.columns };
if (!columns.actions)
columns.actions = {
title: '',
frozen: true
};
columns.actions.formatter = cell => {
let container = document.createElement('div');
container.className = "d-flex gap-2";
columns = [...columns, ...[
{
field: "buchungsdatum",
title: "Buchungsdatum"
},
{
field: "buchungstext",
title: "Buchungstext"
},
{
field: "betrag",
title: "Betrag"
},
{
field: "studiensemester_kurzbz",
title: "StSem"
},
{
field: "buchungstyp_kurzbz",
title: "Typ",
visible: false
},
{
field: "buchungsnr",
title: "Buchungs Nr",
visible: false
},
{
field: "insertvon",
title: "Angelegt von",
visible: false
},
{
field: "insertamum",
title: "Anlagedatum",
visible: false
},
{
field: "kuerzel",
title: "Studiengang",
visible: false
},
{
field: "anmerkung",
title: "Anmerkung"
}
]];
let button = document.createElement('button');
button.className = 'btn btn-outline-secondary';
button.innerHTML = '<i class="fa fa-edit"></i>';
button.addEventListener('click', () =>
this.$refs.edit.open(cell.getData())
);
container.append(button);
columns = [...columns, ...this.config.additionalCols];
button = document.createElement('button');
button.className = 'btn btn-outline-secondary';
button.innerHTML = '<i class="fa fa-trash"></i>';
button.addEventListener('click', evt => {
evt.stopPropagation();
this.$fhcAlert
.confirmDelete()
.then(result => result ? cell.getData().buchungsnr : Promise.reject({handled:true}))
.then(this.$fhcApi.factory.stv.konto.delete)
.then(() => {
// TODO(chris): deleting a child also removes the siblings!
//cell.getRow().delete();
this.reload();
})
.catch(this.$fhcAlert.handleSystemError);
});
container.append(button);
columns.push({
title: 'Actions',
formatter: cell => {
let container = document.createElement('div');
container.className = "d-flex gap-2";
return container;
};
let button = document.createElement('button');
button.className = 'btn btn-outline-secondary';
button.innerHTML = '<i class="fa fa-edit"></i>';
button.addEventListener('click', () =>
this.$refs.edit.open(cell.getData())
);
container.append(button);
button = document.createElement('button');
button.className = 'btn btn-outline-secondary';
button.innerHTML = '<i class="fa fa-trash"></i>';
button.addEventListener('click', evt => {
evt.stopPropagation();
this.$fhcAlert
.confirmDelete()
.then(result => result ? cell.getData().buchungsnr : Promise.reject({handled:true}))
.then(this.$fhcApi.factory.stv.konto.delete)
.then(() => {
// TODO(chris): deleting a child also removes the siblings!
//cell.getRow().delete();
this.reload();
})
.catch(this.$fhcAlert.handleSystemError);
});
container.append(button);
return container;
},
frozen: true
});
return columns;
return Object.values(columns);
},
tabulatorOptions() {
return this.$fhcApi.factory.stv.konto.tabulatorConfig({
@@ -214,7 +129,7 @@ export default {
})
.then(result => result.data)
.then(this.updateData)
.then(() => 'Daten wurden gespeichert')
.then(() => this.$p.t('ui/gespeichert'))
.then(this.$fhcAlert.alertSuccess)
.catch(this.$fhcAlert.handleSystemError);
},
@@ -263,7 +178,7 @@ export default {
<form-input
container-class="form-switch"
type="checkbox"
label="Nur offene anzeigen"
:label="$p.t('stv/konto_filter_open')"
v-model="filter"
@update:model-value="() => $nextTick($refs.table.reloadTable)"
>
@@ -273,7 +188,7 @@ export default {
<form-input
container-class="form-switch"
type="checkbox"
label="Nur aktuellen Stg anzeigen"
:label="$p.t('stv/konto_filter_current_stg')"
v-model="studiengang_kz_intern"
:disabled="!stg_kz"
@update:model-value="() => $nextTick($refs.table.reloadTable)"
@@ -288,7 +203,7 @@ export default {
:tabulator-options="tabulatorOptions"
reload
new-btn-show
new-btn-label="Buchung"
:new-btn-label="$p.t('konto/buchung')"
:new-btn-disabled="stg_kz === ''"
@click:new="actionNew"
>
@@ -308,7 +223,7 @@ export default {
@click="actionCounter(selected)"
:disabled="!selected.length"
>
Gegenbuchen
{{ $p.t('stv/konto_counter') }}
</button>
</div>
<button
@@ -317,7 +232,7 @@ export default {
@click="downloadPdf(selected)"
:disabled="!selected.length"
>
<i class="fa fa-download"></i> Zahlungsbestaetigung
<i class="fa fa-download"></i> {{ $p.t('stv/konto_payment_confirmation') }}
</button>
</template>
</core-filter-cmpt>
@@ -2,6 +2,7 @@ import {CoreFilterCmpt} from "../../filter/Filter.js";
import {CoreRESTClient} from '../../../RESTClient.js';
import ListNew from './List/New.js';
export default {
components: {
CoreFilterCmpt,
@@ -205,14 +206,14 @@ export default {
:side-menu="false"
reload
new-btn-show
new-btn-label="InteressentIn"
:new-btn-label="$p.t('stv/action_new')"
@click:new="actionNewPrestudent"
>
<template #filter>
<div class="card">
<div class="card-body">
<div class="input-group mb-3">
<label class="input-group-text col-4" for="stv-list-filter-konto-count-0">Liste filtern auf nicht belastet:</label>
<label class="input-group-text col-4" for="stv-list-filter-konto-count-0">{{ $p.t('stv/konto_filter_count_0') }}</label>
<select class="form-select" id="stv-list-filter-konto-count-0" v-model="filterKontoCount0" @input="$nextTick(updateUrl)">
<option v-for="typ in lists.buchungstypen" :key="typ.buchungstyp_kurzbz" :value="typ.buchungstyp_kurzbz">
{{ typ.beschreibung }}
@@ -223,9 +224,9 @@ export default {
</button>
</div>
<div class="input-group">
<label class="input-group-text col-4" for="stv-list-filter-konto-missing-counter">Liste filtern auf fehlende Gegenbuchungen:</label>
<label class="input-group-text col-4" for="stv-list-filter-konto-missing-counter">{{ $p.t('stv/konto_filter_missing_counter') }}</label>
<select class="form-select" id="stv-list-filter-konto-missing-counter" v-model="filterKontoMissingCounter" @input="$nextTick(updateUrl)">
<option value="alle">alle Buchungstypen</option>
<option value="alle">{{ $p.t('stv/konto_all_types') }}</option>
<option v-for="typ in lists.buchungstypen" :key="typ.buchungstyp_kurzbz" :value="typ.buchungstyp_kurzbz">
{{ typ.beschreibung }}
</option>