mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-12 09:39:28 +00:00
Child component Purpose.js for tableview
This commit is contained in:
@@ -14,7 +14,15 @@ class Mobility extends FHCAPI_Controller
|
||||
'insertMobility' => ['admin:rw', 'assistenz:rw'],
|
||||
'updateMobility' => ['admin:rw', 'assistenz:rw'],
|
||||
'deleteMobility' => ['admin:rw', 'assistenz:rw'],
|
||||
'getProgramsMobility' => ['admin:rw', 'assistenz:rw'],
|
||||
'getProgramsMobility' => ['admin:r', 'assistenz:r'],
|
||||
'getLVList' => ['admin:r', 'assistenz:r'],
|
||||
'getPurposes' => ['admin:r', 'assistenz:r'],
|
||||
'getListPurposes' => ['admin:r', 'assistenz:r'],
|
||||
'getListSupports' => ['admin:r', 'assistenz:r'],
|
||||
'deleteMobilityPurpose' => ['admin:r', 'assistenz:r'],
|
||||
'addMobilityPurpose' => ['admin:r', 'assistenz:r'],
|
||||
|
||||
|
||||
]);
|
||||
|
||||
// Load Libraries
|
||||
@@ -56,4 +64,208 @@ class Mobility extends FHCAPI_Controller
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
public function insertMobility()
|
||||
{
|
||||
//TODO(Manu) Validations
|
||||
//Pflicht gast und herkunftsland
|
||||
$authUID = getAuthUID();
|
||||
|
||||
$formData = $this->input->post('formData');
|
||||
|
||||
$von = (isset($formData['von']) && !empty($formData['von'])) ? $formData['von'] : null;
|
||||
$nation_code = (isset($formData['nation_code']) && !empty($formData['nation_code'])) ? $formData['nation_code'] : 'A';
|
||||
$mobilitaetsprogramm_code = (isset($formData['mobilitaetsprogramm_code']) && !empty($formData['mobilitaetsprogramm_code'])) ? $formData['mobilitaetsprogramm_code'] : null;
|
||||
$herkunftsland_code = (isset($formData['herkunftsland_code']) && !empty($formData['herkunftsland_code'])) ? $formData['herkunftsland_code'] : 'A';
|
||||
$ort = (isset($formData['ort']) && !empty($formData['ort'])) ? $formData['ort'] : null;
|
||||
$universitaet = (isset($formData['universitaet']) && !empty($formData['universitaet'])) ? $formData['universitaet'] : null;
|
||||
$ects_erworben = (isset($formData['ects_erworben']) && !empty($formData['ects_erworben'])) ? $formData['ects_erworben'] : null;
|
||||
$ects_angerechnet = (isset($formData['ects_angerechnet']) && !empty($formData['ects_angerechnet'])) ? $formData['ects_angerechnet'] : null;
|
||||
$localPurposes = (isset($formData['localPurposes']) && !empty($formData['localPurposes'])) ? $formData['localPurposes'] : null;
|
||||
|
||||
|
||||
//strange fields
|
||||
/* 'zweck_code' => $this->input->post('zweck_code'),
|
||||
'aufenthalt_foerderung' => $this->input->post('aufenthalt_foerderung'),
|
||||
'lehreinheit_id' => $this->input->post('lehreinheit_id'),
|
||||
'lehrveranstaltung_id' => $this->input->post('lehrveranstaltung_id'),*/
|
||||
|
||||
|
||||
$result = $this->BisioModel->insert([
|
||||
'student_uid' => $this->input->post('uid'),
|
||||
'von' => $von,
|
||||
'bis' => $formData['bis'],
|
||||
'mobilitaetsprogramm_code' => $mobilitaetsprogramm_code,
|
||||
'nation_code' => $nation_code,
|
||||
'herkunftsland_code' => $herkunftsland_code,
|
||||
'ort' => $ort,
|
||||
'universitaet' => $universitaet,
|
||||
'ects_erworben' => $ects_erworben,
|
||||
'ects_angerechnet' => $ects_angerechnet,
|
||||
'insertamum' => date('c'),
|
||||
'insertvon' => $authUID,
|
||||
]);
|
||||
|
||||
$bisio_id = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
//check if localData (purposes)
|
||||
if(count($localPurposes) > 0){
|
||||
|
||||
// $this->terminateWithError('Speichern von Zweck notwendig mit neuer bisio_id ' . $bisio_id, self::ERROR_TYPE_GENERAL);
|
||||
|
||||
foreach ($localPurposes as $zweck){
|
||||
$zweck = (int) $zweck;
|
||||
$this->addMobilityPurpose($bisio_id, $zweck);
|
||||
}
|
||||
}
|
||||
|
||||
$this->terminateWithSuccess();
|
||||
}
|
||||
|
||||
public function loadMobility($bisio_id)
|
||||
{
|
||||
$result = $this->BisioModel->load($bisio_id);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->terminateWithSuccess(current($data));
|
||||
}
|
||||
|
||||
public function updateMobility()
|
||||
{
|
||||
$authUID = getAuthUID();
|
||||
$formData = $this->input->post('formData');
|
||||
|
||||
$result = $this->BisioModel->update(
|
||||
[
|
||||
'bisio_id' => $formData['bisio_id']
|
||||
],
|
||||
[
|
||||
'student_uid' => $this->input->post('uid'),
|
||||
'von' => $formData['von'],
|
||||
'bis' => $formData['bis'],
|
||||
'mobilitaetsprogramm_code' => $formData['mobilitaetsprogramm_code'],
|
||||
'nation_code' => $formData['nation_code'],
|
||||
'herkunftsland_code' => $formData['herkunftsland_code'],
|
||||
'ort' => $formData['ort'],
|
||||
'universitaet' => $formData['universitaet'],
|
||||
'ects_erworben' => $formData['ects_erworben'],
|
||||
'ects_angerechnet' => $formData['ects_angerechnet'],
|
||||
'updateamum' => date('c'),
|
||||
'updatevon' => $authUID,
|
||||
]
|
||||
);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->terminateWithSuccess(current($data));
|
||||
}
|
||||
|
||||
public function deleteMobility($bisio_id)
|
||||
{
|
||||
// $this->terminateWithError('test ' . $bisio_id, self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$result = $this->BisioModel->delete(
|
||||
array('bisio_id' => $bisio_id)
|
||||
);
|
||||
|
||||
//TODO(Manu) foreign key restraint
|
||||
//nämlich Extension mo
|
||||
//fk_mobisioidzuordnung_prestudent_id" on table "tbl_mo_bisioidzuordnung"
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
public function getLVList($studiengang_kz)
|
||||
{
|
||||
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
|
||||
|
||||
$result = $this->LehrveranstaltungModel->getLvsByStudiengangkz($studiengang_kz);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
public function getPurposes($bisio_id)
|
||||
{
|
||||
$bisio_id = (int) $bisio_id;
|
||||
|
||||
$this->load->model('codex/Bisiozweck_model', 'BisiozweckModel');
|
||||
|
||||
$this->BisiozweckModel->addSelect("*");
|
||||
$this->BisiozweckModel->addJoin('bis.tbl_zweck zw', 'ON (zw.zweck_code = bis.tbl_bisio_zweck.zweck_code)');
|
||||
|
||||
$result = $this->BisiozweckModel->loadWhere(
|
||||
array('bisio_id' => $bisio_id)
|
||||
);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
public function getListPurposes()
|
||||
{
|
||||
$this->load->model('codex/Zweck_model', 'ZweckModel');
|
||||
|
||||
$result = $this->ZweckModel->load();
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
public function getListSupports()
|
||||
{
|
||||
$this->load->model('codex/Aufenthaltfoerderung_model', 'AufenthaltfoerderungModel');
|
||||
|
||||
$result = $this->AufenthaltfoerderungModel->load();
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
public function addMobilityPurpose($bisio_id, $local_purpose = null)
|
||||
{
|
||||
$zweck_code = $this->input->post('zweck_code');
|
||||
|
||||
if($local_purpose){
|
||||
$zweck_code = $local_purpose;
|
||||
}
|
||||
|
||||
$this->load->model('codex/Bisiozweck_model', 'BisiozweckModel');
|
||||
|
||||
$result = $this->BisiozweckModel->insert(
|
||||
array(
|
||||
'bisio_id' => $bisio_id,
|
||||
'zweck_code' => $zweck_code
|
||||
)
|
||||
);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
return $this->terminateWithSuccess(current($data));
|
||||
}
|
||||
|
||||
public function deleteMobilityPurpose($bisio_id)
|
||||
{
|
||||
$zweck_code = $this->input->post('zweck_code');
|
||||
|
||||
$this->load->model('codex/Bisiozweck_model', 'BisiozweckModel');
|
||||
|
||||
|
||||
$result = $this->BisiozweckModel->delete(
|
||||
array(
|
||||
'bisio_id' => $bisio_id,
|
||||
'zweck_code' => $zweck_code
|
||||
)
|
||||
);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
return $this->terminateWithSuccess(current($data));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1012,4 +1012,27 @@ class Lehrveranstaltung_model extends DB_Model
|
||||
$res = $this->execReadOnlyQuery($query);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets lehrveranstaltungen of a studiengang
|
||||
* @param integer $studiengang_kz
|
||||
* @return array|null
|
||||
*/
|
||||
public function getLvsByStudiengangkz($studiengang_kz)
|
||||
{
|
||||
$params = array($studiengang_kz);
|
||||
|
||||
$qry = "SELECT
|
||||
*
|
||||
FROM
|
||||
lehre.tbl_lehrveranstaltung
|
||||
WHERE lehrveranstaltung_id IN
|
||||
(SELECT lehrveranstaltung_id
|
||||
FROM campus.vw_student_lehrveranstaltung
|
||||
WHERE studiengang_kz = ?";
|
||||
|
||||
$qry .= ") ORDER BY semester, bezeichnung";
|
||||
|
||||
return $this->execQuery($qry, $params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,4 +5,38 @@ export default {
|
||||
getProgramsMobility(){
|
||||
return this.$fhcApi.get('api/frontend/v1/stv/mobility/getProgramsMobility/');
|
||||
},
|
||||
addNewMobility(data){
|
||||
//TODO(Manu) formvalidation
|
||||
return this.$fhcApi.post('api/frontend/v1/stv/mobility/insertMobility/', data);
|
||||
},
|
||||
loadMobility(bisio_id){
|
||||
return this.$fhcApi.get('api/frontend/v1/stv/mobility/loadMobility/' + bisio_id);
|
||||
},
|
||||
updateMobility(data){
|
||||
return this.$fhcApi.post('api/frontend/v1/stv/mobility/updateMobility/', data);
|
||||
},
|
||||
deleteMobility(bisio_id){
|
||||
return this.$fhcApi.post('api/frontend/v1/stv/mobility/deleteMobility/' + bisio_id);
|
||||
},
|
||||
getLVList(studiengang_kz){
|
||||
return this.$fhcApi.get('api/frontend/v1/stv/mobility/getLVList/' + studiengang_kz);
|
||||
},
|
||||
getPurposes(url, config, params){
|
||||
console.log("in getPurposes");
|
||||
//console.log(params);
|
||||
return this.$fhcApi.get('api/frontend/v1/stv/mobility/getPurposes/' + params.id);
|
||||
},
|
||||
getListPurposes() {
|
||||
return this.$fhcApi.get('api/frontend/v1/stv/mobility/getListPurposes/');
|
||||
},
|
||||
getListSupports() {
|
||||
return this.$fhcApi.get('api/frontend/v1/stv/mobility/getListSupports/');
|
||||
},
|
||||
deleteMobilityPurpose(params) {
|
||||
return this.$fhcApi.post('api/frontend/v1/stv/mobility/deleteMobilityPurpose/' + params.bisio_id, params);
|
||||
},
|
||||
addMobilityPurpose(params) {
|
||||
return this.$fhcApi.post('api/frontend/v1/stv/mobility/addMobilityPurpose/' + params.bisio_id, params);
|
||||
},
|
||||
|
||||
}
|
||||
@@ -16,10 +16,7 @@ export default {
|
||||
return {}
|
||||
},
|
||||
template: `
|
||||
<div class="stv-details-mobility h-100 d-flex flex-column">
|
||||
|
||||
<h1>TEST Mob</h1>
|
||||
|
||||
<div class="stv-details-mobility h-100 d-flex flex-column">
|
||||
<table-mobility ref="tbl_mobility" :student="modelValue"></table-mobility>
|
||||
</div>`
|
||||
};
|
||||
@@ -0,0 +1,284 @@
|
||||
import {CoreFilterCmpt} from "../../../../../filter/Filter.js";
|
||||
|
||||
import BsModal from "../../../../../Bootstrap/Modal.js";
|
||||
import CoreForm from '../../../../../Form/Form.js';
|
||||
import FormInput from '../../../../../Form/Input.js';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
CoreFilterCmpt,
|
||||
BsModal,
|
||||
CoreForm,
|
||||
FormInput
|
||||
},
|
||||
props: {
|
||||
bisio_id: {
|
||||
type: [Number],
|
||||
required: true
|
||||
},
|
||||
listPurposes: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
formDataParent: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tabulatorOptions: {
|
||||
ajaxURL: 'dummy',
|
||||
ajaxRequestFunc: this.$fhcApi.factory.stv.mobility.getPurposes,
|
||||
ajaxParams: () => {
|
||||
return {
|
||||
id: this.bisio_id
|
||||
};
|
||||
},
|
||||
ajaxResponse: (url, params, response) => response.data,
|
||||
columns: [
|
||||
{title: "Zweck_code", field: "zweck_code", visible: false},
|
||||
{title: "Kurzbz", field: "kurzbz", visible: false},
|
||||
{title: "Bezeichnung", field: "bezeichnung"},
|
||||
{
|
||||
title: 'Aktionen', field: 'actions',
|
||||
minWidth: 150,
|
||||
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 = '<i class="fa fa-xmark"></i>';
|
||||
button.title = this.$p.t('global', 'loeschen');
|
||||
button.addEventListener(
|
||||
'click',
|
||||
() =>
|
||||
this.actionDeletePurpose(cell.getData().zweck_code)
|
||||
);
|
||||
container.append(button);
|
||||
|
||||
return container;
|
||||
},
|
||||
frozen: true
|
||||
},
|
||||
],
|
||||
layout: 'fitColumns',
|
||||
layoutColumnsOnNewData: false,
|
||||
height: '300',
|
||||
selectableRangeMode: 'click',
|
||||
selectable: true,
|
||||
persistenceID: 'core-mobility-purpose'
|
||||
},
|
||||
tabulatorEvents: [
|
||||
{
|
||||
event: 'tableBuilt',
|
||||
handler: async() => {
|
||||
|
||||
await this.$p.loadCategory(['ui', 'global', 'vertrag']);
|
||||
/*
|
||||
let cm = this.$refs.table.tabulator.columnManager;
|
||||
|
||||
cm.getColumnByField('bezeichnung').component.updateDefinition({
|
||||
title: this.$p.t('global', 'status')
|
||||
});
|
||||
cm.getColumnByField('format_datum').component.updateDefinition({
|
||||
title: this.$p.t('global', 'datum')
|
||||
});
|
||||
cm.getColumnByField('mitarbeiter_uid').component.updateDefinition({
|
||||
title: this.$p.t('person', 'uid')
|
||||
});
|
||||
cm.getColumnByField('vertrag_id').component.updateDefinition({
|
||||
title: this.$p.t('ui', 'vertrag_id')
|
||||
});
|
||||
cm.getColumnByField('vertragsstatus_kurzbz').component.updateDefinition({
|
||||
title: this.$p.t('vertrag', 'vertragStatus')
|
||||
});
|
||||
cm.getColumnByField('actions').component.updateDefinition({
|
||||
title: this.$p.t('global', 'aktionen')
|
||||
});
|
||||
cm.getColumnByField('updatevon').component.updateDefinition({
|
||||
title: this.$p.t('global', 'updatevon')
|
||||
});
|
||||
cm.getColumnByField('format_updateamum').component.updateDefinition({
|
||||
title: this.$p.t('global', 'updateamum')
|
||||
});
|
||||
cm.getColumnByField('insertvon').component.updateDefinition({
|
||||
title: this.$p.t('global', 'insertvon')
|
||||
});
|
||||
cm.getColumnByField('format_insertamum').component.updateDefinition({
|
||||
title: this.$p.t('global', 'insertamum')
|
||||
}); */
|
||||
}
|
||||
}
|
||||
],
|
||||
clickedRows: [],
|
||||
formData: {},
|
||||
localData: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
/* bisio_id(newVal) {
|
||||
if (!newVal) {
|
||||
console.log("activate local Data");
|
||||
// Lokale Daten direkt in die Tabelle laden
|
||||
this.$refs.table.instance.setData(this.localData);
|
||||
} else {
|
||||
console.log("data with api" + newVal);
|
||||
let params = {
|
||||
bisio_id: newVal,
|
||||
};
|
||||
// Daten aus der API abrufen und in die Tabelle laden
|
||||
this.$fhcApi.factory.stv.mobility.getPurposes(params)
|
||||
.then(result => {
|
||||
this.$refs.table.instance.setData(result.data);
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
}
|
||||
},*/
|
||||
|
||||
|
||||
/* bisio_id(newVal) {
|
||||
if (!newVal) {
|
||||
console.log("activate local Data");
|
||||
this.tabulatorOptions.ajaxRequestFunc = null;
|
||||
this.tabulatorOptions.data = this.localData;
|
||||
} else {
|
||||
console.log("data with api" + newVal);
|
||||
let params = {
|
||||
bisio_id : newVal,
|
||||
};
|
||||
//this.tabulatorOptions.ajaxRequestFunc = this.$fhcApi.factory.stv.mobility.getPurposes, newVal;
|
||||
this.$fhcApi.factory.stv.mobility.getPurposes(params)
|
||||
.then(result => {
|
||||
this.tabulatorOptions = result.data;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
}
|
||||
},*/
|
||||
bisio_id() {
|
||||
if (this.$refs.table) {
|
||||
this.$refs.table.reloadTable();
|
||||
}
|
||||
},
|
||||
/* bisio_id() {
|
||||
//this.reloadTable();
|
||||
//this.$refs.table.tabulator.setData('api/frontend/v1/vertraege/vertraege/getStatiOfContract/' + this.vertrag_id);
|
||||
},*/
|
||||
formDataParent: {
|
||||
handler(newVal, oldVal)
|
||||
{
|
||||
this.formData = this.formDataParent;
|
||||
}
|
||||
,
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
actionNewPurpose() {
|
||||
this.resetModal();
|
||||
this.$refs.mobilityPurpose.show();
|
||||
},
|
||||
actionDeletePurpose(zweck_code) {
|
||||
this.$emit('deleteMobilityPurpose', {
|
||||
bisio_id: this.bisio_id,
|
||||
zweck_code: zweck_code
|
||||
});
|
||||
},
|
||||
handleSubmitAction() {
|
||||
if (this.bisio_id) {
|
||||
|
||||
this.$emit('setMobilityPurpose', {
|
||||
zweck_code: this.formData.zweck_code,
|
||||
bisio_id: this.bisio_id
|
||||
});
|
||||
} else {
|
||||
//not working
|
||||
// this.$refs.table.addRow({id: 123, zweck_code: this.formData.zweck_code});
|
||||
//this.formData.zweck_code
|
||||
this.localData.push(this.formData.zweck_code); //not working: this.$refs.table.addRow is not a function
|
||||
console.log("action without Bisio_id " + this.formData.zweck_code);
|
||||
this.$emit('setMobilityPurposeToNewMobility', {
|
||||
zweck_code: this.formData.zweck_code,
|
||||
});
|
||||
}
|
||||
this.closeModal();
|
||||
},
|
||||
|
||||
closeModal(){
|
||||
this.$refs.mobilityPurpose.hide();
|
||||
this.$emit('close-modal');
|
||||
},
|
||||
openModal(){
|
||||
this.$refs.mobilityPurpose.show();
|
||||
this.$emit('open-modal');
|
||||
},
|
||||
reload() {
|
||||
this.$refs.table.reloadTable();
|
||||
this.$emit('reload');
|
||||
},
|
||||
resetModal(){
|
||||
this.formData = {};
|
||||
this.formData.vertragsstatus_kurzbz = null;
|
||||
this.formData.datum = new Date();
|
||||
this.statusNew = true;
|
||||
}
|
||||
},
|
||||
template: `
|
||||
<div class="core-mobility-puprpose h-50 d-flex flex-column w-100 mt-2">
|
||||
<br>
|
||||
|
||||
<!-- <h5>{{$p.t('mobility', 'zweck')}}</h5>-->
|
||||
|
||||
bisio: {{bisio_id}}
|
||||
|
||||
<core-filter-cmpt
|
||||
ref="table"
|
||||
:tabulator-options="tabulatorOptions"
|
||||
:tabulator-events="tabulatorEvents"
|
||||
table-only
|
||||
:side-menu="false"
|
||||
reload
|
||||
new-btn-show
|
||||
:new-btn-label="this.$p.t('mobility', 'zweck')"
|
||||
@click:new="actionNewPurpose"
|
||||
>
|
||||
</core-filter-cmpt>
|
||||
|
||||
<div >
|
||||
<bs-modal ref="mobilityPurpose">
|
||||
<template #title>
|
||||
<p class="fw-bold mt-3">neuer Zweck</p>
|
||||
|
||||
</template>
|
||||
|
||||
<core-form ref="mobilityData">
|
||||
<div class="row mb-3">
|
||||
<form-input
|
||||
type="select"
|
||||
:label="$p.t('mobility/zweck')"
|
||||
v-model="formData.zweck_code"
|
||||
name="zweck"
|
||||
>
|
||||
<option default>{{$p.t('ui', 'bitteWaehlen')}}</option>
|
||||
<option
|
||||
v-for="entry in listPurposes"
|
||||
:key="entry.zweck_code"
|
||||
:value="entry.zweck_code"
|
||||
>
|
||||
{{entry.bezeichnung}}
|
||||
</option>
|
||||
</form-input>
|
||||
</div>
|
||||
</core-form>
|
||||
|
||||
<template #footer>
|
||||
<button type="button" class="btn btn-primary" @click="handleSubmitAction">{{$p.t('ui', 'speichern')}}</button>
|
||||
</template>
|
||||
|
||||
</bs-modal>
|
||||
</div>
|
||||
|
||||
</div>`
|
||||
}
|
||||
@@ -2,13 +2,17 @@ import {CoreFilterCmpt} from "../../../../filter/Filter.js";
|
||||
import BsModal from "../../../../Bootstrap/Modal.js";
|
||||
import FormForm from '../../../../Form/Form.js';
|
||||
import FormInput from '../../../../Form/Input.js';
|
||||
import MobilityPurpose from './List/Purpose.js';
|
||||
//import LocalPurpose from './List/PurposesLocal.js';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
CoreFilterCmpt,
|
||||
BsModal,
|
||||
FormForm,
|
||||
FormInput
|
||||
FormInput,
|
||||
MobilityPurpose,
|
||||
// LocalPurpose
|
||||
},
|
||||
inject: {
|
||||
$reloadList: {
|
||||
@@ -51,7 +55,7 @@ export default {
|
||||
button.innerHTML = '<i class="fa fa-edit"></i>';
|
||||
button.title = this.$p.t('ui', 'bearbeiten');
|
||||
button.addEventListener('click', (event) =>
|
||||
this.actionEditMobility(cell.getData().mobility_id)
|
||||
this.actionEditMobility(cell.getData().bisio_id)
|
||||
);
|
||||
container.append(button);
|
||||
|
||||
@@ -60,7 +64,7 @@ export default {
|
||||
button.innerHTML = '<i class="fa fa-xmark"></i>';
|
||||
button.title = this.$p.t('ui', 'loeschen');
|
||||
button.addEventListener('click', () =>
|
||||
this.actionDeleteMobility(cell.getData().mobility_id)
|
||||
this.actionDeleteMobility(cell.getData().bisio_id)
|
||||
);
|
||||
container.append(button);
|
||||
|
||||
@@ -73,7 +77,7 @@ export default {
|
||||
layoutColumnsOnNewData: false,
|
||||
height: 'auto',
|
||||
selectable: true,
|
||||
index: 'mobility_id',
|
||||
index: 'bisio_id',
|
||||
persistenceID: 'stv-details-table_mobiliy'
|
||||
},
|
||||
tabulatorEvents: [
|
||||
@@ -121,8 +125,8 @@ export default {
|
||||
// cm.getColumnByField('pruefungstyp_kurzbz').component.updateDefinition({
|
||||
// title: this.$p.t('global', 'typ')
|
||||
// });
|
||||
// cm.getColumnByField('mobility_id').component.updateDefinition({
|
||||
// title: this.$p.t('ui', 'mobility_id')
|
||||
// cm.getColumnByField('bisio_id').component.updateDefinition({
|
||||
// title: this.$p.t('ui', 'bisio_id')
|
||||
// });
|
||||
/*
|
||||
cm.getColumnByField('actions').component.updateDefinition({
|
||||
@@ -135,12 +139,17 @@ export default {
|
||||
formData: {
|
||||
von: new Date(),
|
||||
bis: new Date(),
|
||||
mobilitaetsprogramm: 7,
|
||||
mobilitaetsprogramm_code: 7,
|
||||
gastnation: 'A',
|
||||
herkunftsland: 'A',
|
||||
bisio_id: null,
|
||||
localPurposes: []
|
||||
},
|
||||
statusNew: true,
|
||||
programsMobility: [],
|
||||
listLvs: [],
|
||||
listPurposes: [],
|
||||
listSupports: [],
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -151,38 +160,39 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getStudiengangsTyp(){
|
||||
this.stgTyp = '';
|
||||
this.$fhcApi.factory.stv.mobility.getTypStudiengang(this.stg_kz)
|
||||
.then(result => this.stgTyp = result.data)
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
actionNewMobility() {
|
||||
this.resetForm();
|
||||
this.statusNew = true;
|
||||
//this.setDefaultFormData();
|
||||
},
|
||||
actionEditMobility(mobility_id) {
|
||||
actionEditMobility(bisio_id) {
|
||||
this.resetForm();
|
||||
// this.formData.bisio_id = bisio_id;
|
||||
this.statusNew = false;
|
||||
this.loadMobility(mobility_id);
|
||||
this.loadMobility(bisio_id);
|
||||
},
|
||||
actionDeleteMobility(mobility_id) {
|
||||
actionDeleteMobility(bisio_id) {
|
||||
this.$fhcAlert
|
||||
.confirmDelete()
|
||||
.then(result => result
|
||||
? mobility_id
|
||||
? bisio_id
|
||||
: Promise.reject({handled: true}))
|
||||
.then(this.deletemobility)
|
||||
.then(this.deleteMobility(bisio_id))
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
addNewMobility() {
|
||||
//TODO(Manu) um localPurposes erweitern
|
||||
/* console.log(this.formData.localPurposes[0]);
|
||||
if(this.formData.localPurposes.length){
|
||||
this.$fhcAlert.alertSuccess('nach speichern purposes mit neuer bisio_id zusammenführen');
|
||||
return;
|
||||
}*/
|
||||
const dataToSend = {
|
||||
uid: this.student.uid,
|
||||
formData: this.formData
|
||||
};
|
||||
|
||||
return this.$refs.formFinalExam.factory.stv.mobility.addNewmobility(dataToSend)
|
||||
return this.$fhcApi.factory.stv.mobility.addNewMobility(dataToSend)
|
||||
//return this.$refs.formMobility.factory.stv.mobility.addNewMobility(dataToSend)
|
||||
.then(response => {
|
||||
this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave'));
|
||||
this.resetForm();
|
||||
@@ -195,22 +205,22 @@ export default {
|
||||
reload() {
|
||||
this.$refs.table.reloadTable();
|
||||
},
|
||||
loadMobility(mobility_id) {
|
||||
return this.$fhcApi.factory.stv.mobility.loadmobility(mobility_id)
|
||||
loadMobility(bisio_id) {
|
||||
return this.$fhcApi.factory.stv.mobility.loadMobility(bisio_id)
|
||||
.then(result => {
|
||||
|
||||
this.formData = result.data;
|
||||
//TODO(Manu) check if cisRoot is okay
|
||||
this.formData.link = this.cisRoot + 'index.ci.php/lehre/Pruefungsprotokoll/showProtokoll?mobility_id=' + this.formData.mobility_id + '&fhc_controller_id=67481e5ed5490';
|
||||
return result;
|
||||
console.log("after");
|
||||
//return result;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
updateMobility(mobility_id) {
|
||||
updateMobility(bisio_id) {
|
||||
const dataToSend = {
|
||||
id: mobility_id,
|
||||
formData: this.formData
|
||||
formData: this.formData,
|
||||
uid: this.student.uid,
|
||||
};
|
||||
return this.$refs.formFinalExam.factory.stv.mobility.updatemobility(dataToSend)
|
||||
return this.$fhcApi.factory.stv.mobility.updateMobility(dataToSend)
|
||||
.then(response => {
|
||||
this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave'));
|
||||
this.resetForm();
|
||||
@@ -220,8 +230,9 @@ export default {
|
||||
this.reload();
|
||||
});
|
||||
},
|
||||
deleteMobility(mobility_id) {
|
||||
return this.$fhcApi.factory.stv.mobility.deletemobility(mobility_id)
|
||||
deleteMobility(bisio_id) {
|
||||
//TODO(Manu) prompt wird nicht abgewartet!
|
||||
return this.$fhcApi.factory.stv.mobility.deleteMobility(bisio_id)
|
||||
.then(response => {
|
||||
this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete'));
|
||||
})
|
||||
@@ -231,8 +242,73 @@ export default {
|
||||
});
|
||||
},
|
||||
resetForm() {
|
||||
this.formData = null;
|
||||
this.formData = {};
|
||||
this.formData.von = new Date();
|
||||
this.formData.bis = new Date();
|
||||
this.formData.mobilitaetsprogramm_code = 7;
|
||||
this.formData.gastnation = 'A';
|
||||
this.formData.herkunftsland = 'A';
|
||||
this.formData.bisio_id = null;
|
||||
this.formData.localPurposes = [];
|
||||
},
|
||||
// --- methods purposes ---
|
||||
addMobilityPurpose({zweck_code, bisio_id}){
|
||||
let params = {
|
||||
bisio_id : bisio_id,
|
||||
zweck_code: zweck_code
|
||||
};
|
||||
return this.$fhcApi.factory.stv.mobility.addMobilityPurpose(params)
|
||||
.then(response => {
|
||||
this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave'));
|
||||
|
||||
this.$refs.purposes.reload();
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
deleteMobilityPurpose({zweck_code, bisio_id}){
|
||||
let params = {
|
||||
bisio_id : bisio_id,
|
||||
zweck_code: zweck_code
|
||||
};
|
||||
return this.$fhcApi.factory.stv.mobility.deleteMobilityPurpose(params)
|
||||
.then(response => {
|
||||
this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete'));
|
||||
|
||||
this.$refs.purposes.reload();
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
addPurposeToMobility({zweck_code}){
|
||||
|
||||
console.log("localPurposes befüllen: " , zweck_code);
|
||||
this.formData.localPurposes.push(zweck_code);
|
||||
/* this.formData.firstPurpose = zweck_code;
|
||||
this.$refs.purposes.closeModal();*/
|
||||
},
|
||||
/* addPurposeToMobility(purpose) {
|
||||
this.localPurposes.push(purpose);
|
||||
},*/
|
||||
//lokale Variante
|
||||
/* async saveAllChanges() {
|
||||
try {
|
||||
const savedData = await this.$fhcApi.factory.stv.mobility.savePurposes({
|
||||
id: this.bisio_id,
|
||||
purposes: this.localData.filter(item => !item.zweck_code.startsWith('temp_')) // Nur echte IDs senden
|
||||
});
|
||||
|
||||
// Synchronisiere temporäre IDs mit echten Daten
|
||||
savedData.forEach((item) => {
|
||||
const localItem = this.localData.find(local => local.zweck_code === item.tempId);
|
||||
if (localItem) {
|
||||
localItem.zweck_code = item.zweck_code; // Aktualisiere die echte ID
|
||||
}
|
||||
});
|
||||
|
||||
this.updateTabulatorData();
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Speichern der Änderungen:', error);
|
||||
}
|
||||
},*/
|
||||
},
|
||||
created() {
|
||||
this.$fhcApi.factory.stv.mobility.getProgramsMobility()
|
||||
@@ -240,12 +316,36 @@ export default {
|
||||
this.programsMobility = result.data;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
this.$fhcApi.factory.stv.mobility.getLVList(this.student.studiengang_kz)
|
||||
.then(result => {
|
||||
this.listLvs = result.data;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
this.$fhcApi.factory.stv.mobility.getListPurposes()
|
||||
.then(result => {
|
||||
this.listPurposes = result.data;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
this.$fhcApi.factory.stv.mobility.getListSupports()
|
||||
.then(result => {
|
||||
this.listSupports = result.data;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
template: `
|
||||
<div class="stv-details-mobility h-100 pb-3">
|
||||
<h4>In/out</h4>
|
||||
|
||||
<!-- {{listSupports}}-->
|
||||
<hr>
|
||||
{{formData}}
|
||||
<!--
|
||||
<hr>
|
||||
|
||||
{{listPurposes}}-->
|
||||
|
||||
<!-- {{programsMobility}}-->
|
||||
<!-- {{listLvs}}-->
|
||||
|
||||
|
||||
<core-filter-cmpt
|
||||
@@ -257,7 +357,7 @@ export default {
|
||||
reload
|
||||
new-btn-show
|
||||
new-btn-label="Mobilität"
|
||||
@click:new="actionNewmobility"
|
||||
@click:new="actionNewMobility"
|
||||
>
|
||||
</core-filter-cmpt>
|
||||
|
||||
@@ -281,6 +381,7 @@ export default {
|
||||
:teleport="true"
|
||||
>
|
||||
</form-input>
|
||||
|
||||
<form-input
|
||||
container-class="col-6 stv-details-mobility-typ"
|
||||
:label="$p.t('lehre', 'lehrveranstaltung')"
|
||||
@@ -288,13 +389,13 @@ export default {
|
||||
v-model="formData.lehrveranstaltung"
|
||||
name="lehrveranstaltung"
|
||||
>
|
||||
<!-- <option
|
||||
v-for="typ in arrTypen"
|
||||
:key="typ.pruefungstyp_kurzbz"
|
||||
:value="typ.pruefungstyp_kurzbz"
|
||||
<option
|
||||
v-for="lv in listLvs"
|
||||
:key="lv.lehrveranstaltung_id"
|
||||
:value="lv.lehrveranstaltung_id"
|
||||
>
|
||||
{{typ.beschreibung}}
|
||||
</option>-->
|
||||
{{lv.bezeichnung}} - Semester {{lv.semester}}
|
||||
</option>
|
||||
</form-input>
|
||||
</div>
|
||||
|
||||
@@ -333,8 +434,8 @@ export default {
|
||||
container-class="col-6 stv-details-mobility-mobilitaetsprogramm"
|
||||
:label="$p.t('mobility', 'mobilitaetsprogramm')"
|
||||
type="select"
|
||||
v-model="formData.mobilitaetsprogramm"
|
||||
name="mobilitaetsprogramm"
|
||||
v-model="formData.mobilitaetsprogramm_code"
|
||||
name="mobilitaetsprogramm_code"
|
||||
>
|
||||
<option
|
||||
v-for="mob in programsMobility"
|
||||
@@ -347,17 +448,11 @@ export default {
|
||||
<form-input
|
||||
container-class="col-6 stv-details-mobility-ort"
|
||||
:label="$p.t('person', 'ort')"
|
||||
type="select"
|
||||
type="text"
|
||||
v-model="formData.ort"
|
||||
name="ort"
|
||||
>
|
||||
<!-- <option
|
||||
v-for="typ in arrTypen"
|
||||
:key="typ.pruefungstyp_kurzbz"
|
||||
:value="typ.pruefungstyp_kurzbz"
|
||||
>
|
||||
{{typ.beschreibung}}
|
||||
</option>-->
|
||||
|
||||
</form-input>
|
||||
</div>
|
||||
|
||||
@@ -366,7 +461,7 @@ export default {
|
||||
container-class="col-6 stv-details-mobility-gastnation"
|
||||
:label="$p.t('mobility', 'gastnation')"
|
||||
type="select"
|
||||
v-model="formData.gastnation"
|
||||
v-model="formData.nation_code"
|
||||
name="gastnation"
|
||||
>
|
||||
<option
|
||||
@@ -381,9 +476,9 @@ export default {
|
||||
<form-input
|
||||
container-class="col-6 stv-details-mobility-universitaet"
|
||||
:label="$p.t('mobility', 'universitaet')"
|
||||
type="select"
|
||||
v-model="formData.ort"
|
||||
name="ort"
|
||||
type="text"
|
||||
v-model="formData.universitaet"
|
||||
name="universitaet"
|
||||
>
|
||||
|
||||
</form-input>
|
||||
@@ -394,7 +489,7 @@ export default {
|
||||
container-class="col-6 stv-details-mobility-herkunftsland"
|
||||
:label="$p.t('mobility', 'herkunftsland')"
|
||||
type="select"
|
||||
v-model="formData.herkunftsland"
|
||||
v-model="formData.herkunftsland_code"
|
||||
name="herkunftsland"
|
||||
>
|
||||
<option
|
||||
@@ -409,7 +504,7 @@ export default {
|
||||
<form-input
|
||||
container-class="col-3 stv-details-mobility-ects_erworben"
|
||||
:label="$p.t('mobility', 'ects_erworben')"
|
||||
type="input"
|
||||
type="text"
|
||||
v-model="formData.ects_erworben"
|
||||
name="ects_erworben"
|
||||
>
|
||||
@@ -417,7 +512,7 @@ export default {
|
||||
<form-input
|
||||
container-class="col-3 stv-details-mobility-ects_angerechnet"
|
||||
:label="$p.t('mobility', 'ects_angerechnet')"
|
||||
type="input"
|
||||
type="text"
|
||||
v-model="formData.ects_angerechnet"
|
||||
name="ects_angerechnet"
|
||||
>
|
||||
@@ -425,27 +520,38 @@ export default {
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<form-input
|
||||
container-class="col-6 stv-details-mobility-zweck"
|
||||
:label="$p.t('mobility', 'zweck')"
|
||||
type="textarea"
|
||||
v-model="formData.zweck"
|
||||
name="zweck"
|
||||
>
|
||||
</form-input>
|
||||
<form-input
|
||||
<div class="col-6 stv-details-mobility-zweck">
|
||||
<MobilityPurpose
|
||||
:bisio_id="formData.bisio_id"
|
||||
:listPurposes="listPurposes"
|
||||
@deleteMobilityPurpose="deleteMobilityPurpose"
|
||||
@setMobilityPurpose="addMobilityPurpose"
|
||||
@setMobilityPurposeToNewMobility="addPurposeToMobility"
|
||||
ref="purposes"
|
||||
></MobilityPurpose>
|
||||
</div>
|
||||
|
||||
<!-- <div class="col-6 stv-details-mobility-zweck">
|
||||
<LocalPurpose
|
||||
:listPurposes="listPurposes"
|
||||
ref="purposesLocal"
|
||||
></LocalPurpose>
|
||||
</div>-->
|
||||
|
||||
|
||||
<!-- <form-input
|
||||
container-class="col-6 stv-details-mobility-aufenthalt"
|
||||
:label="$p.t('mobility', 'aufenthalt')"
|
||||
type="textarea"
|
||||
v-model="formData.aufenthalt"
|
||||
name="aufenthalt"
|
||||
>
|
||||
</form-input>
|
||||
</form-input>-->
|
||||
</div>
|
||||
|
||||
<div class="text-end mb-3">
|
||||
<button v-if="statusNew" class="btn btn-primary" @click="addNewMobility()"> {{$p.t('ui', 'speichern')}}</button>
|
||||
<button v-else class="btn btn-primary" @click="updateMobility(formData.mobility_id)"> {{$p.t('ui', 'speichern')}}</button>
|
||||
<button v-else class="btn btn-primary" @click="updateMobility(formData.bisio_id)"> {{$p.t('ui', 'speichern')}}</button>
|
||||
</div>
|
||||
|
||||
</form-form>
|
||||
|
||||
Reference in New Issue
Block a user