mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-19 16:02:15 +00:00
Merge remote-tracking branch 'origin/feature-30660/FHC4_StudierendenGUI_Prototyp' into feature-30660/FHC4_StudierendenGUI_Prototyp
This commit is contained in:
@@ -305,5 +305,236 @@ class Student extends FHC_Controller
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
public function getAdressen($person_id)
|
||||
{
|
||||
$this->load->model('person/Adresse_model', 'AdresseModel');
|
||||
$this->load->model('person/Adressentyp_model', 'AdressentypModel');
|
||||
$this->load->model('ressource/firma_model', 'FirmaModel');
|
||||
|
||||
$this->AdresseModel->addSelect('*');
|
||||
$this->AdressentypModel->addJoin('public.tbl_adressentyp t', 'ON (t.adressentyp_kurzbz = public.tbl_adresse.typ)');
|
||||
$this->FirmaModel->addJoin('public.tbl_firma f', 'ON (f.firma_id = public.tbl_adresse.firma_id)', 'LEFT');
|
||||
|
||||
$result = $this->AdresseModel->loadWhere(
|
||||
array('person_id' => $person_id)
|
||||
);
|
||||
if (isError($result)) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
$this->outputJson(getError($result));
|
||||
} else {
|
||||
$this->outputJson(getData($result) ?: []);
|
||||
}
|
||||
}
|
||||
|
||||
public function addNewAddress($person_id)
|
||||
{
|
||||
$_POST = json_decode(utf8_encode($this->input->raw_input_stream), true);
|
||||
|
||||
//var_dump($_POST);
|
||||
//echo ($_POST['ort']);
|
||||
$this->load->model('person/Adresse_model', 'AdresseModel');
|
||||
// Load Libraries
|
||||
$this->load->library('AuthLib');
|
||||
$this->load->library('VariableLib', ['uid' => getAuthUID()]);
|
||||
|
||||
$result = $this->AdresseModel->insert(
|
||||
[
|
||||
'person_id' => $person_id,
|
||||
'strasse' => $_POST['strasse'],
|
||||
'insertvon' => 'FHC4',
|
||||
'insertamum' => date('c'),
|
||||
'plz' => $_POST['plz'],
|
||||
'ort' => $_POST['ort'],
|
||||
'gemeinde' => $_POST['gemeinde'],
|
||||
'nation' => $_POST['nation'],
|
||||
'heimatadresse' => $_POST['heimatadresse'],
|
||||
'zustelladresse' => $_POST['zustelladresse'],
|
||||
'co_name' => $_POST['co_name'],
|
||||
'typ' => $_POST['typ']
|
||||
]
|
||||
);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson($result);
|
||||
}
|
||||
return $this->outputJsonSuccess(true);
|
||||
}
|
||||
|
||||
public function getAdressentypen()
|
||||
{
|
||||
$this->load->model('person/Adressentyp_model', 'AdressentypModel');
|
||||
|
||||
$result = $this->AdressentypModel->load();
|
||||
if (isError($result)) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
$this->outputJson(getError($result));
|
||||
} else {
|
||||
$this->outputJson(getData($result) ?: []);
|
||||
}
|
||||
}
|
||||
|
||||
public function getGmeinden($plz)
|
||||
{
|
||||
//TODO(manu) finish
|
||||
$result = "";
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getKontakte($person_id)
|
||||
{
|
||||
$this->load->model('person/Kontakt_model', 'KontaktModel');
|
||||
$this->load->model('organisation/standort_model', 'StandortModel');
|
||||
$this->load->model('ressource/firma_model', 'FirmaModel');
|
||||
|
||||
$this->KontaktModel->addSelect('*');
|
||||
$this->StandortModel->addJoin('public.tbl_standort st', 'ON (public.tbl_kontakt.standort_id = st.standort_id)', 'LEFT');
|
||||
$this->StandortModel->addJoin('public.tbl_firma f', 'ON (f.firma_id = st.firma_id)', 'LEFT');
|
||||
|
||||
$result = $this->KontaktModel->loadWhere(
|
||||
array('person_id' => $person_id)
|
||||
);
|
||||
|
||||
if (isError($result)) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
$this->outputJson(getError($result));
|
||||
} else {
|
||||
$this->outputJson(getData($result) ?: []);
|
||||
}
|
||||
}
|
||||
|
||||
public function getBankverbindung($person_id)
|
||||
{
|
||||
$this->load->model('person/Bankverbindung_model', 'BankverbindungModel');
|
||||
|
||||
$this->BankverbindungModel->addSelect('*');
|
||||
|
||||
$result = $this->BankverbindungModel->loadWhere(
|
||||
array('person_id' => $person_id)
|
||||
);
|
||||
if (isError($result)) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
$this->outputJson(getError($result));
|
||||
} else {
|
||||
$this->outputJson(getData($result) ?: []);
|
||||
}
|
||||
}
|
||||
public function getAdressen($person_id)
|
||||
{
|
||||
$this->load->model('person/Adresse_model', 'AdresseModel');
|
||||
$this->load->model('person/Adressentyp_model', 'AdressentypModel');
|
||||
$this->load->model('ressource/firma_model', 'FirmaModel');
|
||||
|
||||
$this->AdresseModel->addSelect('*');
|
||||
$this->AdressentypModel->addJoin('public.tbl_adressentyp t', 'ON (t.adressentyp_kurzbz = public.tbl_adresse.typ)');
|
||||
$this->FirmaModel->addJoin('public.tbl_firma f', 'ON (f.firma_id = public.tbl_adresse.firma_id)', 'LEFT');
|
||||
|
||||
$result = $this->AdresseModel->loadWhere(
|
||||
array('person_id' => $person_id)
|
||||
);
|
||||
if (isError($result)) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
$this->outputJson(getError($result));
|
||||
} else {
|
||||
$this->outputJson(getData($result) ?: []);
|
||||
}
|
||||
}
|
||||
|
||||
public function addNewAddress($person_id)
|
||||
{
|
||||
$_POST = json_decode(utf8_encode($this->input->raw_input_stream), true);
|
||||
|
||||
//var_dump($_POST);
|
||||
//echo ($_POST['ort']);
|
||||
$this->load->model('person/Adresse_model', 'AdresseModel');
|
||||
// Load Libraries
|
||||
$this->load->library('AuthLib');
|
||||
$this->load->library('VariableLib', ['uid' => getAuthUID()]);
|
||||
|
||||
$result = $this->AdresseModel->insert(
|
||||
[
|
||||
'person_id' => $person_id,
|
||||
'strasse' => $_POST['strasse'],
|
||||
'insertvon' => 'FHC4',
|
||||
'insertamum' => date('c'),
|
||||
'plz' => $_POST['plz'],
|
||||
'ort' => $_POST['ort'],
|
||||
'gemeinde' => $_POST['gemeinde'],
|
||||
'nation' => $_POST['nation'],
|
||||
'heimatadresse' => $_POST['heimatadresse'],
|
||||
'zustelladresse' => $_POST['zustelladresse'],
|
||||
'co_name' => $_POST['co_name'],
|
||||
'typ' => $_POST['typ']
|
||||
]
|
||||
);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson($result);
|
||||
}
|
||||
return $this->outputJsonSuccess(true);
|
||||
}
|
||||
|
||||
public function getAdressentypen()
|
||||
{
|
||||
$this->load->model('person/Adressentyp_model', 'AdressentypModel');
|
||||
|
||||
$result = $this->AdressentypModel->load();
|
||||
if (isError($result)) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
$this->outputJson(getError($result));
|
||||
} else {
|
||||
$this->outputJson(getData($result) ?: []);
|
||||
}
|
||||
}
|
||||
|
||||
public function getGmeinden($plz)
|
||||
{
|
||||
//TODO(manu) finish
|
||||
$result = "";
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getKontakte($person_id)
|
||||
{
|
||||
$this->load->model('person/Kontakt_model', 'KontaktModel');
|
||||
$this->load->model('organisation/standort_model', 'StandortModel');
|
||||
$this->load->model('ressource/firma_model', 'FirmaModel');
|
||||
|
||||
$this->KontaktModel->addSelect('*');
|
||||
$this->StandortModel->addJoin('public.tbl_standort st', 'ON (public.tbl_kontakt.standort_id = st.standort_id)', 'LEFT');
|
||||
$this->StandortModel->addJoin('public.tbl_firma f', 'ON (f.firma_id = st.firma_id)', 'LEFT');
|
||||
|
||||
$result = $this->KontaktModel->loadWhere(
|
||||
array('person_id' => $person_id)
|
||||
);
|
||||
|
||||
if (isError($result)) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
$this->outputJson(getError($result));
|
||||
} else {
|
||||
$this->outputJson(getData($result) ?: []);
|
||||
}
|
||||
}
|
||||
|
||||
public function getBankverbindung($person_id)
|
||||
{
|
||||
$this->load->model('person/Bankverbindung_model', 'BankverbindungModel');
|
||||
|
||||
$this->BankverbindungModel->addSelect('*');
|
||||
|
||||
$result = $this->BankverbindungModel->loadWhere(
|
||||
array('person_id' => $person_id)
|
||||
);
|
||||
if (isError($result)) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
$this->outputJson(getError($result));
|
||||
} else {
|
||||
$this->outputJson(getData($result) ?: []);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@ export default {
|
||||
current: this.$route.params.tab || 'details',
|
||||
tabTemplates: {
|
||||
details: 'Details',
|
||||
notizen: 'Notizen'
|
||||
notizen: 'Notizen',
|
||||
kontakt: 'Kontakt'
|
||||
},
|
||||
tabs: {}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
import {CoreRESTClient} from '../../../../RESTClient.js';
|
||||
import AddressList from "./Kontakt/Address.js";
|
||||
import ContactList from "./Kontakt/Contact.js";
|
||||
import BankaccountList from "./Kontakt/Bankaccount.js";
|
||||
import PvToast from "../../../../../../index.ci.php/public/js/components/primevue/toast/toast.esm.min.js";
|
||||
export default {
|
||||
components: {
|
||||
AddressList,
|
||||
ContactList,
|
||||
BankaccountList,
|
||||
PvToast
|
||||
},
|
||||
props: {
|
||||
student: Object
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
adressen: [],
|
||||
kontakte: [],
|
||||
bankverbindungen: []
|
||||
}
|
||||
},
|
||||
created(){
|
||||
CoreRESTClient
|
||||
.get('components/stv/Student/getAdressen/' + this.student.person_id)
|
||||
.then(result => {
|
||||
this.adressen = result.data;
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err.response.data || err.message);
|
||||
});
|
||||
/* CoreRESTClient
|
||||
.get('components/stv/Student/getKontakte/' + this.student.person_id)
|
||||
.then(result => {
|
||||
this.kontakte = result.data;
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err.response.data || err.message);
|
||||
});
|
||||
CoreRESTClient
|
||||
.get('components/stv/Student/getBankverbindung/' + this.student.person_id)
|
||||
.then(result => {
|
||||
this.bankverbindungen = result.data;
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err.response.data || err.message);
|
||||
});*/
|
||||
},
|
||||
template: `
|
||||
<div class="stv-details-details h-100 pb-3">
|
||||
<fieldset class="overflow-hidden">
|
||||
<legend>Adressen</legend>
|
||||
<!-- {{this.adressen}}-->
|
||||
<address-list ref="adressList" :uid="student.person_id"></address-list>
|
||||
</fieldset>
|
||||
<fieldset class="overflow-hidden">
|
||||
<legend>Kontakt</legend>
|
||||
<!-- {{this.kontakte}}-->
|
||||
<contact-list ref="contactList" :uid="student.person_id"></contact-list>
|
||||
</fieldset>
|
||||
<fieldset class="overflow-hidden">
|
||||
<legend>Bankverbindungen</legend>
|
||||
<!-- {{this.bankverbindungen}}-->
|
||||
<bankaccount-list ref="bankaccountList" :uid="student.person_id"></bankaccount-list>
|
||||
</fieldset>
|
||||
</div>`
|
||||
};
|
||||
@@ -0,0 +1,255 @@
|
||||
import {CoreFilterCmpt} from "../../../../filter/Filter.js";
|
||||
import {CoreRESTClient} from "../../../../../RESTClient";
|
||||
|
||||
|
||||
var editIcon = function(cell, formatterParams){ //plain text value
|
||||
return "<i class='fa fa-edit'></i>";
|
||||
};
|
||||
var deleteIcon = function(cell, formatterParams){ //plain text value
|
||||
return "<i class='fa fa-remove'></i>";
|
||||
};
|
||||
|
||||
|
||||
export default{
|
||||
components: {
|
||||
CoreFilterCmpt
|
||||
},
|
||||
props: {
|
||||
uid: String
|
||||
},
|
||||
emits: [
|
||||
'update:selected'
|
||||
],
|
||||
data() {
|
||||
return{
|
||||
tabulatorOptions: {
|
||||
ajaxURL: CoreRESTClient._generateRouterURI('components/stv/Student/getAdressen/' + this.uid),
|
||||
//autoColumns: true,
|
||||
columns:[
|
||||
{title:"Typ", field:"bezeichnung"}, //TODO(manu) mix ok?
|
||||
{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: (cell, formatterParams, onRendered) => {
|
||||
let output = cell.getValue() ? "ja" : "nein";
|
||||
return output;}
|
||||
},
|
||||
{title:"Abweich.Empf", field:"co_name"},
|
||||
{title:"Firma", field:"name"}, //TODO(manu) check in DB
|
||||
{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:"updateamum", visible:false},
|
||||
{title:"Rechnungsadresse", field:"rechnungsadresse", visible:false,
|
||||
formatter: (cell, formatterParams, onRendered) => {
|
||||
let output = cell.getValue() ? "ja" : "nein";
|
||||
return output;}
|
||||
},
|
||||
{title:"Anmerkung", field:"anmerkung", visible:false},
|
||||
{formatter:editIcon, width:40, align:"center", cellClick:function(e, cell){alert("Edit data for adresse_id: " + cell.getRow().getIndex())}},
|
||||
{formatter:deleteIcon, width:40, align:"center", cellClick:function(e, cell){alert("Delete data for adresse_id " + cell.getRow().getIndex())}},
|
||||
],
|
||||
layout: 'fitDataFill',
|
||||
layoutColumnsOnNewData: false,
|
||||
height: 'auto',
|
||||
selectable: true,
|
||||
index: 'adresse_id',
|
||||
},
|
||||
tabulatorEvents: [
|
||||
|
||||
],
|
||||
lastSelected: null,
|
||||
modalRefVis: false,
|
||||
addressData: [],
|
||||
formData: {
|
||||
zustelladresse: false,
|
||||
heimatadresse: false
|
||||
},
|
||||
nations: [],
|
||||
adressentypen: []
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
actionNewAdress(){
|
||||
|
||||
console.log("Neue Adresse anlegen");
|
||||
bootstrap.Modal.getOrCreateInstance(this.$refs.newAdressModal).show();
|
||||
},
|
||||
deleteAdressData(){
|
||||
return this.formData = null;
|
||||
},
|
||||
hideModal(){
|
||||
bootstrap.Modal.getOrCreateInstance(this.$refs.newAdressModal).hide();
|
||||
},
|
||||
addNewAddress(formData) {
|
||||
CoreRESTClient.post('components/stv/Student/addNewAddress/' + this.uid,
|
||||
this.formData
|
||||
).then(response => {
|
||||
console.log(response);
|
||||
if (!response.data.error) {
|
||||
this.statusCode = 0;
|
||||
this.statusMsg = 'success';
|
||||
console.log('Speichern erfolgreich: ' + this.statusMsg);
|
||||
this.$fhcAlert.alertSuccess('Speichern erfolgreich');
|
||||
} else {
|
||||
this.statusCode = 0;
|
||||
this.statusMsg = 'Error';
|
||||
console.log('Speichern nicht erfolgreich: ' + this.statusMsg);
|
||||
this.$fhcAlert.alertError('Speichern nicht erfolgreich');
|
||||
}
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
this.statusCode = 0;
|
||||
this.statusMsg = 'Error in Catch';
|
||||
console.log('Speichern nicht erfolgreich ' + this.statusMsg);
|
||||
this.$fhcAlert.alertError('Fehler bei Speicherroutine aufgetreten');
|
||||
}).finally(() => {
|
||||
window.scrollTo(0, 0);
|
||||
hideModal();
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/* showModalRef(){
|
||||
|
||||
modalRef = true;
|
||||
}*/
|
||||
/* updateUrl(url, first) {
|
||||
this.lastSelected = first ? undefined : this.selected;
|
||||
if (url)
|
||||
url = CoreRESTClient._generateRouterURI(url);
|
||||
if (!this.$refs.table.tableBuilt)
|
||||
this.$refs.table.tabulator.on("tableBuilt", () => {
|
||||
this.$refs.table.tabulator.setData(url);
|
||||
});
|
||||
else
|
||||
this.$refs.table.tabulator.setData(url);
|
||||
}*/
|
||||
},
|
||||
created(){
|
||||
CoreRESTClient
|
||||
.get('components/stv/Student/getNations')
|
||||
.then(result => {
|
||||
this.nations = result.data;
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err.response.data || err.message);
|
||||
});
|
||||
CoreRESTClient
|
||||
.get('components/stv/Student/getAdressentypen')
|
||||
.then(result => {
|
||||
this.adressentypen = result.data;
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err.response.data || err.message);
|
||||
});
|
||||
},
|
||||
template: `
|
||||
|
||||
<div class="stv-list h-100 pt-3">
|
||||
|
||||
<!-- <Modal>
|
||||
TODO(MANU) use BSModal, Validierungen
|
||||
-->
|
||||
|
||||
<div ref="newAdressModal" class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Details Adresse</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form ref="formData">{{formData}}
|
||||
|
||||
<div class="col-sm-3">
|
||||
<label for="adressentyp" class="form-label required">Typ</label>
|
||||
<select id="adressentyp" class="form-control" v-model="formData.typ">
|
||||
<option value="">-- keine Auswahl --</option>
|
||||
<option v-for="typ in adressentypen" :key="typ.adressentyp_kurzbz" :value="typ.adressentyp_kurzbz" >{{typ.bezeichnung}}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<label for="strasse" class="form-label">Strasse</label>
|
||||
<input type="text" :readonly="readonly" class="form-control-sm" id="strasse" v-model="formData['strasse']" maxlength="256">
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<label for="nation" class="form-label">Nation</label>
|
||||
<select id="nation" class="form-control" v-model="formData.nation">
|
||||
<option value="">-- keine Auswahl --</option>
|
||||
<option v-for="nation in nations" :key="nation.nation_code" :value="nation.nation_code" :disabled="nation.sperre">{{nation.kurztext}}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<label for="plz" class="required form-label" >PLZ</label>
|
||||
<input type="text" required v-model="formData['plz']" >
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<label for="gemeinde" class="form-label">Gemeinde</label>
|
||||
<input class="form-control-sm" id="gemeinde" v-model="formData['gemeinde']"maxlength="256">
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<label for="ort" class="required form-label">Ortschaft</label>
|
||||
<input type="text" required v-model="formData['ort']">
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3 align-self-center">
|
||||
<label for="heimatadresse" class="form-label">Heimatadresse</label>
|
||||
<div class="form-check">
|
||||
<input id="heimatadresse" type="checkbox" class="form-check-input" value="1" v-model="formData['heimatadresse']">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3 align-self-center">
|
||||
<label for="zustelladresse" class="form-label">Zustelladresse</label>
|
||||
<div class="form-check">
|
||||
<input id="zustelladresse" type="checkbox" class="form-check-input" value="1" v-model="formData['zustelladresse']">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-sm-6">
|
||||
<label for="co_name" class="form-label">Abweich.Empfänger. (c/o)</label>
|
||||
<input type="text" v-model="formData['co_name']">
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Abbrechen</button>
|
||||
<button type="button" class="btn btn-primary" @click="addNewAddress()">OK</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<core-filter-cmpt
|
||||
ref="table"
|
||||
:tabulator-options="tabulatorOptions"
|
||||
:tabulator-events="tabulatorEvents"
|
||||
table-only
|
||||
:side-menu="false"
|
||||
reload
|
||||
new-btn-show
|
||||
new-btn-label="Neu"
|
||||
@click:new="actionNewAdress"
|
||||
|
||||
>
|
||||
<button v-if="reload" class="btn btn-outline-warning" aria-label="Reload" @click="editTable">
|
||||
<span class="fa-solid fa-rotate-right" aria-hidden="true"></span>
|
||||
</button>
|
||||
</core-filter-cmpt>
|
||||
</div>`
|
||||
};
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
import {CoreFilterCmpt} from "../../../../filter/Filter.js";
|
||||
import {CoreRESTClient} from "../../../../../RESTClient";
|
||||
|
||||
export default{
|
||||
components: {
|
||||
CoreFilterCmpt
|
||||
},
|
||||
props: {
|
||||
uid: String
|
||||
},
|
||||
emits: [
|
||||
'update:selected'
|
||||
],
|
||||
data() {
|
||||
return{
|
||||
tabulatorOptions: {
|
||||
ajaxURL: CoreRESTClient._generateRouterURI('components/stv/Student/getBankverbindung/' + this.uid),
|
||||
columns:[
|
||||
{title:"Name", field:"name"},
|
||||
{title:"Anschrift", field:"anschrift", visible:false},
|
||||
{title:"BIC", field:"bic"},
|
||||
{title:"BLZ", field:"blz", visible:false},
|
||||
{title:"IBAN", field:"iban"},
|
||||
{title:"Kontonummer", field:"kontonr", visible:false},
|
||||
{title:"Typ", field:"typ", visible:false,
|
||||
formatter: (cell, formatterParams, onRendered) => {
|
||||
let output;
|
||||
switch(cell.getValue()){
|
||||
case "p":
|
||||
output = "Privatkonto";
|
||||
break;
|
||||
case "f":
|
||||
output = "Firmenkonto";
|
||||
break;
|
||||
default:
|
||||
output = cell.getValue();
|
||||
}
|
||||
return output;}
|
||||
},
|
||||
{title:"Verrechnung", field:"verrechnung", visible:false,
|
||||
formatter: (cell, formatterParams, onRendered) => {
|
||||
let output = cell.getValue() ? "ja" : "nein";
|
||||
return output;}
|
||||
},
|
||||
{title:"Person_id", field:"person_id", visible:false},
|
||||
{title:"Bankverbindung_id", field:"bankverbindung_id", visible:false},
|
||||
],
|
||||
layout: 'fitDataFill',
|
||||
layoutColumnsOnNewData: false,
|
||||
height: 'auto',
|
||||
selectable: true,
|
||||
index: 'bankverbindung_id',
|
||||
},
|
||||
tabulatorEvents: [
|
||||
/* {
|
||||
event: 'rowSelectionChanged',
|
||||
handler: this.rowSelectionChanged
|
||||
},
|
||||
{
|
||||
event: 'dataProcessed',
|
||||
handler: this.autoSelectRows
|
||||
}*/
|
||||
],
|
||||
lastSelected: null
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
actionNewAdress(){
|
||||
console.log("Neuen Kontakt anlegen");
|
||||
},
|
||||
updateUrl(url, first) {
|
||||
this.lastSelected = first ? undefined : this.selected;
|
||||
if (url)
|
||||
url = CoreRESTClient._generateRouterURI(url);
|
||||
if (!this.$refs.table.tableBuilt)
|
||||
this.$refs.table.tabulator.on("tableBuilt", () => {
|
||||
this.$refs.table.tabulator.setData(url);
|
||||
});
|
||||
else
|
||||
this.$refs.table.tabulator.setData(url);
|
||||
}
|
||||
},
|
||||
template: `
|
||||
<div class="stv-list h-100 pt-3">
|
||||
<core-filter-cmpt
|
||||
ref="table"
|
||||
:tabulator-options="tabulatorOptions"
|
||||
:tabulator-events="tabulatorEvents"
|
||||
table-only
|
||||
:side-menu="false"
|
||||
reload
|
||||
new-btn-show
|
||||
new-btn-label="Neu"
|
||||
@click:new="actionNewContact"
|
||||
>
|
||||
</core-filter-cmpt>
|
||||
</div>`
|
||||
};
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
import {CoreFilterCmpt} from "../../../../filter/Filter.js";
|
||||
import {CoreRESTClient} from "../../../../../RESTClient";
|
||||
|
||||
var editIcon = function(cell, formatterParams){ //plain text value
|
||||
return "<i class='fa fa-edit'></i>";
|
||||
};
|
||||
var deleteIcon = function(cell, formatterParams){ //plain text value
|
||||
return "<i class='fa fa-remove'></i>";
|
||||
};
|
||||
|
||||
export default{
|
||||
components: {
|
||||
CoreFilterCmpt
|
||||
},
|
||||
props: {
|
||||
uid: String
|
||||
},
|
||||
emits: [
|
||||
'update:selected'
|
||||
],
|
||||
data() {
|
||||
return{
|
||||
tabulatorOptions: {
|
||||
ajaxURL: CoreRESTClient._generateRouterURI('components/stv/Student/getKontakte/' + this.uid),
|
||||
columns:[
|
||||
{title:"Typ", field:"kontakttyp"}, //TODO(manu) mix ok?
|
||||
{title:"Kontakt", field:"kontakt"},
|
||||
{title:"Zustellung", field:"zustellung",
|
||||
formatter: (cell, formatterParams, onRendered) => {
|
||||
let output = cell.getValue() ? "ja" : "nein";
|
||||
return output;}
|
||||
},
|
||||
{title:"Anmerkung", field:"anmerkung"},
|
||||
//{title:"Firma", field:"adress_id"},
|
||||
{title:"Firma_id", field:"firma_id", visible:false},
|
||||
{title:"Person_id", field:"person_id", visible:false},
|
||||
{title:"Kontakt_id", field:"kontakt_id", visible:false},
|
||||
{title:"letzte Änderung", field:"updateamum", visible:false},
|
||||
{formatter:editIcon, width:40, align:"center", cellClick:function(e, cell){alert("Edit data for kontakt_id: " + cell.getRow().getIndex())}},
|
||||
{formatter:deleteIcon, width:40, align:"center", cellClick:function(e, cell){alert("Delete data for kontakt_id " + cell.getRow().getIndex())}},
|
||||
],
|
||||
layout: 'fitDataFill',
|
||||
layoutColumnsOnNewData: false,
|
||||
height: 'auto',
|
||||
selectable: true,
|
||||
index: 'kontakt_id',
|
||||
},
|
||||
tabulatorEvents: [
|
||||
/* {
|
||||
event: 'rowSelectionChanged',
|
||||
handler: this.rowSelectionChanged
|
||||
},
|
||||
{
|
||||
event: 'dataProcessed',
|
||||
handler: this.autoSelectRows
|
||||
}*/
|
||||
],
|
||||
lastSelected: null
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
actionNewAdress(){
|
||||
console.log("Neuen Kontakt anlegen");
|
||||
},
|
||||
updateUrl(url, first) {
|
||||
this.lastSelected = first ? undefined : this.selected;
|
||||
if (url)
|
||||
url = CoreRESTClient._generateRouterURI(url);
|
||||
if (!this.$refs.table.tableBuilt)
|
||||
this.$refs.table.tabulator.on("tableBuilt", () => {
|
||||
this.$refs.table.tabulator.setData(url);
|
||||
});
|
||||
else
|
||||
this.$refs.table.tabulator.setData(url);
|
||||
}
|
||||
},
|
||||
template: `
|
||||
<div class="stv-list h-100 pt-3">
|
||||
<core-filter-cmpt
|
||||
ref="table"
|
||||
:tabulator-options="tabulatorOptions"
|
||||
:tabulator-events="tabulatorEvents"
|
||||
table-only
|
||||
:side-menu="false"
|
||||
reload
|
||||
new-btn-show
|
||||
new-btn-label="Neu"
|
||||
@click:new="actionNewContact"
|
||||
>
|
||||
</core-filter-cmpt>
|
||||
</div>`
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user