mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-14 18:49:28 +00:00
Prestudent: Form und Save/Upload Logic
This commit is contained in:
@@ -38,6 +38,114 @@ class Prestudent extends FHC_Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function updatePrestudent($prestudent_id)
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
/* $result = $this->PrestudentModel->loadWhere(['prestudent_id' =>$prestudent_id]);
|
||||
if (isError($result)) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson(getError($result));
|
||||
} elseif (!hasData($result)) {
|
||||
return $this->outputJson(getError($result));
|
||||
} else {
|
||||
$prestudentData = current(getData($result));
|
||||
}
|
||||
|
||||
var_dump($prestudentData);*/
|
||||
|
||||
$_POST = json_decode(utf8_encode($this->input->raw_input_stream), true);
|
||||
$deltaData = $_POST[0];
|
||||
|
||||
if(!$prestudent_id)
|
||||
{
|
||||
return $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
//Todo(manu) updateamum, updatevon ergänzen
|
||||
$uid = getAuthUID();
|
||||
|
||||
$array_allowed_props_prestudent = [
|
||||
'aufmerksamdurch_kurzbz',
|
||||
'studiengang_kz',
|
||||
'gsstudientyp_kurzbz',
|
||||
'person_id',
|
||||
'berufstaetigkeit_code',
|
||||
'ausbildungcode',
|
||||
'zgv_code',
|
||||
'zgvort',
|
||||
'zgvdatum',
|
||||
'zgvnation',
|
||||
'zgvmas_code',
|
||||
'zgvmaort',
|
||||
'zgvmadatum',
|
||||
'zgvmanation',
|
||||
'facheinschlberuf',
|
||||
'bismelden',
|
||||
'anmerkung',
|
||||
'dual',
|
||||
'zgvdoktor_code', //Todo(Manu) tabelle leer? db zum testen
|
||||
'zgvdoktorort',
|
||||
'zgvdoktordatum',
|
||||
'zgvdoktornation',
|
||||
'aufnahmegruppe_kurzbz',
|
||||
'priorisierung',
|
||||
'foerderrelevant',
|
||||
'zgv_erfuellt',
|
||||
'zgvmas_erfuellt',
|
||||
'zgvdoktor_erfuellt',
|
||||
'mentor',
|
||||
'aufnahmeschluessel',
|
||||
'standort_code'
|
||||
];
|
||||
|
||||
/* foreach ($array_allowed_props_prestudent as $prop)
|
||||
{
|
||||
|
||||
|
||||
}*/
|
||||
|
||||
/* "insertamum": "2021-05-27 13:03:08",
|
||||
"insertvon": "online",
|
||||
"updateamum": "2022-10-10 15:37:31.903056",
|
||||
"updatevon": "poeckl", "ext_id": null,*/
|
||||
|
||||
$update_prestudent = array();
|
||||
foreach ($array_allowed_props_prestudent as $prop)
|
||||
{
|
||||
$val = isset($deltaData[$prop]) ? $deltaData[$prop] : null;
|
||||
if ($val !== null) {
|
||||
$update_prestudent[$prop] = $val;
|
||||
}
|
||||
}
|
||||
/*
|
||||
var_dump("update Array");
|
||||
var_dump($update_prestudent);*/
|
||||
|
||||
|
||||
|
||||
if (count($update_prestudent) && $prestudent_id === null) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_BAD_REQUEST);
|
||||
// TODO(manu): phrase
|
||||
return $this->outputJson("Kein/e PrestudentIn vorhanden!");
|
||||
}
|
||||
|
||||
if (count($update_prestudent))
|
||||
{
|
||||
$result = $this->PrestudentModel->update(
|
||||
$prestudent_id,
|
||||
$update_prestudent
|
||||
);
|
||||
if (isError($result)) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson(getError($result));
|
||||
}
|
||||
return $this->outputJsonSuccess(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getBezeichnungZgv(){
|
||||
$this->load->model('codex/Zgv_model', 'ZgvModel');
|
||||
|
||||
@@ -50,6 +158,30 @@ class Prestudent extends FHC_Controller
|
||||
$this->outputJson($result);
|
||||
}
|
||||
|
||||
public function getBezeichnungDZgv(){
|
||||
$this->load->model('codex/Zgvdoktor_model', 'ZgvdoktorModel');
|
||||
|
||||
$this->ZgvdoktorModel->addOrder('zgvdoktor_code');
|
||||
|
||||
$result = $this->ZgvdoktorModel->load();
|
||||
if (isError($result)) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
$this->outputJson($result);
|
||||
}
|
||||
|
||||
public function getBezeichnungMZgv(){
|
||||
$this->load->model('codex/Zgvmaster_model', 'ZgvmasterModel');
|
||||
|
||||
$this->ZgvmasterModel->addOrder('zgvmas_code');
|
||||
|
||||
$result = $this->ZgvmasterModel->load();
|
||||
if (isError($result)) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
$this->outputJson($result);
|
||||
}
|
||||
|
||||
public function getAusbildung(){
|
||||
$this->load->model('codex/Ausbildung_model', 'AusbildungModel');
|
||||
|
||||
@@ -87,6 +219,7 @@ class Prestudent extends FHC_Controller
|
||||
}
|
||||
|
||||
public function getTypenStg(){
|
||||
//TODO(manu) hier soll bis.tbl_gsstudientyp herangezogen werden
|
||||
$this->load->model('organisation/Studiengangstyp_model', 'StudiengangstypModel');
|
||||
|
||||
$this->StudiengangstypModel->addOrder('typ');
|
||||
|
||||
@@ -18,46 +18,89 @@ export default {
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
config: {},
|
||||
data: [],
|
||||
listZgvs: [],
|
||||
listZgvsmaster: [],
|
||||
listZgvsdoktor: [],
|
||||
listStgs: [],
|
||||
listAusbildung: [],
|
||||
listAufmerksamdurch: [],
|
||||
listBerufe: [],
|
||||
listStgTyp: [],
|
||||
listFoerderrelevant: []
|
||||
listFoerderrelevant: [],
|
||||
initialFormData: {},
|
||||
deltaArray: [],
|
||||
actionUpdate: false
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
|
||||
methods: {
|
||||
loadData(prestudent_id){
|
||||
console.log("prestudent_id: " + prestudent_id);
|
||||
return CoreRESTClient.get('components/stv/Zusatzfelder/loadData/' + prestudent_id)
|
||||
.then(
|
||||
result => {
|
||||
if(result)
|
||||
this.data = result.data.retval;
|
||||
else
|
||||
{
|
||||
this.data = [];
|
||||
this.$fhcAlert.alertError('Keine Prestudent_id ' + prestudent_id + ' gefunden');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
);
|
||||
},
|
||||
updatePrestudent() {
|
||||
loadPrestudent() {
|
||||
CoreRESTClient
|
||||
.get('components/stv/Prestudent/get/' + this.modelValue.prestudent_id)
|
||||
.then(result => result.data)
|
||||
.then(result => {
|
||||
this.data = result;
|
||||
console.log(result);
|
||||
//neue DataVariable um ein Delta der vorgenommenen Änderungen berechnen zu können
|
||||
this.initialFormData = {...this.data};
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
updatePrestudent(){
|
||||
this.detectChanges();
|
||||
|
||||
/* this.$nextTick(() => {
|
||||
|
||||
if (this.actionUpdate) {
|
||||
console.log("Action");*/
|
||||
//todo(manu) checken, ob überhaupt eine Änderung vorgenommen wurde
|
||||
CoreRESTClient.post('components/stv/Prestudent/updatePrestudent/' + this.modelValue.prestudent_id,
|
||||
this.deltaArray
|
||||
).then(response => {
|
||||
if (!response.data.error) {
|
||||
this.$fhcAlert.alertSuccess('Speichern erfolgreich');
|
||||
this.deltaArray = [];
|
||||
this.actionUpdate = false;
|
||||
} else {
|
||||
const errorData = response.data.retval;
|
||||
Object.entries(errorData).forEach(entry => {
|
||||
const [key, value] = entry;
|
||||
this.$fhcAlert.alertError(value);
|
||||
});
|
||||
}
|
||||
}).catch(error => {
|
||||
this.statusMsg = 'Error in Catch';
|
||||
this.$fhcAlert.alertError('Fehler bei Speicherroutine aufgetreten');
|
||||
}).finally(() => {
|
||||
window.scrollTo(0, 0);
|
||||
});
|
||||
|
||||
/* } else {
|
||||
console.log("no action");
|
||||
}
|
||||
});*/
|
||||
|
||||
|
||||
|
||||
},
|
||||
detectChanges() {
|
||||
const delta = {};
|
||||
for (const key in this.data) {
|
||||
if (this.data[key] !== this.initialFormData[key]) {
|
||||
delta[key] = this.data[key];
|
||||
this.actionUpdate = true;
|
||||
}
|
||||
}
|
||||
this.deltaArray.push(delta);
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.updatePrestudent();
|
||||
this.loadPrestudent();
|
||||
//initiale Daten nach dem Laden
|
||||
//this.initialFormData = {...this.data};
|
||||
CoreRESTClient
|
||||
.get('components/stv/Prestudent/getBezeichnungZGV')
|
||||
.then(result => CoreRESTClient.getData(result.data) || [])
|
||||
@@ -65,6 +108,20 @@ export default {
|
||||
this.listZgvs = result;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
CoreRESTClient
|
||||
.get('components/stv/Prestudent/getBezeichnungMZGV')
|
||||
.then(result => CoreRESTClient.getData(result.data) || [])
|
||||
.then(result => {
|
||||
this.listZgvsmaster = result;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
CoreRESTClient
|
||||
.get('components/stv/Prestudent/getBezeichnungDZGV')
|
||||
.then(result => CoreRESTClient.getData(result.data) || [])
|
||||
.then(result => {
|
||||
this.listZgvsdoktor = result;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
CoreRESTClient
|
||||
.get('components/stv/Lists/getStgs')
|
||||
.then(result => CoreRESTClient.getData(result.data) || [])
|
||||
@@ -101,9 +158,21 @@ export default {
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
mounted(){
|
||||
fetch('config/stv')
|
||||
.then(result => result.json())
|
||||
.then(result => {
|
||||
this.config = result;
|
||||
console.log('Konfiguration geladen:', this.config);
|
||||
})
|
||||
.catch(error => console.error('Fehler beim Laden der Konfiguration:', error));
|
||||
},
|
||||
template: `
|
||||
<div class="stv-details-details h-100 pb-3">
|
||||
<form-form ref="form" class="stv-details-prestudent" @submit.prevent="save">
|
||||
<form-form ref="form" class="stv-details-prestudent" @submit.prevent="updatePrestudent">
|
||||
<div class="position-sticky top-0 z-1">
|
||||
<button type="submit" class="btn btn-primary position-absolute top-0 end-0" >Speichern</button>
|
||||
</div>
|
||||
<!--<form ref="form">-->
|
||||
<fieldset class="overflow-hidden">
|
||||
<legend>Zugangsvoraussetzungen für {{modelValue.nachname}} {{modelValue.vorname}}</legend>
|
||||
@@ -175,11 +244,11 @@ export default {
|
||||
<form-input
|
||||
container-class="col-3"
|
||||
label="ZGV Master"
|
||||
type="text"
|
||||
type="select"
|
||||
v-model="data.zgvmas_code"
|
||||
name="zgvmascode"
|
||||
>
|
||||
<option v-for="zgv in listZgvs" :key="zgv.zgv_code" :value="zgv.zgv_code">{{zgv.zgv_bez}}</option>
|
||||
<option v-for="mzgv in listZgvsmaster" :key="mzgv.zgvmas_code" :value="mzgv.zgvmas_code">{{mzgv.zgvmas_bez}}</option>
|
||||
</form-input>
|
||||
<form-input
|
||||
container-class="col-3"
|
||||
@@ -214,6 +283,86 @@ export default {
|
||||
<option v-for="nation in lists.nations" :key="nation.nation_code" :value="nation.nation_code" :disabled="nation.sperre">{{nation.kurztext}}</option>
|
||||
</form-input>
|
||||
</div>
|
||||
<!--ZGV Doktor Todo(manu) Config -->
|
||||
<div class="row mb-3">
|
||||
<form-input
|
||||
container-class="col-3"
|
||||
label="ZGV Doktor"
|
||||
type="select"
|
||||
v-model="data.zgvdoktor_code"
|
||||
name="zgvdoktor_code"
|
||||
>
|
||||
<option v-for="zgv in listZgvsdoktor" :key="zgv.zgvdoktor_code" :value="zgv.zgvdoktor_code">{{zgv.zgvdoktor_bez}}</option>
|
||||
</form-input>
|
||||
<form-input
|
||||
container-class="col-3"
|
||||
label="ZGV Doktor Ort"
|
||||
type="text"
|
||||
v-model="data.zgvdoktorort"
|
||||
name="zgvdoktorort"
|
||||
>
|
||||
</form-input>
|
||||
<form-input
|
||||
container-class="col-3"
|
||||
label="ZGV Doktor Datum"
|
||||
type="DatePicker"
|
||||
v-model="data.zgvdoktordatum"
|
||||
name="zgvdoktordatum"
|
||||
no-today
|
||||
auto-apply
|
||||
:enable-time-picker="false"
|
||||
format="dd.MM.yyyy"
|
||||
preview-format="dd.MM.yyyy"
|
||||
:teleport="true"
|
||||
>
|
||||
</form-input>
|
||||
<form-input
|
||||
container-class="col-3"
|
||||
label="ZGV Doktor Nation"
|
||||
type="select"
|
||||
v-model="data.zgvdoktornation"
|
||||
name="zgvdoktornation"
|
||||
>
|
||||
<!-- TODO(chris): gesperrte nationen können nicht ausgewählt werden! Um das zu realisieren müsste man ein pseudo select machen -->
|
||||
<option v-for="nation in lists.nations" :key="nation.nation_code" :value="nation.nation_code" :disabled="nation.sperre">{{nation.kurztext}}</option>
|
||||
</form-input>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-3 pt-4 d-flex align-items-center">
|
||||
<form-input
|
||||
container-class="form-check"
|
||||
label="ZGV erfüllt"
|
||||
type="checkbox"
|
||||
v-model="data.zgv_erfuellt"
|
||||
name="zgv_erfuellt"
|
||||
>
|
||||
</form-input>
|
||||
</div>
|
||||
<div class="col-3 pt-4 d-flex align-items-center">
|
||||
<form-input
|
||||
container-class="form-check"
|
||||
label="ZGV Master erfüllt"
|
||||
type="checkbox"
|
||||
v-model="data.zgvmas_erfuellt"
|
||||
name="zgvmas_erfuellt"
|
||||
>
|
||||
</form-input>
|
||||
</div>
|
||||
<div class="col-3 pt-4 d-flex align-items-center">
|
||||
<form-input
|
||||
container-class="form-check"
|
||||
label="ZGV Doktor erfüllt"
|
||||
type="checkbox"
|
||||
v-model="data.zgvdoktor_erfuellt"
|
||||
name="zgvdoktor_erfuellt"
|
||||
>
|
||||
</form-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- </template>-->
|
||||
</fieldset>
|
||||
<fieldset class="overflow-hidden">
|
||||
@@ -249,6 +398,40 @@ export default {
|
||||
</form-input>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<form-input
|
||||
container-class="col-4"
|
||||
label="Aufnahmeschlüssel"
|
||||
type="text"
|
||||
v-model="data.aufnahmeschluessel"
|
||||
name="aufnahmeschluessel"
|
||||
>
|
||||
</form-input>
|
||||
|
||||
<div class="col-4 pt-4 d-flex align-items-center">
|
||||
<form-input
|
||||
container-class="form-check"
|
||||
label="Facheinschlägig berufstätig"
|
||||
type="checkbox"
|
||||
v-model="data.facheinschlberuf"
|
||||
name="facheinschlberuf"
|
||||
>
|
||||
</form-input>
|
||||
</div>
|
||||
|
||||
<!--Todo(manu) validierung Integer, liste hier null-->
|
||||
<form-input
|
||||
container-class="col-4"
|
||||
label="Bisstandort"
|
||||
type="text"
|
||||
v-model="data.standort_code"
|
||||
name="standort_code"
|
||||
disabled
|
||||
>
|
||||
</form-input>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<form-input
|
||||
container-class="col-4"
|
||||
@@ -300,17 +483,21 @@ export default {
|
||||
>
|
||||
</form-input>
|
||||
</div>
|
||||
<form-input
|
||||
container-class="col-2"
|
||||
label="Förderrelevant"
|
||||
type="select"
|
||||
v-model="data.foerderrelevant"
|
||||
name="foerderrelevant"
|
||||
>
|
||||
<option :value="" selected >wie Studiengang</option>
|
||||
<option :value="true">ja</option>
|
||||
<option :value="false">nein</option>
|
||||
</form-input>
|
||||
<!-- Todo(manu) hier soll ein select ausgewählt werden??-->
|
||||
<div class="col-2 pt-4 d-flex align-items-center">
|
||||
<form-input
|
||||
container-class="form-check"
|
||||
label="Förderrelevant"
|
||||
type="checkbox"
|
||||
v-model="data.foerderrelevant"
|
||||
name="foerderrelevant"
|
||||
>
|
||||
<!-- <option :value="" selected >wie Studiengang</option>
|
||||
<option :value="true">ja</option>
|
||||
<option :value="false">nein</option>-->
|
||||
</form-input>
|
||||
</div>
|
||||
<!-- Todo(manu) an Recht basis/prestudent hänaen -->
|
||||
<form-input
|
||||
container-class="col-1"
|
||||
label="Priorität"
|
||||
@@ -320,18 +507,34 @@ export default {
|
||||
>
|
||||
</form-input>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<form-input
|
||||
container-class="col-5"
|
||||
label="MentorIn"
|
||||
type="text"
|
||||
v-model="data.mentor"
|
||||
name="mentor"
|
||||
>
|
||||
</form-input>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
|
||||
</form-form>
|
||||
|
||||
<br>
|
||||
{{modelValue}}
|
||||
<!-- <hr>
|
||||
Data: {{data}}
|
||||
<hr>-->
|
||||
|
||||
<!-- <hr>
|
||||
DeltaArray: {{deltaArray}}
|
||||
<br>
|
||||
to update: {{actionUpdate}}
|
||||
<hr>
|
||||
{{data}}
|
||||
<hr>
|
||||
{{listStgTyp}}
|
||||
|
||||
InitialData: {{initialFormData}}-->
|
||||
|
||||
|
||||
</div>
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user