mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
child components Zweck/Purpose and Aufenthaltsfoerderung/Support
This commit is contained in:
@@ -17,12 +17,13 @@ class Mobility extends FHCAPI_Controller
|
||||
'getProgramsMobility' => ['admin:r', 'assistenz:r'],
|
||||
'getLVList' => ['admin:r', 'assistenz:r'],
|
||||
'getPurposes' => ['admin:r', 'assistenz:r'],
|
||||
'getSupports' => ['admin:r', 'assistenz:r'],
|
||||
'getListPurposes' => ['admin:r', 'assistenz:r'],
|
||||
'getListSupports' => ['admin:r', 'assistenz:r'],
|
||||
'deleteMobilityPurpose' => ['admin:r', 'assistenz:r'],
|
||||
'addMobilityPurpose' => ['admin:r', 'assistenz:r'],
|
||||
|
||||
|
||||
'deleteMobilitySupport' => ['admin:r', 'assistenz:r'],
|
||||
'addMobilitySupport' => ['admin:r', 'assistenz:r'],
|
||||
]);
|
||||
|
||||
// Load Libraries
|
||||
@@ -73,14 +74,15 @@ class Mobility extends FHCAPI_Controller
|
||||
$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;
|
||||
$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;
|
||||
$localSupports = (isset($formData['localSupports']) && !empty($formData['localSupports'])) ? $formData['localSupports'] : null;
|
||||
|
||||
|
||||
//strange fields
|
||||
@@ -110,14 +112,19 @@ $localPurposes = (isset($formData['localPurposes']) && !empty($formData['localPu
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
||||
//check if localData (supports)
|
||||
if(count($localSupports) > 0){
|
||||
foreach ($localSupports as $support){
|
||||
$this->addMobilitySupport($bisio_id, $support);
|
||||
}
|
||||
}
|
||||
|
||||
$this->terminateWithSuccess();
|
||||
}
|
||||
|
||||
@@ -169,7 +176,7 @@ $localPurposes = (isset($formData['localPurposes']) && !empty($formData['localPu
|
||||
);
|
||||
|
||||
//TODO(Manu) foreign key restraint
|
||||
//nämlich Extension mo
|
||||
//check Extension mo
|
||||
//fk_mobisioidzuordnung_prestudent_id" on table "tbl_mo_bisioidzuordnung"
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
@@ -206,6 +213,24 @@ $localPurposes = (isset($formData['localPurposes']) && !empty($formData['localPu
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
public function getSupports($bisio_id)
|
||||
{
|
||||
$bisio_id = (int) $bisio_id;
|
||||
|
||||
$this->load->model('codex/Bisioaufenthaltfoerderung_model', 'BisioaufenthaltfoerderungModel');
|
||||
|
||||
$this->BisioaufenthaltfoerderungModel->addSelect("*");
|
||||
$this->BisioaufenthaltfoerderungModel->addJoin('bis.tbl_aufenthaltfoerderung af', 'ON (af.aufenthaltfoerderung_code = bis.tbl_bisio_aufenthaltfoerderung.aufenthaltfoerderung_code)');
|
||||
|
||||
$result = $this->BisioaufenthaltfoerderungModel->loadWhere(
|
||||
array('bisio_id' => $bisio_id)
|
||||
);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
public function getListPurposes()
|
||||
{
|
||||
$this->load->model('codex/Zweck_model', 'ZweckModel');
|
||||
@@ -268,4 +293,43 @@ $localPurposes = (isset($formData['localPurposes']) && !empty($formData['localPu
|
||||
|
||||
return $this->terminateWithSuccess(current($data));
|
||||
}
|
||||
|
||||
public function addMobilitySupport($bisio_id, $local_support = null)
|
||||
{
|
||||
$aufenthaltfoerderung_code = $this->input->post('aufenthaltfoerderung_code');
|
||||
|
||||
if($local_support){
|
||||
$aufenthaltfoerderung_code = $local_support;
|
||||
}
|
||||
|
||||
$this->load->model('codex/Bisioaufenthaltfoerderung_model', 'BisioaufenthaltfoerderungModel');
|
||||
|
||||
$result = $this->BisioaufenthaltfoerderungModel->insert(
|
||||
array(
|
||||
'bisio_id' => $bisio_id,
|
||||
'aufenthaltfoerderung_code' => $aufenthaltfoerderung_code
|
||||
)
|
||||
);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
return $this->terminateWithSuccess(current($data));
|
||||
}
|
||||
|
||||
public function deleteMobilitySupport($bisio_id)
|
||||
{
|
||||
$aufenthaltfoerderung_code = $this->input->post('aufenthaltfoerderung_code');
|
||||
|
||||
$this->load->model('codex/Bisioaufenthaltfoerderung_model', 'BisioaufenthaltfoerderungModel');
|
||||
|
||||
$result = $this->BisioaufenthaltfoerderungModel->delete(
|
||||
array(
|
||||
'bisio_id' => $bisio_id,
|
||||
'aufenthaltfoerderung_code' => $aufenthaltfoerderung_code
|
||||
)
|
||||
);
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
return $this->terminateWithSuccess(current($data));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ export default {
|
||||
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){
|
||||
@@ -22,10 +21,11 @@ export default {
|
||||
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);
|
||||
},
|
||||
getSupports(url, config, params){
|
||||
return this.$fhcApi.get('api/frontend/v1/stv/mobility/getSupports/' + params.id);
|
||||
},
|
||||
getListPurposes() {
|
||||
return this.$fhcApi.get('api/frontend/v1/stv/mobility/getListPurposes/');
|
||||
},
|
||||
@@ -38,5 +38,11 @@ export default {
|
||||
addMobilityPurpose(params) {
|
||||
return this.$fhcApi.post('api/frontend/v1/stv/mobility/addMobilityPurpose/' + params.bisio_id, params);
|
||||
},
|
||||
deleteMobilitySupport(params) {
|
||||
return this.$fhcApi.post('api/frontend/v1/stv/mobility/deleteMobilitySupport/' + params.bisio_id, params);
|
||||
},
|
||||
addMobilitySupport(params) {
|
||||
return this.$fhcApi.post('api/frontend/v1/stv/mobility/addMobilitySupport/' + params.bisio_id, params);
|
||||
},
|
||||
|
||||
}
|
||||
@@ -20,29 +20,46 @@ export default {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
formDataParent: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tabulatorOptions: {
|
||||
ajaxURL: 'dummy',
|
||||
ajaxRequestFunc: this.$fhcApi.factory.stv.mobility.getPurposes,
|
||||
ajaxRequestFunc: (url, config, params) => {
|
||||
if (this.bisio_id) {
|
||||
//fake params for getting api call with tabulator to run
|
||||
const config = {
|
||||
method: "get",
|
||||
};
|
||||
const params = {
|
||||
id: this.bisio_id,
|
||||
};
|
||||
return this.$fhcApi.factory.stv.mobility.getPurposes('dummy', config, params)
|
||||
}
|
||||
else
|
||||
{
|
||||
// use local data
|
||||
return new Promise((resolve) => {
|
||||
const localData = this.localData;
|
||||
resolve(localData);
|
||||
});
|
||||
}
|
||||
},
|
||||
ajaxParams: () => {
|
||||
return {
|
||||
id: this.bisio_id
|
||||
id: this.bisio_id || "local"
|
||||
};
|
||||
},
|
||||
ajaxResponse: (url, params, response) => response.data,
|
||||
ajaxResponse: (url, params, response) => response.data || this.localData,
|
||||
|
||||
|
||||
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,
|
||||
minWidth: 50,
|
||||
formatter: (cell, formatterParams, onRendered) => {
|
||||
|
||||
let container = document.createElement('div');
|
||||
@@ -66,7 +83,7 @@ export default {
|
||||
],
|
||||
layout: 'fitColumns',
|
||||
layoutColumnsOnNewData: false,
|
||||
height: '300',
|
||||
height: '200',
|
||||
selectableRangeMode: 'click',
|
||||
selectable: true,
|
||||
persistenceID: 'core-mobility-purpose'
|
||||
@@ -76,104 +93,35 @@ export default {
|
||||
event: 'tableBuilt',
|
||||
handler: async() => {
|
||||
|
||||
await this.$p.loadCategory(['ui', 'global', 'vertrag']);
|
||||
/*
|
||||
await this.$p.loadCategory(['ui', 'global', 'mobility']);
|
||||
|
||||
let cm = this.$refs.table.tabulator.columnManager;
|
||||
|
||||
cm.getColumnByField('bezeichnung').component.updateDefinition({
|
||||
title: this.$p.t('global', 'status')
|
||||
title: this.$p.t('ui', 'bezeichnung')
|
||||
});
|
||||
cm.getColumnByField('format_datum').component.updateDefinition({
|
||||
title: this.$p.t('global', 'datum')
|
||||
cm.getColumnByField('kurzbz').component.updateDefinition({
|
||||
title: this.$p.t('mobility', 'kurzbz')
|
||||
});
|
||||
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({
|
||||
/* 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: []
|
||||
formData: {
|
||||
zweck_code: ""
|
||||
},
|
||||
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() {
|
||||
@@ -181,10 +129,21 @@ export default {
|
||||
this.$refs.mobilityPurpose.show();
|
||||
},
|
||||
actionDeletePurpose(zweck_code) {
|
||||
this.$emit('deleteMobilityPurpose', {
|
||||
bisio_id: this.bisio_id,
|
||||
zweck_code: zweck_code
|
||||
});
|
||||
if (this.bisio_id)
|
||||
{
|
||||
this.$emit('deleteMobilityPurpose', {
|
||||
bisio_id: this.bisio_id,
|
||||
zweck_code: zweck_code
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
const index = this.localData.findIndex(item => item.zweck_code === zweck_code);
|
||||
|
||||
if (index !== -1) {
|
||||
this.localData.splice(index, 1);
|
||||
}
|
||||
}
|
||||
},
|
||||
handleSubmitAction() {
|
||||
if (this.bisio_id) {
|
||||
@@ -194,11 +153,14 @@ export default {
|
||||
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);
|
||||
const purpose = this.listPurposes.find(item => item.zweck_code === this.formData.zweck_code);
|
||||
const newEntry = {
|
||||
zweck_code: this.formData.zweck_code,
|
||||
kurzbz: purpose.kurzbz,
|
||||
bezeichnung: purpose.bezeichnung
|
||||
};
|
||||
this.localData.push(newEntry);
|
||||
|
||||
this.$emit('setMobilityPurposeToNewMobility', {
|
||||
zweck_code: this.formData.zweck_code,
|
||||
});
|
||||
@@ -220,19 +182,13 @@ export default {
|
||||
},
|
||||
resetModal(){
|
||||
this.formData = {};
|
||||
this.formData.vertragsstatus_kurzbz = null;
|
||||
this.formData.datum = new Date();
|
||||
this.statusNew = true;
|
||||
this.formData.zweck_code = null;
|
||||
}
|
||||
},
|
||||
template: `
|
||||
<div class="core-mobility-puprpose h-50 d-flex flex-column w-100 mt-2">
|
||||
<div class="core-mobility-purpose 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"
|
||||
@@ -249,7 +205,7 @@ export default {
|
||||
<div >
|
||||
<bs-modal ref="mobilityPurpose">
|
||||
<template #title>
|
||||
<p class="fw-bold mt-3">neuer Zweck</p>
|
||||
<p class="fw-bold mt-3">{{$p.t('mobility', 'zweck_neu')}}</p>
|
||||
|
||||
</template>
|
||||
|
||||
@@ -259,9 +215,9 @@ export default {
|
||||
type="select"
|
||||
:label="$p.t('mobility/zweck')"
|
||||
v-model="formData.zweck_code"
|
||||
name="zweck"
|
||||
name="zweck_code"
|
||||
>
|
||||
<option default>{{$p.t('ui', 'bitteWaehlen')}}</option>
|
||||
<option :value="null"> {{$p.t('ui', 'bitteWaehlen')}}</option>
|
||||
<option
|
||||
v-for="entry in listPurposes"
|
||||
:key="entry.zweck_code"
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
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
|
||||
},
|
||||
listSupports: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tabulatorOptions: {
|
||||
ajaxURL: 'dummy',
|
||||
ajaxRequestFunc: (url, config, params) => {
|
||||
if (this.bisio_id) {
|
||||
//fake params for getting api call with tabulator to run
|
||||
const config = {
|
||||
method: "get",
|
||||
};
|
||||
const params = {
|
||||
id: this.bisio_id,
|
||||
};
|
||||
return this.$fhcApi.factory.stv.mobility.getSupports('dummy', config, params)
|
||||
}
|
||||
else
|
||||
{
|
||||
// use local data
|
||||
return new Promise((resolve) => {
|
||||
const localData = this.localData;
|
||||
resolve(localData);
|
||||
});
|
||||
}
|
||||
},
|
||||
ajaxParams: () => {
|
||||
return {
|
||||
id: this.bisio_id || "local"
|
||||
};
|
||||
},
|
||||
ajaxResponse: (url, params, response) => response.data || this.localData,
|
||||
|
||||
columns: [
|
||||
{title: "Aufenthaltsförderung_code", field: "aufenthaltfoerderung_code", visible: false},
|
||||
{title: "Bezeichnung", field: "bezeichnung"},
|
||||
{
|
||||
title: 'Aktionen', field: 'actions',
|
||||
minWidth: 50,
|
||||
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.actionDeleteSupport(cell.getData().aufenthaltfoerderung_code)
|
||||
);
|
||||
container.append(button);
|
||||
|
||||
return container;
|
||||
},
|
||||
frozen: true
|
||||
},
|
||||
],
|
||||
layout: 'fitColumns',
|
||||
layoutColumnsOnNewData: false,
|
||||
height: '200',
|
||||
selectableRangeMode: 'click',
|
||||
selectable: true,
|
||||
persistenceID: 'core-mobility-support'
|
||||
},
|
||||
tabulatorEvents: [
|
||||
{
|
||||
event: 'tableBuilt',
|
||||
handler: async() => {
|
||||
|
||||
await this.$p.loadCategory(['ui', 'global', 'mobility']);
|
||||
|
||||
let cm = this.$refs.table.tabulator.columnManager;
|
||||
|
||||
cm.getColumnByField('bezeichnung').component.updateDefinition({
|
||||
title: this.$p.t('ui', 'bezeichnung')
|
||||
});
|
||||
/* cm.getColumnByField('actions').component.updateDefinition({
|
||||
title: this.$p.t('global', 'aktionen')
|
||||
});*/
|
||||
}
|
||||
}
|
||||
],
|
||||
clickedRows: [],
|
||||
formData: {
|
||||
aufenthaltfoerderung_code: "",
|
||||
},
|
||||
localData: [],
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
bisio_id() {
|
||||
if (this.$refs.table) {
|
||||
this.$refs.table.reloadTable();
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
actionNewSupport() {
|
||||
this.resetModal();
|
||||
this.$refs.mobilitySupport.show();
|
||||
},
|
||||
actionDeleteSupport(aufenthaltfoerderung_code) {
|
||||
if (this.bisio_id)
|
||||
{
|
||||
this.$emit('deleteMobilitySupport', {
|
||||
bisio_id: this.bisio_id,
|
||||
aufenthaltfoerderung_code: aufenthaltfoerderung_code
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
const index = this.localData.findIndex(item => item.aufenthaltfoerderung_code === aufenthaltfoerderung_code);
|
||||
|
||||
if (index !== -1) {
|
||||
this.localData.splice(index, 1);
|
||||
}
|
||||
}
|
||||
},
|
||||
handleSubmitAction() {
|
||||
if (this.bisio_id) {
|
||||
this.$emit('setMobilitySupport', {
|
||||
aufenthaltfoerderung_code: this.formData.aufenthaltfoerderung_code,
|
||||
bisio_id: this.bisio_id
|
||||
});
|
||||
} else {
|
||||
const support = this.listSupports.find(item => item.aufenthaltfoerderung_code === this.formData.aufenthaltfoerderung_code);
|
||||
const newEntry = {
|
||||
aufenthaltfoerderung_code: this.formData.aufenthaltfoerderung_code,
|
||||
bezeichnung: support.bezeichnung
|
||||
};
|
||||
this.localData.push(newEntry);
|
||||
|
||||
this.$emit('setMobilitySupportToNewMobility', {
|
||||
aufenthaltfoerderung_code: this.formData.aufenthaltfoerderung_code,
|
||||
});
|
||||
}
|
||||
this.closeModal();
|
||||
},
|
||||
|
||||
closeModal(){
|
||||
this.$refs.mobilitySupport.hide();
|
||||
this.$emit('close-modal');
|
||||
},
|
||||
openModal(){
|
||||
this.$refs.mobilitySupport.show();
|
||||
this.$emit('open-modal');
|
||||
},
|
||||
reload() {
|
||||
this.$refs.table.reloadTable();
|
||||
this.$emit('reload');
|
||||
},
|
||||
resetModal(){
|
||||
this.formData = {};
|
||||
this.formData.aufenthaltfoerderung_code = null;
|
||||
}
|
||||
},
|
||||
template: `
|
||||
<div class="core-mobility-support h-50 d-flex flex-column w-100 mt-2">
|
||||
<br>
|
||||
|
||||
<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', 'aufenthalt')"
|
||||
@click:new="actionNewSupport"
|
||||
>
|
||||
</core-filter-cmpt>
|
||||
|
||||
<div>
|
||||
<bs-modal ref="mobilitySupport">
|
||||
<template #title>
|
||||
<p class="fw-bold mt-3">{{$p.t('mobility', 'foerderung_neu')}}</p>
|
||||
</template>
|
||||
|
||||
<core-form ref="mobilityData">
|
||||
<div class="row mb-3">
|
||||
<form-input
|
||||
type="select"
|
||||
:label="$p.t('mobility/aufenthalt')"
|
||||
v-model="formData.aufenthaltfoerderung_code"
|
||||
name="aufenthaltfoerderung_code"
|
||||
>
|
||||
<option :value="null"> {{$p.t('ui', 'bitteWaehlen')}}</option>
|
||||
<option
|
||||
v-for="entry in listSupports"
|
||||
:key="entry.aufenthaltfoerderung_code"
|
||||
:value="entry.aufenthaltfoerderung_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>`
|
||||
}
|
||||
@@ -3,7 +3,8 @@ 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';
|
||||
import MobilitySupport from './List/Support.js';
|
||||
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -12,7 +13,7 @@ export default {
|
||||
FormForm,
|
||||
FormInput,
|
||||
MobilityPurpose,
|
||||
// LocalPurpose
|
||||
MobilitySupport
|
||||
},
|
||||
inject: {
|
||||
$reloadList: {
|
||||
@@ -81,6 +82,13 @@ export default {
|
||||
persistenceID: 'stv-details-table_mobiliy'
|
||||
},
|
||||
tabulatorEvents: [
|
||||
{
|
||||
event: 'dataLoaded',
|
||||
handler: data => this.tabulatorData = data.map(item => {
|
||||
// item.actionDiv = document.createElement('div');
|
||||
return item;
|
||||
}),
|
||||
},
|
||||
{
|
||||
event: 'tableBuilt',
|
||||
handler: async() => {
|
||||
@@ -89,50 +97,25 @@ export default {
|
||||
|
||||
let cm = this.$refs.table.tabulator.columnManager;
|
||||
|
||||
// cm.getColumnByField('vorsitz_nachname').component.updateDefinition({
|
||||
// title: this.$p.t('mobility', 'vorsitz_header')
|
||||
// });
|
||||
// cm.getColumnByField('beurteilung_bezeichnung').component.updateDefinition({
|
||||
// title: this.$p.t('mobility', 'abschlussbeurteilung')
|
||||
// });
|
||||
// cm.getColumnByField('p1_nachname').component.updateDefinition({
|
||||
// title: this.$p.t('mobility', 'pruefer1')
|
||||
// });
|
||||
// cm.getColumnByField('p2_nachname').component.updateDefinition({
|
||||
// title: this.$p.t('mobility', 'pruefer2')
|
||||
// });
|
||||
// cm.getColumnByField('p3_nachname').component.updateDefinition({
|
||||
// title: this.$p.t('mobility', 'pruefer3')
|
||||
// });
|
||||
// cm.getColumnByField('format_datum').component.updateDefinition({
|
||||
// title: this.$p.t('global', 'datum')
|
||||
// });
|
||||
// cm.getColumnByField('uhrzeit').component.updateDefinition({
|
||||
// title: this.$p.t('global', 'uhrzeit')
|
||||
// });
|
||||
// cm.getColumnByField('format_freigabedatum').component.updateDefinition({
|
||||
// title: this.$p.t('mobility', 'freigabe')
|
||||
// });
|
||||
// cm.getColumnByField('antritt_bezeichnung').component.updateDefinition({
|
||||
// title: this.$p.t('mobility', 'pruefungsantritt')
|
||||
// });
|
||||
// cm.getColumnByField('format_sponsion').component.updateDefinition({
|
||||
// title: this.$p.t('mobility', 'sponsion')
|
||||
// });
|
||||
// cm.getColumnByField('anmerkung').component.updateDefinition({
|
||||
// title: this.$p.t('global', 'anmerkung')
|
||||
// });
|
||||
// cm.getColumnByField('pruefungstyp_kurzbz').component.updateDefinition({
|
||||
// title: this.$p.t('global', 'typ')
|
||||
// });
|
||||
// cm.getColumnByField('bisio_id').component.updateDefinition({
|
||||
// title: this.$p.t('ui', 'bisio_id')
|
||||
// });
|
||||
/*
|
||||
cm.getColumnByField('actions').component.updateDefinition({
|
||||
cm.getColumnByField('kurzbz').component.updateDefinition({
|
||||
title: this.$p.t('mobility', 'kurzbz_program')
|
||||
});
|
||||
cm.getColumnByField('nation_code').component.updateDefinition({
|
||||
title: this.$p.t('mobility', 'gastnation')
|
||||
});
|
||||
cm.getColumnByField('format_von').component.updateDefinition({
|
||||
title: this.$p.t('ui', 'von')
|
||||
});
|
||||
cm.getColumnByField('format_bis').component.updateDefinition({
|
||||
title: this.$p.t('global', 'bis')
|
||||
});
|
||||
cm.getColumnByField('bisio_id').component.updateDefinition({
|
||||
title: this.$p.t('mobility', 'bisio_id')
|
||||
});
|
||||
|
||||
/* cm.getColumnByField('actions').component.updateDefinition({
|
||||
title: this.$p.t('global', 'aktionen')
|
||||
});
|
||||
*/
|
||||
});*/
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -140,16 +123,18 @@ export default {
|
||||
von: new Date(),
|
||||
bis: new Date(),
|
||||
mobilitaetsprogramm_code: 7,
|
||||
gastnation: 'A',
|
||||
herkunftsland: 'A',
|
||||
nation_code: 'A',
|
||||
herkunftsland_code: 'A',
|
||||
bisio_id: null,
|
||||
localPurposes: []
|
||||
localPurposes: [],
|
||||
localSupports: []
|
||||
},
|
||||
statusNew: true,
|
||||
programsMobility: [],
|
||||
listLvs: [],
|
||||
listPurposes: [],
|
||||
listSupports: [],
|
||||
tabulatorData: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -163,11 +148,9 @@ export default {
|
||||
actionNewMobility() {
|
||||
this.resetForm();
|
||||
this.statusNew = true;
|
||||
//this.setDefaultFormData();
|
||||
},
|
||||
actionEditMobility(bisio_id) {
|
||||
this.resetForm();
|
||||
// this.formData.bisio_id = bisio_id;
|
||||
this.statusNew = false;
|
||||
this.loadMobility(bisio_id);
|
||||
},
|
||||
@@ -177,22 +160,15 @@ export default {
|
||||
.then(result => result
|
||||
? bisio_id
|
||||
: Promise.reject({handled: true}))
|
||||
.then(this.deleteMobility(bisio_id))
|
||||
.then(this.deleteMobility)
|
||||
.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.$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();
|
||||
@@ -208,10 +184,7 @@ export default {
|
||||
loadMobility(bisio_id) {
|
||||
return this.$fhcApi.factory.stv.mobility.loadMobility(bisio_id)
|
||||
.then(result => {
|
||||
|
||||
this.formData = result.data;
|
||||
console.log("after");
|
||||
//return result;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
@@ -231,7 +204,6 @@ export default {
|
||||
});
|
||||
},
|
||||
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'));
|
||||
@@ -246,12 +218,13 @@ export default {
|
||||
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.nation_code = 'A';
|
||||
this.formData.herkunftsland_code = 'A';
|
||||
this.formData.bisio_id = null;
|
||||
this.formData.localPurposes = [];
|
||||
this.formData.localSupports = [];
|
||||
},
|
||||
// --- methods purposes ---
|
||||
// ----------------------------------- methods purposes -----------------------------------
|
||||
addMobilityPurpose({zweck_code, bisio_id}){
|
||||
let params = {
|
||||
bisio_id : bisio_id,
|
||||
@@ -279,36 +252,38 @@ export default {
|
||||
.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
|
||||
});
|
||||
// ----------------------------------- methods supports -----------------------------------
|
||||
addMobilitySupport({aufenthaltfoerderung_code, bisio_id}){
|
||||
let params = {
|
||||
bisio_id : bisio_id,
|
||||
aufenthaltfoerderung_code: aufenthaltfoerderung_code
|
||||
};
|
||||
return this.$fhcApi.factory.stv.mobility.addMobilitySupport(params)
|
||||
.then(response => {
|
||||
this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave'));
|
||||
|
||||
// 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.$refs.supports.reload();
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
deleteMobilitySupport({aufenthaltfoerderung_code, bisio_id}){
|
||||
let params = {
|
||||
bisio_id : bisio_id,
|
||||
aufenthaltfoerderung_code: aufenthaltfoerderung_code
|
||||
};
|
||||
return this.$fhcApi.factory.stv.mobility.deleteMobilitySupport(params)
|
||||
.then(response => {
|
||||
this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete'));
|
||||
|
||||
this.updateTabulatorData();
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Speichern der Änderungen:', error);
|
||||
}
|
||||
},*/
|
||||
this.$refs.supports.reload();
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
addSupportToMobility({aufenthaltfoerderung_code}){
|
||||
this.formData.localSupports.push(aufenthaltfoerderung_code);
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.$fhcApi.factory.stv.mobility.getProgramsMobility()
|
||||
@@ -334,19 +309,7 @@ export default {
|
||||
},
|
||||
template: `
|
||||
<div class="stv-details-mobility h-100 pb-3">
|
||||
<h4>In/out</h4>
|
||||
|
||||
<!-- {{listSupports}}-->
|
||||
<hr>
|
||||
{{formData}}
|
||||
<!--
|
||||
<hr>
|
||||
|
||||
{{listPurposes}}-->
|
||||
|
||||
<!-- {{programsMobility}}-->
|
||||
<!-- {{listLvs}}-->
|
||||
|
||||
<h4>In / Out</h4>
|
||||
|
||||
<core-filter-cmpt
|
||||
ref="table"
|
||||
@@ -356,7 +319,7 @@ export default {
|
||||
:side-menu="false"
|
||||
reload
|
||||
new-btn-show
|
||||
new-btn-label="Mobilität"
|
||||
:new-btn-label="this.$p.t('stv', 'tab_mobility')"
|
||||
@click:new="actionNewMobility"
|
||||
>
|
||||
</core-filter-cmpt>
|
||||
@@ -462,7 +425,7 @@ export default {
|
||||
:label="$p.t('mobility', 'gastnation')"
|
||||
type="select"
|
||||
v-model="formData.nation_code"
|
||||
name="gastnation"
|
||||
name="nation_code"
|
||||
>
|
||||
<option
|
||||
v-for="nation in lists.nations"
|
||||
@@ -490,7 +453,7 @@ export default {
|
||||
:label="$p.t('mobility', 'herkunftsland')"
|
||||
type="select"
|
||||
v-model="formData.herkunftsland_code"
|
||||
name="herkunftsland"
|
||||
name="herkunftsland_code"
|
||||
>
|
||||
<option
|
||||
v-for="nation in lists.nations"
|
||||
@@ -531,22 +494,16 @@ export default {
|
||||
></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>-->
|
||||
<div class="col-6 stv-details-mobility-aufenthaltfoerderung">
|
||||
<MobilitySupport
|
||||
:bisio_id="formData.bisio_id"
|
||||
:listSupports="listSupports"
|
||||
@deleteMobilitySupport="deleteMobilitySupport"
|
||||
@setMobilitySupport="addMobilitySupport"
|
||||
@setMobilitySupportToNewMobility="addSupportToMobility"
|
||||
ref="supports"
|
||||
></MobilitySupport>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-end mb-3">
|
||||
|
||||
@@ -37459,6 +37459,106 @@ array(
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'mobility',
|
||||
'phrase' => 'zweck_neu',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Mobilitätszweck anlegen',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'Create motivation for mobility',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'mobility',
|
||||
'phrase' => 'foerderung_neu',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Förderung für Aufenthalt anlegen',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'Create funding for mobility',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'mobility',
|
||||
'phrase' => 'kurzbz_program',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Programmkurzbezeichnung',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'Program short description',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'mobility',
|
||||
'phrase' => 'bisio_id',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Bisio ID',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'Bisio ID',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'mobility',
|
||||
'phrase' => 'kurzbz',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Kurzbezeichnung',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'Short Name',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
// FHC4 Phrases Mobility End
|
||||
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user