diff --git a/public/js/components/Betriebsmittel/Betriebsmittel.js b/public/js/components/Betriebsmittel/Betriebsmittel.js index 2c88448d3..148d7a83c 100644 --- a/public/js/components/Betriebsmittel/Betriebsmittel.js +++ b/public/js/components/Betriebsmittel/Betriebsmittel.js @@ -43,22 +43,7 @@ export default { }, data() { return { - listBetriebsmitteltyp: [], - formData: { - ausgegebenam : new Date(), - betriebsmitteltyp: 'Zutrittskarte' - }, - statusNew: true, - filteredInventar: [], - layout: 'fitColumns', - layoutColumnsOnNewData: false, - height: '550', - persistenceID: 'core-betriebsmittel' - } - }, - computed: { - tabulatorOptions() { - const options = { + tabulatorOptions: { ajaxURL: 'dummy', ajaxRequestFunc: () => this.$api.call( this.endpoint.getAllBetriebsmittel(this.typeId, this.id, (this.filterByProvidedTypes ? this.betriebsmittelTypes : null)) @@ -130,7 +115,7 @@ export default { '/content/pdfExport.php?xml=betriebsmittelperson.rdf.php&xsl=Uebernahme&id=' + cellData.betriebsmittelperson_id + '&output=pdf'; window.open(linkToPdf, '_blank'); - }); + }); container.append(button); button = document.createElement('button'); @@ -158,13 +143,13 @@ export default { return container; }, frozen: true - } - ], - }; - return options; - }, - tabulatorEvents() { - const events = [ + }], + layout: 'fitColumns', + layoutColumnsOnNewData: false, + height: '550', + persistenceID: 'core-betriebsmittel' + }, + tabulatorEvents: [ { event: 'tableBuilt', handler: async() => { @@ -208,8 +193,14 @@ export default { }); } } - ]; - return events; + ], + listBetriebsmitteltyp: [], + formData: { + ausgegebenam : new Date(), + betriebsmitteltyp: 'Zutrittskarte' + }, + statusNew: true, + filteredInventar: [] } }, watch: { diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Abschlusspruefung/Abschlusspruefung.js b/public/js/components/Stv/Studentenverwaltung/Details/Abschlusspruefung/Abschlusspruefung.js index da938b063..d46e1f299 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Abschlusspruefung/Abschlusspruefung.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Abschlusspruefung/Abschlusspruefung.js @@ -34,58 +34,40 @@ export default { default: false } }, + computed: { + studentUids() { + if (this.student.uid) + { + return [this.student.uid]; + } + return this.student.map(e => e.uid); + }, + studentKzs(){ + if (this.student.uid) + { + return [this.student.studiengang_kz]; + } + return this.student.map(e => e.studiengang_kz); + }, + stg_kz(){ + return this.studentKzs[0]; + }, + showAllFormats() { + if( this.isBerechtigtDocAndOdt === false + || !Array.isArray(this.isBerechtigtDocAndOdt) ) + { + return false; + } + let retval = this.isBerechtigtDocAndOdt.includes(this.stgInfo.oe_kurzbz); + return retval; + } + }, props: { student: Object }, data() { return { - tabulatorData: [], - lastSelected: null, - formData: { - typStg: null, - pruefungstyp_kurzbz: null, - akadgrad_id: null, - vorsitz: null, - pruefungsantritt_kurzbz: null, - abschlussbeurteilung_kurzbz: null, - datum: null, - sponsion: null, - pruefer1: null, - pruefer2: null, - pruefer3: null, - anmerkung: null, - protokoll: null, - note: null, - link: null - }, - statusNew: true, - arrTypen: [], - arrAntritte: [], - arrBeurteilungen: [], - arrAkadGrad: [], - arrNoten: [], - selectedVorsitz: null, - filteredMitarbeiter: [], - filteredPersons: [], - selectedPruefer1: null, - selectedPruefer2: null, - selectedPruefer3: null, - stgInfo: { typ: '', oe_kurzbz: '' }, - abortController: { - mitarbeiter: null, - persons: null - }, - layout: 'fitDataStretchFrozen', - layoutColumnsOnNewData: false, - height: 'auto', - minHeight: '200', - index: 'abschlusspruefung_id', - persistenceID: 'stv-details-finalexam-2025112401' - } - }, - computed: { - tabulatorOptions() { - const options = { + tabulatorOptions: { ajaxURL: 'dummy', ajaxRequestFunc: () => this.$api.call(ApiStvAbschlusspruefung.getAbschlusspruefung(this.student.uid)), ajaxResponse: (url, params, response) => response.data, @@ -181,11 +163,14 @@ export default { frozen: true }, ], - }; - return options; - }, - tabulatorEvents() { - const events = [ + layout: 'fitDataStretchFrozen', + layoutColumnsOnNewData: false, + height: 'auto', + minHeight: '200', + index: 'abschlusspruefung_id', + persistenceID: 'stv-details-finalexam-2025112401' + }, + tabulatorEvents: [ { event: 'dataLoaded', handler: data => this.tabulatorData = data.map(item => { @@ -240,36 +225,50 @@ export default { cm.getColumnByField('abschlusspruefung_id').component.updateDefinition({ title: this.$p.t('abschlusspruefung', 'abschlusspruefung_id') }); + /* + cm.getColumnByField('actions').component.updateDefinition({ + title: this.$p.t('global', 'aktionen') + }); + */ } } - ]; - return events; - }, - studentUids() { - if (this.student.uid) - { - return [this.student.uid]; - } - return this.student.map(e => e.uid); - }, - studentKzs(){ - if (this.student.uid) - { - return [this.student.studiengang_kz]; - } - return this.student.map(e => e.studiengang_kz); - }, - stg_kz(){ - return this.studentKzs[0]; - }, - showAllFormats() { - if( this.isBerechtigtDocAndOdt === false - || !Array.isArray(this.isBerechtigtDocAndOdt) ) - { - return false; - } - let retval = this.isBerechtigtDocAndOdt.includes(this.stgInfo.oe_kurzbz); - return retval; + ], + tabulatorData: [], + lastSelected: null, + formData: { + typStg: null, + pruefungstyp_kurzbz: null, + akadgrad_id: null, + vorsitz: null, + pruefungsantritt_kurzbz: null, + abschlussbeurteilung_kurzbz: null, + datum: null, + sponsion: null, + pruefer1: null, + pruefer2: null, + pruefer3: null, + anmerkung: null, + protokoll: null, + note: null, + link: null + }, + statusNew: true, + arrTypen: [], + arrAntritte: [], + arrBeurteilungen: [], + arrAkadGrad: [], + arrNoten: [], + selectedVorsitz: null, + filteredMitarbeiter: [], + filteredPersons: [], + selectedPruefer1: null, + selectedPruefer2: null, + selectedPruefer3: null, + stgInfo: { typ: '', oe_kurzbz: '' }, + abortController: { + mitarbeiter: null, + persons: null + }, } }, watch: { diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Anrechnungen/Anrechnungen.js b/public/js/components/Stv/Studentenverwaltung/Details/Anrechnungen/Anrechnungen.js index 32224062d..a2029b0b9 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Anrechnungen/Anrechnungen.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Anrechnungen/Anrechnungen.js @@ -31,24 +31,7 @@ export default { }, data() { return { - formData: {}, - listBegruendungen: [], - listNewLehrveranstaltungen: [], - listLektoren: [], - listKompatibleLehrveranstaltungen: [], - statusNew: true, - showNotizen: false, - currentAnrechnung_id: null, - endpoint: ApiNotizPerson, - layout: 'fitDataStretchFrozen', - height: '500', - index: 'anrechnung_id', - persistenceID: 'stv-details-anrechnungen-2025112401' - } - }, - computed: { - tabulatorOptions() { - const options = { + tabulatorOptions: { ajaxURL: 'dummy', ajaxRequestFunc: () => this.$api.call( ApiStvExemptions.getAnrechnungen(this.student.prestudent_id) @@ -124,11 +107,12 @@ export default { frozen: true }, ], - }; - return options; - }, - tabulatorEvents() { - const events = [ + layout: 'fitDataStretchFrozen', + height: '500', + index: 'anrechnung_id', + persistenceID: 'stv-details-anrechnungen-2025112401' + }, + tabulatorEvents: [ { event: 'tableBuilt', handler: async () => { @@ -170,8 +154,16 @@ export default { } } - ]; - return events; + ], + formData: {}, + listBegruendungen: [], + listNewLehrveranstaltungen: [], + listLektoren: [], + listKompatibleLehrveranstaltungen: [], + statusNew: true, + showNotizen: false, + currentAnrechnung_id: null, + endpoint: ApiNotizPerson } }, watch: { diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/Aufnahmetermine.js b/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/Aufnahmetermine.js index b2ba26a55..d03569df4 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/Aufnahmetermine.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/Aufnahmetermine.js @@ -36,19 +36,158 @@ export default { }, data() { return { + tabulatorOptions: { + ajaxURL: 'dummy', + ajaxRequestFunc: () => this.$api.call( + ApiStvAdmissionDates.getAufnahmetermine(this.student.person_id) + ), + ajaxResponse: (url, params, response) => response.data, + columns: [ + {title: "rt_id", field: "rt_id", visible: false}, + {title: "rt_person_id", field: "rt_person_id", visible: false}, + {title: "person_id", field: "person_id", visible: false}, + {title: "datum", field: "datum", + formatter: function (cell) { + const dateStr = cell.getValue(); + if (!dateStr) return ""; + + const date = new Date(dateStr); + return date.toLocaleString("de-DE", { + day: "2-digit", + month: "2-digit", + year: "numeric", + }); + } + }, + {title: "stufe", field: "stufe"}, + {title: "studiensemester", field: "studiensemester"}, + {title: "anmerkung", field: "anmerkung", visible: false}, + {title: "anmeldedatum", field: "anmeldedatum", visible: false, + formatter: function (cell) { + const dateStr = cell.getValue(); + if (!dateStr) return ""; + + const date = new Date(dateStr); + return date.toLocaleString("de-DE", { + day: "2-digit", + month: "2-digit", + year: "numeric", + }); + } + }, + {title: "punkte", field: "punkte"}, + { + title: "teilgenommen", field: "teilgenommen", + formatter: "tickCross", + hozAlign: "center", + formatterParams: { + tickElement: '', + crossElement: '' + } + }, + {title: "ort", field: "ort", visible: false}, + {title: "studienplan", field: "studienplan", visible: false}, + {title: "studienplan_id", field: "studienplan_id", visible: false}, + {title: "stg", field: "studiengangkurzbzlang"}, + {title: "Stg", field: "stg_kuerzel"}, + { + title: 'Aktionen', field: 'actions', + minWidth: 150, // Ensures Action-buttons will be always fully displayed + formatter: (cell, formatterParams, onRendered) => { + let container = document.createElement('div'); + container.className = "d-flex gap-2"; + + let button = document.createElement('button'); + button.className = 'btn btn-outline-secondary btn-action'; + button.innerHTML = ''; + button.title = this.$p.t('ui', 'bearbeiten'); + button.addEventListener('click', (event) => + this.actionEditPlacementTest(cell.getData().rt_person_id) + ); + container.append(button); + + button = document.createElement('button'); + button.className = 'btn btn-outline-secondary btn-action'; + button.innerHTML = ''; + button.title = this.$p.t('ui', 'loeschen'); + button.addEventListener('click', () => + this.actionDeletePlacementTest(cell.getData().rt_person_id) + ); + container.append(button); + + return container; + }, + frozen: true + } + ], + layout: 'fitDataStretchFrozen', + layoutColumnsOnNewData: false, + height: 'auto', + minHeight: 200, + index: 'aufnahmetermin_id', + persistenceID: 'stv-details-table_admission-dates-2025112401' + }, + tabulatorEvents: [ + { + event: 'tableBuilt', + handler: async () => { + await this.$p.loadCategory(['admission', 'global', 'person', 'ui', 'projektarbeitsbeurteilung']); + let cm = this.$refs.table.tabulator.columnManager; + + cm.getColumnByField('rt_id').component.updateDefinition({ + title: this.$p.t('ui', 'reihungstest_id') + }); + cm.getColumnByField('rt_person_id').component.updateDefinition({ + title: this.$p.t('ui', 'reihungstest_person_id') + }); + cm.getColumnByField('person_id').component.updateDefinition({ + title: this.$p.t('person', 'person_id') + }); + cm.getColumnByField('datum').component.updateDefinition({ + title: this.$p.t('global', 'datum') + }); + cm.getColumnByField('stufe').component.updateDefinition({ + title: this.$p.t('admission', 'stufe') + }); + cm.getColumnByField('studiensemester').component.updateDefinition({ + title: this.$p.t('lehre', 'studiensemester') + }); + cm.getColumnByField('anmerkung').component.updateDefinition({ + title: this.$p.t('global', 'anmerkung') + }); + cm.getColumnByField('anmeldedatum').component.updateDefinition({ + title: this.$p.t('admission', 'anmeldedatum') + }); + cm.getColumnByField('punkte').component.updateDefinition({ + title: this.$p.t('exam', 'punkte') + }); + cm.getColumnByField('teilgenommen').component.updateDefinition({ + title: this.$p.t('admission', 'teilgenommen') + }); + cm.getColumnByField('ort').component.updateDefinition({ + title: this.$p.t('person', 'ort') + }); + cm.getColumnByField('studienplan').component.updateDefinition({ + title: this.$p.t('lehre', 'studienplan') + }); + cm.getColumnByField('studienplan_id').component.updateDefinition({ + title: this.$p.t('ui', 'studienplan_id') + }); + cm.getColumnByField('studiengangkurzbzlang').component.updateDefinition({ + title: this.$p.t('projektarbeitsbeurteilung', 'studiengang') + }); + cm.getColumnByField('stg_kuerzel').component.updateDefinition({ + title: this.$p.t('admission', 'stg_kurz') + }); + } + } + ], formData: {}, statusNew: true, listPlacementTests: [], listStudyPlans: [], filterOnlyFutureTestsSet: false, - filteredPlacementTests: [], - //data after tabulator data - layout: 'fitDataStretchFrozen', - layoutColumnsOnNewData: false, - height: 'auto', - minHeight: 200, - index: 'aufnahmetermin_id', - persistenceID: 'stv-details-table_admission-dates-2025112401' + filteredPlacementTests: [] } }, methods: { @@ -193,155 +332,6 @@ export default { this.formData = {}; }, }, - computed: { - tabulatorOptions() { - const options = { - ajaxURL: 'dummy', - ajaxRequestFunc: () => this.$api.call( - ApiStvAdmissionDates.getAufnahmetermine(this.student.person_id) - ), - ajaxResponse: (url, params, response) => response.data, - columns: [ - {title: "rt_id", field: "rt_id", visible: false}, - {title: "rt_person_id", field: "rt_person_id", visible: false}, - {title: "person_id", field: "person_id", visible: false}, - {title: "datum", field: "datum", - formatter: function (cell) { - const dateStr = cell.getValue(); - if (!dateStr) return ""; - - const date = new Date(dateStr); - return date.toLocaleString("de-DE", { - day: "2-digit", - month: "2-digit", - year: "numeric", - }); - } - }, - {title: "stufe", field: "stufe"}, - {title: "studiensemester", field: "studiensemester"}, - {title: "anmerkung", field: "anmerkung", visible: false}, - {title: "anmeldedatum", field: "anmeldedatum", visible: false, - formatter: function (cell) { - const dateStr = cell.getValue(); - if (!dateStr) return ""; - - const date = new Date(dateStr); - return date.toLocaleString("de-DE", { - day: "2-digit", - month: "2-digit", - year: "numeric", - }); - } - }, - {title: "punkte", field: "punkte"}, - { - title: "teilgenommen", field: "teilgenommen", - formatter: "tickCross", - hozAlign: "center", - formatterParams: { - tickElement: '', - crossElement: '' - } - }, - {title: "ort", field: "ort", visible: false}, - {title: "studienplan", field: "studienplan", visible: false}, - {title: "studienplan_id", field: "studienplan_id", visible: false}, - {title: "stg", field: "studiengangkurzbzlang"}, - {title: "Stg", field: "stg_kuerzel"}, - { - title: 'Aktionen', field: 'actions', - minWidth: 150, // Ensures Action-buttons will be always fully displayed - formatter: (cell, formatterParams, onRendered) => { - let container = document.createElement('div'); - container.className = "d-flex gap-2"; - - let button = document.createElement('button'); - button.className = 'btn btn-outline-secondary btn-action'; - button.innerHTML = ''; - button.title = this.$p.t('ui', 'bearbeiten'); - button.addEventListener('click', (event) => - this.actionEditPlacementTest(cell.getData().rt_person_id) - ); - container.append(button); - - button = document.createElement('button'); - button.className = 'btn btn-outline-secondary btn-action'; - button.innerHTML = ''; - button.title = this.$p.t('ui', 'loeschen'); - button.addEventListener('click', () => - this.actionDeletePlacementTest(cell.getData().rt_person_id) - ); - container.append(button); - - return container; - }, - frozen: true - } - ], - }; - return options; - }, - tabulatorEvents() { - const events = [ - { - event: 'tableBuilt', - handler: async () => { - await this.$p.loadCategory(['admission', 'global', 'person', 'ui', 'projektarbeitsbeurteilung']); - let cm = this.$refs.table.tabulator.columnManager; - - cm.getColumnByField('rt_id').component.updateDefinition({ - title: this.$p.t('ui', 'reihungstest_id') - }); - cm.getColumnByField('rt_person_id').component.updateDefinition({ - title: this.$p.t('ui', 'reihungstest_person_id') - }); - cm.getColumnByField('person_id').component.updateDefinition({ - title: this.$p.t('person', 'person_id') - }); - cm.getColumnByField('datum').component.updateDefinition({ - title: this.$p.t('global', 'datum') - }); - cm.getColumnByField('stufe').component.updateDefinition({ - title: this.$p.t('admission', 'stufe') - }); - cm.getColumnByField('studiensemester').component.updateDefinition({ - title: this.$p.t('lehre', 'studiensemester') - }); - cm.getColumnByField('anmerkung').component.updateDefinition({ - title: this.$p.t('global', 'anmerkung') - }); - cm.getColumnByField('anmeldedatum').component.updateDefinition({ - title: this.$p.t('admission', 'anmeldedatum') - }); - cm.getColumnByField('punkte').component.updateDefinition({ - title: this.$p.t('exam', 'punkte') - }); - cm.getColumnByField('teilgenommen').component.updateDefinition({ - title: this.$p.t('admission', 'teilgenommen') - }); - cm.getColumnByField('ort').component.updateDefinition({ - title: this.$p.t('person', 'ort') - }); - cm.getColumnByField('studienplan').component.updateDefinition({ - title: this.$p.t('lehre', 'studienplan') - }); - cm.getColumnByField('studienplan_id').component.updateDefinition({ - title: this.$p.t('ui', 'studienplan_id') - }); - cm.getColumnByField('studiengangkurzbzlang').component.updateDefinition({ - title: this.$p.t('projektarbeitsbeurteilung', 'studiengang') - }); - cm.getColumnByField('stg_kuerzel').component.updateDefinition({ - title: this.$p.t('admission', 'stg_kurz') - }); - } - } - ]; - - return events; - } - }, created() { this.$api .call(ApiStvAdmissionDates.getListPlacementTests(this.student.prestudent_id)) diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/AddressOld.js b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/AddressOld.js deleted file mode 100644 index 7ed448cfd..000000000 --- a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/AddressOld.js +++ /dev/null @@ -1,622 +0,0 @@ -import {CoreFilterCmpt} from "../../../../filter/Filter.js"; -import PvAutoComplete from "../../../../../../../index.ci.php/public/js/components/primevue/autocomplete/autocomplete.esm.min.js"; -import FhcFormValidation from '../../../../Form/Validation.js'; -import BsModal from "../../../../Bootstrap/Modal.js"; -import FormForm from '../../../../Form/Form.js'; -import FormInput from '../../../../Form/Input.js'; - -import ApiStvAddress from '../../../../../api/factory/stv/kontakt/address.js'; -import ApiStvCompany from '../../../../../api/factory/stv/kontakt/company.js'; - -export default{ - name: 'AddressComponent', - components: { - CoreFilterCmpt, - PvAutoComplete, - FhcFormValidation, - BsModal, - FormForm, - FormInput - }, - props: { - uid: Number - }, - data() { - return { - tabulatorOptions: { - ajaxURL: 'dummy', - ajaxRequestFunc: () => this.$api.call(ApiStvAddress.get(this.uid)), - ajaxResponse: (url, params, response) => response.data, - //autoColumns: true, - columns:[ - {title:"Typ", field:"bezeichnung"}, - {title:"Strasse", field:"strasse"}, - {title:"Plz", field:"plz"}, - {title:"Ort", field:"ort"}, - {title:"Gemeinde", field:"gemeinde"}, - {title:"Nation", field:"nation"}, - { - title:"Heimatadresse", - field:"heimatadresse", - formatter:"tickCross", - hozAlign:"center", - formatterParams: { - tickElement: '', - crossElement: '' - } - }, - { - title:"Zustelladresse", - field:"zustelladresse", - formatter:"tickCross", - hozAlign:"center", - formatterParams: { - tickElement: '', - crossElement: '' - } - }, - {title:"Abweich.Empf", field:"co_name"}, - {title:"Firma", field:"firmenname"}, - {title:"Firma_id", field:"firma_id", visible:false}, - {title:"Adresse_id", field:"adresse_id", visible:false}, - {title:"Person_id", field:"person_id", visible:false}, - {title:"Name", field:"name", visible:false}, - { - title:"letzte Änderung", - field:"lastupdate", - visible: false, - formatter: function (cell) { - const dateStr = cell.getValue(); - if (!dateStr) return ""; - - const date = new Date(dateStr); - return date.toLocaleString("de-DE", { - day: "2-digit", - month: "2-digit", - year: "numeric", - hour: "2-digit", - minute: "2-digit", - second: "2-digit", - hour12: false - }); - } - }, - {title:"Rechnungsadresse", field:"rechnungsadresse", visible:false, - formatter: (cell, formatterParams, onRendered) => { - let output = cell.getValue() ? this.$p.t('ui','ja') : this.$p.t('ui','nein'); - return output; - } - }, - {title:"Anmerkung", field:"anmerkung", visible:false}, - {title: 'Aktionen', field: 'actions', - minWidth: 150, // Ensures Action-buttons will be always fully displayed - formatter: (cell, formatterParams, onRendered) => { - let container = document.createElement('div'); - container.className = "d-flex gap-2"; - - let button = document.createElement('button'); - button.className = 'btn btn-outline-secondary btn-action'; - button.innerHTML = ''; - button.title = this.$p.t('person', 'adresse_edit'); - button.addEventListener('click', (event) => - this.actionEditAdress(cell.getData().adresse_id) - ); - container.append(button); - - button = document.createElement('button'); - button.className = 'btn btn-outline-secondary btn-action'; - button.innerHTML = ''; - button.title = this.$p.t('person', 'adresse_delete'); - - button.addEventListener('click', () => { - if (cell.getData().heimatadresse) - this.$fhcAlert.alertError(this.$p.t('person', 'error_deleteHomeAdress')); - else - this.actionDeleteAdress(cell.getData().adresse_id) - }); - - container.append(button); - - return container; - }, - frozen: true - }, - ], - height: 'auto', - index: 'adresse_id', - persistenceID: 'stv-details-kontakt-address' - }, - tabulatorEvents: [ - { - event: 'tableBuilt', - handler: async () => { - await this.$p.loadCategory(['notiz', 'global', 'person', 'ui']); - let cm = this.$refs.table.tabulator.columnManager; - - cm.getColumnByField('bezeichnung').component.updateDefinition({ - title: this.$p.t('global', 'typ') - }); - cm.getColumnByField('strasse').component.updateDefinition({ - title: this.$p.t('person', 'strasse') - }); - cm.getColumnByField('plz').component.updateDefinition({ - title: this.$p.t('person', 'plz') - }); - cm.getColumnByField('ort').component.updateDefinition({ - title: this.$p.t('person', 'ort') - }); - cm.getColumnByField('gemeinde').component.updateDefinition({ - title: this.$p.t('person', 'gemeinde') - }); - cm.getColumnByField('nation').component.updateDefinition({ - title: this.$p.t('person', 'nation') - }); - cm.getColumnByField('heimatadresse').component.updateDefinition({ - title: this.$p.t('person', 'heimatadresse') - }); - cm.getColumnByField('zustelladresse').component.updateDefinition({ - title: this.$p.t('person', 'zustelladresse') - }); - cm.getColumnByField('co_name').component.updateDefinition({ - title: this.$p.t('person', 'co_name') - }); - cm.getColumnByField('name').component.updateDefinition({ - title: this.$p.t('person', 'firma_zusatz') - }); - cm.getColumnByField('firmenname').component.updateDefinition({ - title: this.$p.t('person', 'firma') - }); - cm.getColumnByField('lastupdate').component.updateDefinition({ - title: this.$p.t('notiz', 'letzte_aenderung') - }); - cm.getColumnByField('rechnungsadresse').component.updateDefinition({ - title: this.$p.t('person', 'rechnungsadresse') - }); - cm.getColumnByField('anmerkung').component.updateDefinition({ - title: this.$p.t('global', 'anmerkung') - }); - cm.getColumnByField('firma_id').component.updateDefinition({ - title: this.$p.t('ui', 'firma_id') - }); - cm.getColumnByField('adresse_id').component.updateDefinition({ - title: this.$p.t('ui', 'adresse_id') - }); - cm.getColumnByField('person_id').component.updateDefinition({ - title: this.$p.t('person', 'person_id') - }); - /* cm.getColumnByField('actions').component.updateDefinition({ - title: this.$p.t('global', 'aktionen') - });*/ - } - } - ], - addressData: { - zustelladresse: true, - heimatadresse: true, - rechnungsadresse: false, - typ: 'h', - nation: 'A', - address: {plz: null}, - plz: null, - }, - statusNew: true, - places: [], - suggestions: {}, - nations: [], - adressentypen: [], - firmen: [], - listFirmen: [], - filteredFirmen: [], - selectedFirma: null, - abortController: { - suggestions: null, - places: null - }, - } - }, - computed:{ - orte() { - return this.places.filter(ort => ort.name == this.addressData.gemeinde); - }, - gemeinden() { - return Object.values(this.places.reduce((res,place) => { - res[place.name] = place; - return res; - }, {})); - } - }, - watch: { - uid() { - this.reload(); - }, - selectedFirma(newVal) { - this.addressData.firma_id = newVal?.firma_id || null; - } - }, - methods:{ - actionNewAdress() { - this.resetModal(); - this.$refs.adressModal.show(); - }, - actionEditAdress(adresse_id) { - this.statusNew = false; - this.loadAdress(adresse_id).then(() => { - if(this.addressData.adresse_id) - { - this.selectedFirma = this.listFirmen.find( - item => item.firma_id === this.addressData.firma_id - ); - - this.addressData.address.plz = this.addressData.plz; - // delete this.addressData.plz; - this.loadPlaces(this.addressData.address.plz); - this.$refs.adressModal.show(); - - } - }); - }, - actionDeleteAdress(adresse_id) { - this.$fhcAlert - .confirmDelete() - .then(result => result - ? adresse_id - : Promise.reject({handled: true})) - .then(this.deleteAddress) - .catch(this.$fhcAlert.handleSystemError); - }, - addNewAddress(addressData) { - this.addressData.plz = this.addressData.address.plz; - return this.$refs.addressData - .call(ApiStvAddress.add(this.uid, this.addressData)) - .then(response => { - this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); - this.hideModal('adressModal'); - this.resetModal(); - }) - .catch(this.$fhcAlert.handleSystemError) - .finally(this.reload); - }, - reload() { - this.$refs.table.reloadTable(); - }, - loadAdress(adresse_id) { - this.statusNew = false; - return this.$api - .call(ApiStvAddress.load(adresse_id)) - .then(result => { - this.addressData = result.data; - this.addressData.address = {}; - this.addressData.address.plz = this.addressData.plz || null; - return result; - }) - .catch(this.$fhcAlert.handleSystemError); - }, - updateAddress(adresse_id) { - this.addressData.plz = this.addressData.address.plz; - return this.$refs.addressData - .call(ApiStvAddress.update(adresse_id, this.addressData)) - .then(response => { - this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); - this.hideModal('adressModal'); - this.resetModal(); - }) - .catch(this.$fhcAlert.handleSystemError) - .finally(this.reload); - }, - deleteAddress(adresse_id) { - return this.$api - .call(ApiStvAddress.delete(adresse_id)) - .then(response => { - this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete')); - }) - .catch(this.$fhcAlert.handleSystemError) - .finally(() => { - window.scrollTo(0, 0); - this.reload(); - }); - }, - loadPlaces() { - if (this.abortController.places) - this.abortController.places.abort(); - if (this.addressData.nation != 'A' || !this.addressData.address.plz) - return; - - this.abortController.places = new AbortController(); - - return this.$api - .call(ApiStvAddress.getPlaces(this.addressData.address.plz)) - .then(result => { - this.places = result.data; - }); - }, - filterFirmen(event) { - const query = event?.query?.toLowerCase()?.trim() || ""; - - this.filteredFirmen = this.listFirmen.filter(item => { - const label = (item.label || "").toLowerCase(); - return label.includes(query); - }); - }, - hideModal(modalRef) { - this.$refs[modalRef].hide(); - }, - resetModal() { - this.addressData = {}; - - this.addressData.strasse = null; - this.addressData.zustelladresse = true; - this.addressData.heimatadresse = true; - this.addressData.rechnungsadresse = false; - this.addressData.co_name = null; - this.addressData.firma_id = null; - this.addressData.name = null; - this.addressData.anmerkung = null; - this.addressData.typ = 'h'; - this.addressData.nation = 'A'; - this.addressData.address = {plz: null}; - this.selectedFirma = null; - - this.statusNew = true; - }, - }, - created() { - this.$api - .call(ApiStvAddress.getNations()) - .then(result => { - this.nations = result.data; - }) - .catch(this.$fhcAlert.handleSystemError); - - this.$api - .call(ApiStvAddress.getTypes()) - .then(result => { - this.adressentypen = result.data; - }) - .catch(this.$fhcAlert.handleSystemError); - - this.$api - .call(ApiStvAddress.getAllFirmen()) - .then(result => { - this.listFirmen = result.data; - }) - .catch(this.$fhcAlert.handleSystemError); - }, - template: ` -
{{$p.t('person', 'adresse_new')}}
-{{$p.t('person', 'adresse_edit')}}
- -