mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-26 00:54:27 +00:00
Form, Table and Queries for new Tab Pruefung
This commit is contained in:
@@ -29,7 +29,19 @@ class Pruefung extends FHCAPI_Controller
|
|||||||
{
|
{
|
||||||
//TODO(Manu) Berechtigungen
|
//TODO(Manu) Berechtigungen
|
||||||
parent::__construct([
|
parent::__construct([
|
||||||
'getPruefungen' => self::PERM_LOGGED
|
'getPruefungen' => ['admin:r', 'assistenz:r'],
|
||||||
|
'loadPruefung' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getTypenPruefungen' => self::PERM_LOGGED,
|
||||||
|
'getLehreinheiten' => self::PERM_LOGGED,
|
||||||
|
'getAllLehreinheiten' => self::PERM_LOGGED,
|
||||||
|
'getLvsByStudent' => self::PERM_LOGGED,
|
||||||
|
'getLvsandLesByStudent' => self::PERM_LOGGED,
|
||||||
|
'getLvsAndMas' => self::PERM_LOGGED,
|
||||||
|
'getMitarbeiterLv' => self::PERM_LOGGED,
|
||||||
|
'getNoten' => self::PERM_LOGGED,
|
||||||
|
'insertPruefung' => ['admin:r', 'assistenz:r'],
|
||||||
|
'updatePruefung' =>['admin:r', 'assistenz:r'],
|
||||||
|
'deletePruefung' =>['admin:r', 'assistenz:r'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//Load Models
|
//Load Models
|
||||||
@@ -45,4 +57,263 @@ class Pruefung extends FHCAPI_Controller
|
|||||||
$this->terminateWithSuccess($data);
|
$this->terminateWithSuccess($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function loadPruefung($pruefung_id)
|
||||||
|
{
|
||||||
|
$this->PruefungModel->addSelect('tbl_pruefung.datum');
|
||||||
|
$this->PruefungModel->addSelect("TO_CHAR(tbl_pruefung.datum::timestamp, 'DD.MM.YYYY') AS format_datum");
|
||||||
|
$this->PruefungModel->addSelect('tbl_pruefung.anmerkung');
|
||||||
|
$this->PruefungModel->addSelect('tbl_pruefung.pruefungstyp_kurzbz');
|
||||||
|
$this->PruefungModel->addSelect('tbl_pruefung.pruefung_id');
|
||||||
|
$this->PruefungModel->addSelect('tbl_pruefung.lehreinheit_id');
|
||||||
|
$this->PruefungModel->addSelect('tbl_pruefung.student_uid');
|
||||||
|
$this->PruefungModel->addSelect('tbl_pruefung.mitarbeiter_uid');
|
||||||
|
$this->PruefungModel->addSelect('tbl_pruefung.punkte');
|
||||||
|
$this->PruefungModel->addSelect('tbl_pruefung.note');
|
||||||
|
|
||||||
|
$this->PruefungModel->addSelect('tbl_lehrveranstaltung.bezeichnung as lehrveranstaltung_bezeichnung');
|
||||||
|
$this->PruefungModel->addSelect('tbl_lehrveranstaltung.lehrveranstaltung_id');
|
||||||
|
$this->PruefungModel->addSelect('tbl_lehrveranstaltung.semester');
|
||||||
|
$this->PruefungModel->addSelect('tbl_lehrveranstaltung.lehrform_kurzbz');
|
||||||
|
$this->PruefungModel->addSelect('tbl_note.bezeichnung as note_bezeichnung');
|
||||||
|
$this->PruefungModel->addSelect('tbl_pruefungstyp.beschreibung as typ_beschreibung');
|
||||||
|
$this->PruefungModel->addSelect('tbl_lehreinheit.studiensemester_kurzbz as studiensemester_kurzbz');
|
||||||
|
|
||||||
|
$this->PruefungModel->addJoin('lehre.tbl_lehreinheit', 'lehre.tbl_pruefung.lehreinheit_id=lehre.tbl_lehreinheit.lehreinheit_id');
|
||||||
|
$this->PruefungModel->addJoin('lehre.tbl_lehrveranstaltung', 'lehrveranstaltung_id');
|
||||||
|
$this->PruefungModel->addJoin('lehre.tbl_note', 'note');
|
||||||
|
$this->PruefungModel->addJoin('lehre.tbl_pruefungstyp', 'pruefungstyp_kurzbz');
|
||||||
|
|
||||||
|
|
||||||
|
$this->PruefungModel->addLimit(1);
|
||||||
|
|
||||||
|
$result = $this->PruefungModel->loadWhere(
|
||||||
|
array('pruefung_id' => $pruefung_id)
|
||||||
|
);
|
||||||
|
if (isError($result)) {
|
||||||
|
return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasData($result))
|
||||||
|
{
|
||||||
|
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Pruefung_id']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
$this->terminateWithSuccess(current(getData($result)) ? : null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function insertPruefung(){
|
||||||
|
//TODO(Manu) validations
|
||||||
|
|
||||||
|
$authUID = getAuthUID();
|
||||||
|
$lehreinheit_id = $this->input->post('lehreinheit_id');
|
||||||
|
$student_uid = $this->input->post('student_uid');
|
||||||
|
$mitarbeiter_uid = $this->input->post('mitarbeiter_uid');
|
||||||
|
$datum = $this->input->post('datum');
|
||||||
|
$note = $this->input->post('note');
|
||||||
|
$pruefungstyp_kurzbz = $this->input->post('pruefungstyp_kurzbz');
|
||||||
|
$anmerkung = $this->input->post('anmerkung');
|
||||||
|
|
||||||
|
|
||||||
|
$result = $this->PruefungModel->insert([
|
||||||
|
'lehreinheit_id' => $lehreinheit_id,
|
||||||
|
'student_uid' => $student_uid,
|
||||||
|
'mitarbeiter_uid' => $mitarbeiter_uid,
|
||||||
|
'datum' => $datum,
|
||||||
|
'pruefungstyp_kurzbz' => $pruefungstyp_kurzbz,
|
||||||
|
'note' => $note,
|
||||||
|
'anmerkung' => $anmerkung,
|
||||||
|
'insertamum' => date('c'),
|
||||||
|
'insertvon' => $authUID,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updatePruefung($pruefung_id){
|
||||||
|
//TODO(Manu) validations
|
||||||
|
$result = $this->PruefungModel->load($pruefung_id);
|
||||||
|
|
||||||
|
$oldpruefung = $this->getDataOrTerminateWithError($result);
|
||||||
|
if (!$oldpruefung)
|
||||||
|
show_404(); // Pruefung that should be updated does not exist
|
||||||
|
|
||||||
|
$authUID = getAuthUID();
|
||||||
|
|
||||||
|
$lehreinheit_id = $this->input->post('lehreinheit_id');
|
||||||
|
$student_uid = $this->input->post('student_uid');
|
||||||
|
$mitarbeiter_uid = $this->input->post('mitarbeiter_uid');
|
||||||
|
$datum = $this->input->post('datum');
|
||||||
|
$note = $this->input->post('note');
|
||||||
|
$pruefungstyp_kurzbz = $this->input->post('pruefungstyp_kurzbz');
|
||||||
|
$anmerkung = $this->input->post('anmerkung');
|
||||||
|
|
||||||
|
$result = $this->PruefungModel->update(
|
||||||
|
[
|
||||||
|
'pruefung_id' => $pruefung_id
|
||||||
|
],
|
||||||
|
[ 'lehreinheit_id' => $lehreinheit_id,
|
||||||
|
'student_uid' => $student_uid,
|
||||||
|
'mitarbeiter_uid' => $mitarbeiter_uid,
|
||||||
|
'note' => $note,
|
||||||
|
'pruefungstyp_kurzbz' => $pruefungstyp_kurzbz,
|
||||||
|
'datum' => $datum,
|
||||||
|
'anmerkung' => $anmerkung,
|
||||||
|
'updatevon' => $authUID,
|
||||||
|
'updateamum' => date('c'),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
return $this->outputJsonSuccess(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deletePruefung($pruefung_id){
|
||||||
|
$result = $this->PruefungModel->load($pruefung_id);
|
||||||
|
|
||||||
|
$oldpruefung = $this->getDataOrTerminateWithError($result);
|
||||||
|
if (!$oldpruefung)
|
||||||
|
show_404(); // Pruefung that should be deleted does not exist
|
||||||
|
|
||||||
|
$result = $this->PruefungModel->delete(
|
||||||
|
[
|
||||||
|
'pruefung_id' => $pruefung_id
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
return $this->terminateWithSuccess(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTypenPruefungen()
|
||||||
|
{
|
||||||
|
$this->load->model('education/Pruefungstyp_model', 'PruefungtypModel');
|
||||||
|
|
||||||
|
//TODO(Manu) sort Termin3
|
||||||
|
$this->PruefungtypModel->addOrder('sort', 'ASC');
|
||||||
|
$result = $this->PruefungtypModel->loadWhere(
|
||||||
|
array('abschluss' => 'false')
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isError($result)) {
|
||||||
|
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
return $this->terminateWithSuccess(getData($result) ?: []);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAllLehreinheiten(){
|
||||||
|
|
||||||
|
//TODO MANU (validations)
|
||||||
|
|
||||||
|
$lv_id = $this->input->post('lv_id');
|
||||||
|
$studiensemester_kurzbz = $this->input->post('studiensemester_kurzbz');
|
||||||
|
|
||||||
|
$this->load->model('education/Lehreinheit_model', 'LehreinheitModel');
|
||||||
|
|
||||||
|
$result = $this->LehreinheitModel->getLesFromLvIds($lv_id, $studiensemester_kurzbz);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLvsandLesByStudent($student_uid)
|
||||||
|
{
|
||||||
|
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
|
||||||
|
|
||||||
|
$result = $this->LehrveranstaltungModel->getLvsByStudent($student_uid);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$lv_ids = array();
|
||||||
|
$allData = array();
|
||||||
|
|
||||||
|
foreach ($data as $lehrveranstaltung) {
|
||||||
|
$lv_ids[] = $lehrveranstaltung->lehrveranstaltung_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->load->model('education/Lehreinheit_model', 'LehreinheitModel');
|
||||||
|
|
||||||
|
foreach ($lv_ids as $id)
|
||||||
|
{
|
||||||
|
$result = $this->LehreinheitModel->getLesFromLvIds($id);
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
if (is_array($data)) {
|
||||||
|
$allData = array_merge($allData, $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->terminateWithSuccess($allData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLvsAndMas($student_uid)
|
||||||
|
{
|
||||||
|
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
|
||||||
|
|
||||||
|
$result = $this->LehrveranstaltungModel->getLvsByStudent($student_uid);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$lv_ids = array();
|
||||||
|
$allDataMa = array();
|
||||||
|
|
||||||
|
foreach ($data as $lehrveranstaltung) {
|
||||||
|
$lv_ids[] = $lehrveranstaltung->lehrveranstaltung_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel');
|
||||||
|
|
||||||
|
foreach ($lv_ids as $id) {
|
||||||
|
|
||||||
|
$resultMa = $this->MitarbeiterModel->getMitarbeiterFromLV($id);
|
||||||
|
$dataMa = $this->getDataOrTerminateWithError($resultMa);
|
||||||
|
|
||||||
|
if (is_array($dataMa)) {
|
||||||
|
$allDataMa = array_merge($allDataMa, $dataMa);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->terminateWithSuccess($allDataMa);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLvsByStudent($student_uid)
|
||||||
|
{
|
||||||
|
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
|
||||||
|
|
||||||
|
$result = $this->LehrveranstaltungModel->getLvsByStudent($student_uid);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
return $this->terminateWithSuccess($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMitarbeiterLv($lv_id)
|
||||||
|
{
|
||||||
|
$this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel');
|
||||||
|
|
||||||
|
$result = $this->MitarbeiterModel->getMitarbeiterFromLV($lv_id);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
return $this->terminateWithSuccess($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNoten()
|
||||||
|
{
|
||||||
|
$this->load->model('education/Note_model', 'NoteModel');
|
||||||
|
|
||||||
|
$this->NoteModel->addOrder('note', 'ASC');
|
||||||
|
$result = $this->NoteModel->load();
|
||||||
|
|
||||||
|
if (isError($result)) {
|
||||||
|
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
return $this->terminateWithSuccess(getData($result) ?: []);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class LePruefung_model extends DB_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CI_STYLE
|
* gets all Pruefungen for a student_uid
|
||||||
* @param string $student_uid
|
* @param string $student_uid
|
||||||
* @param string $studiensemester_kurzbz
|
* @param string $studiensemester_kurzbz
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -113,4 +113,57 @@ class Lehreinheit_model extends DB_Model
|
|||||||
|
|
||||||
return $this->execQuery($query, array($lehreinheit_id));
|
return $this->execQuery($query, array($lehreinheit_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets Lehreinheiten for Lehrveranstaltungen in a Studiensemester.
|
||||||
|
* Without using tbl_lehrfach: bezeichnung and kurzbz ALWAYS from lehrveranstaltung
|
||||||
|
* @param $lehrveranstaltung_id
|
||||||
|
* @param $studiensemester
|
||||||
|
* @return array with Lehreinheiten and their Lehreinheitgruppen
|
||||||
|
*/
|
||||||
|
public function getLesFromLvIds($lehrveranstaltung_id, $studiensemester_kurzbz = null)
|
||||||
|
{
|
||||||
|
$params = array($lehrveranstaltung_id);
|
||||||
|
|
||||||
|
$query = "
|
||||||
|
SELECT
|
||||||
|
lv.lehrveranstaltung_id,
|
||||||
|
le.lehreinheit_id,
|
||||||
|
le.lehrform_kurzbz,
|
||||||
|
lv.kurzbz,
|
||||||
|
lv.bezeichnung,
|
||||||
|
lv.semester,
|
||||||
|
ma.mitarbeiter_uid,
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
STRING_AGG(CONCAT(leg.semester, leg.verband, leg.gruppe), ' ')
|
||||||
|
FROM lehre.tbl_lehreinheitgruppe leg
|
||||||
|
WHERE leg.lehreinheit_id = le.lehreinheit_id
|
||||||
|
) AS gruppe
|
||||||
|
FROM
|
||||||
|
lehre.tbl_lehreinheit le
|
||||||
|
JOIN
|
||||||
|
lehre.tbl_lehrveranstaltung lv ON lv.lehrveranstaltung_id = le.lehrveranstaltung_id
|
||||||
|
JOIN
|
||||||
|
lehre.tbl_lehreinheitmitarbeiter ma USING (lehreinheit_id)
|
||||||
|
WHERE
|
||||||
|
lv.lehrveranstaltung_id = ?
|
||||||
|
--AND le.studiensemester_kurzbz = 'WS2021'
|
||||||
|
";
|
||||||
|
|
||||||
|
if (isset($studiensemester_kurzbz))
|
||||||
|
{
|
||||||
|
$query .= " AND le.studiensemester_kurzbz = ?";
|
||||||
|
$params[] = $studiensemester_kurzbz;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query .="
|
||||||
|
ORDER BY
|
||||||
|
le.lehreinheit_id;
|
||||||
|
";
|
||||||
|
|
||||||
|
return $this->execQuery($query, $params);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
class Note_model extends DB_Model
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->dbTable = 'lehre.tbl_note';
|
||||||
|
$this->pk = 'note';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -238,4 +238,28 @@ class Mitarbeiter_model extends DB_Model
|
|||||||
|
|
||||||
return $this->execQuery($qry);
|
return $this->execQuery($qry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets Mitarbeiter for a certain Lehrveranstaltung.
|
||||||
|
*
|
||||||
|
* @param $lehrveranstaltung_id
|
||||||
|
* @return array with Mitarbeiter and their Lehreinheiten
|
||||||
|
*/
|
||||||
|
public function getMitarbeiterFromLV($lehrveranstaltung_id){
|
||||||
|
//TODO(manu) maybe filter that in pruefungslist.js ?
|
||||||
|
$qry = "SELECT DISTINCT
|
||||||
|
lehrveranstaltung_id, uid, vorname, wahlname, vornamen, nachname, titelpre, titelpost, kurzbz, mitarbeiter_uid
|
||||||
|
FROM
|
||||||
|
lehre.tbl_lehreinheitmitarbeiter, campus.vw_mitarbeiter, lehre.tbl_lehreinheit
|
||||||
|
WHERE
|
||||||
|
lehrveranstaltung_id= ?
|
||||||
|
AND
|
||||||
|
mitarbeiter_uid=uid
|
||||||
|
AND
|
||||||
|
tbl_lehreinheitmitarbeiter.lehreinheit_id=tbl_lehreinheit.lehreinheit_id;";
|
||||||
|
|
||||||
|
$parametersArray = array($lehrveranstaltung_id);
|
||||||
|
|
||||||
|
return $this->execQuery($qry, $parametersArray);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export default {
|
|||||||
template: `
|
template: `
|
||||||
<div class="stv-details-pruefung h-100 pb-3">
|
<div class="stv-details-pruefung h-100 pb-3">
|
||||||
|
|
||||||
{{modelValue}}
|
<!-- {{modelValue}}-->
|
||||||
<fieldset class="overflow-hidden">
|
<fieldset class="overflow-hidden">
|
||||||
<!-- <legend>{{this.$p.t('lehre', 'pruefung')}}</legend>-->
|
<!-- <legend>{{this.$p.t('lehre', 'pruefung')}}</legend>-->
|
||||||
<pruefung-list ref="pruefungList" :uid="modelValue.uid"></pruefung-list>
|
<pruefung-list ref="pruefungList" :uid="modelValue.uid"></pruefung-list>
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import {CoreFilterCmpt} from "../../../../filter/Filter.js";
|
import {CoreFilterCmpt} from "../../../../filter/Filter.js";
|
||||||
import FormInput from "../../../../Form/Input.js";
|
import FormInput from "../../../../Form/Input.js";
|
||||||
|
import BsModal from "../../../../Bootstrap/Modal.js";
|
||||||
|
|
||||||
export default{
|
export default{
|
||||||
components: {
|
components: {
|
||||||
CoreFilterCmpt,
|
CoreFilterCmpt,
|
||||||
FormInput
|
FormInput,
|
||||||
|
BsModal
|
||||||
},
|
},
|
||||||
inject: {
|
inject: {
|
||||||
defaultSemester: {
|
defaultSemester: {
|
||||||
@@ -26,40 +28,327 @@ export default{
|
|||||||
{title: "Note", field: "note_bezeichnung"},
|
{title: "Note", field: "note_bezeichnung"},
|
||||||
{title: "Anmerkung", field: "anmerkung"},
|
{title: "Anmerkung", field: "anmerkung"},
|
||||||
{title: "Typ", field: "pruefungstyp_kurzbz"},
|
{title: "Typ", field: "pruefungstyp_kurzbz"},
|
||||||
{title: "PruefungId", field: "pruefung_id", visible:false},
|
{title: "PruefungId", field: "pruefung_id", visible: false},
|
||||||
{title: "LehreinheitId", field: "lehreinheit_id", visible:false},
|
{title: "LehreinheitId", field: "lehreinheit_id", visible: false},
|
||||||
{title: "Student_uid", field: "student_uid", visible:false},
|
{title: "Student_uid", field: "student_uid", visible: false},
|
||||||
{title: "Mitarbeiter_uid", field: "mitarbeiter_uid", visible:false},
|
{title: "LV_id", field: "lehrveranstaltung_id", visible: false}, //just for testing
|
||||||
{title: "Punkte", field: "punkte", visible:false},
|
{title: "Mitarbeiter_uid", field: "mitarbeiter_uid", visible: false},
|
||||||
],
|
{title: "Punkte", field: "punkte", visible: false},
|
||||||
|
{
|
||||||
|
title: 'Aktionen', field: 'actions',
|
||||||
|
minWidth: 150,
|
||||||
|
maxWidth: 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-plus"></i>';
|
||||||
|
button.title = 'neue Prüfung aus dieser LV erstellen';
|
||||||
|
button.addEventListener(
|
||||||
|
'click',
|
||||||
|
(event) =>
|
||||||
|
this.actionNewFromOldPruefung(cell.getData().pruefung_id)
|
||||||
|
);
|
||||||
|
container.append(button);
|
||||||
|
|
||||||
|
button = document.createElement('button');
|
||||||
|
button.className = 'btn btn-outline-secondary btn-action';
|
||||||
|
button.innerHTML = '<i class="fa fa-edit"></i>';
|
||||||
|
button.title = 'Prüfung bearbeiten';
|
||||||
|
button.addEventListener(
|
||||||
|
'click',
|
||||||
|
(event) =>
|
||||||
|
this.actionEditPruefung(cell.getData().pruefung_id)
|
||||||
|
);
|
||||||
|
container.append(button);
|
||||||
|
|
||||||
|
button = document.createElement('button');
|
||||||
|
button.className = 'btn btn-outline-secondary btn-action';
|
||||||
|
button.innerHTML = '<i class="fa fa-xmark"></i>';
|
||||||
|
button.title = 'Prüfung löschen';
|
||||||
|
button.addEventListener(
|
||||||
|
'click',
|
||||||
|
() =>
|
||||||
|
this.actionDeletePruefung(cell.getData().pruefung_id)
|
||||||
|
);
|
||||||
|
container.append(button);
|
||||||
|
|
||||||
|
return container;
|
||||||
|
},
|
||||||
|
frozen: true
|
||||||
|
}],
|
||||||
layout: 'fitDataFill',
|
layout: 'fitDataFill',
|
||||||
layoutColumnsOnNewData: false,
|
layoutColumnsOnNewData: false,
|
||||||
height: 'auto',
|
height: 'auto',
|
||||||
},
|
},
|
||||||
tabulatorEvents: [{}],
|
tabulatorEvents: [
|
||||||
|
{
|
||||||
|
event: 'tableBuilt',
|
||||||
|
handler: async () => {
|
||||||
|
await this.$p.loadCategory(['fristenmanagement', 'global', 'person', 'ui',]);
|
||||||
|
let cm = this.$refs.table.tabulator.columnManager;
|
||||||
|
|
||||||
|
cm.getColumnByField('bezeichnung').component.updateDefinition({
|
||||||
|
title: this.$p.t('global', 'typ')
|
||||||
|
});
|
||||||
|
|
||||||
|
cm.getColumnByField('anmerkung').component.updateDefinition({
|
||||||
|
title: this.$p.t('global', 'anmerkung')
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
pruefungData: {},
|
pruefungData: {},
|
||||||
filter: false
|
listTypesExam: [],
|
||||||
|
listLvsAndLes: [],
|
||||||
|
listLvsAndMas: [],
|
||||||
|
listLvs: [], //TODO(Manu) nachträglich sortieren
|
||||||
|
listLes: [],
|
||||||
|
listMas: [], //TODO(Manu) Filter statt SELECT DISTINCT
|
||||||
|
listMarks: [],
|
||||||
|
filter: false,
|
||||||
|
statusNew: true,
|
||||||
|
isStartDropDown: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed:{
|
||||||
|
/* lehrveranstaltungen(){
|
||||||
|
return this.listLvsAndLes.filter((value, index, self) => {
|
||||||
|
return self.indexOf(value) === index;
|
||||||
|
});
|
||||||
|
},*/
|
||||||
|
lv_teile(){
|
||||||
|
return this.listLvsAndLes.filter(lv => lv.lehrveranstaltung_id == this.pruefungData.lehrveranstaltung_id);
|
||||||
|
},
|
||||||
|
lv_teile_ma(){
|
||||||
|
return this.listLvsAndMas.filter(lv => lv.lehrveranstaltung_id == this.pruefungData.lehrveranstaltung_id);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed:{},
|
|
||||||
/* watch: {
|
/* watch: {
|
||||||
modelValue() {
|
modelValue() {
|
||||||
this.$refs.table.reloadTable();
|
this.$refs.table.reloadTable();
|
||||||
}
|
}
|
||||||
},*/
|
},*/
|
||||||
methods:{ },
|
methods:{
|
||||||
|
loadPruefung(pruefung_id) {
|
||||||
|
return this.$fhcApi.get('api/frontend/v1/stv/pruefung/loadPruefung/' + pruefung_id)
|
||||||
|
.then(result => {
|
||||||
|
this.pruefungData = result.data;
|
||||||
|
return result;
|
||||||
|
})
|
||||||
|
.catch(this.$fhcAlert.handleSystemError);
|
||||||
|
},
|
||||||
|
actionNewPruefung(){
|
||||||
|
this.statusNew = true;
|
||||||
|
this.isStartDropDown = true;
|
||||||
|
|
||||||
|
/* this.getLvsByStudent(this.uid).then(() => {
|
||||||
|
this.$refs.pruefungModal.show();
|
||||||
|
});*/
|
||||||
|
|
||||||
|
this.$refs.pruefungModal.show();
|
||||||
|
// this.prepareDropdowns();
|
||||||
|
// this.$refs.pruefungModal.show();
|
||||||
|
|
||||||
|
},
|
||||||
|
actionNewFromOldPruefung(pruefung_id) {
|
||||||
|
this.statusNew = true;
|
||||||
|
this.isStartDropDown = false;
|
||||||
|
this.loadPruefung(pruefung_id).then(() => {
|
||||||
|
this.pruefungData.note_bezeichnung = 'Noch nicht eingetragen';
|
||||||
|
this.pruefungData.datum = new Date();
|
||||||
|
this.prepareDropdowns();
|
||||||
|
|
||||||
|
this.$refs.pruefungModal.show();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
actionEditPruefung(pruefung_id) {
|
||||||
|
this.statusNew = false;
|
||||||
|
this.isStartDropDown = false;
|
||||||
|
this.loadPruefung(pruefung_id).then(() => {
|
||||||
|
|
||||||
|
this.prepareDropdowns();
|
||||||
|
|
||||||
|
this.$refs.pruefungModal.show();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
actionDeletePruefung(pruefung_id) {
|
||||||
|
console.log("action delete Prüfung" + pruefung_id);
|
||||||
|
this.loadPruefung(pruefung_id).then(() => {
|
||||||
|
if(this.pruefungData.pruefung_id)
|
||||||
|
|
||||||
|
this.$fhcAlert
|
||||||
|
.confirmDelete()
|
||||||
|
.then(result => result
|
||||||
|
? pruefung_id
|
||||||
|
: Promise.reject({handled: true}))
|
||||||
|
.then(this.deletePruefung)
|
||||||
|
.catch(this.$fhcAlert.handleSystemError);
|
||||||
|
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addPruefung(){
|
||||||
|
this.$fhcApi.post('api/frontend/v1/stv/pruefung/insertPruefung/',
|
||||||
|
this.pruefungData
|
||||||
|
).then(response => {
|
||||||
|
this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave'));
|
||||||
|
this.hideModal('pruefungModal');
|
||||||
|
this.resetModal();
|
||||||
|
}).catch(this.$fhcAlert.handleSystemError)
|
||||||
|
.finally(() => {
|
||||||
|
window.scrollTo(0, 0);
|
||||||
|
this.reload();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
updatePruefung(pruefung_id){
|
||||||
|
console.log("update Prüfung" + pruefung_id);
|
||||||
|
this.$fhcApi.post('api/frontend/v1/stv/pruefung/updatePruefung/' + pruefung_id,
|
||||||
|
this.pruefungData
|
||||||
|
).then(response => {
|
||||||
|
this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave'));
|
||||||
|
this.hideModal('pruefungModal');
|
||||||
|
this.resetModal();
|
||||||
|
}).catch(this.$fhcAlert.handleSystemError)
|
||||||
|
.finally(() => {
|
||||||
|
window.scrollTo(0, 0);
|
||||||
|
this.reload();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
deletePruefung(pruefung_id) {
|
||||||
|
this.$fhcApi.post('api/frontend/v1/stv/pruefung/deletePruefung/' + pruefung_id)
|
||||||
|
.then(response => {
|
||||||
|
this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete'));
|
||||||
|
}).catch(this.$fhcAlert.handleSystemError)
|
||||||
|
.finally(()=> {
|
||||||
|
window.scrollTo(0, 0);
|
||||||
|
this.reload();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
hideModal(modalRef) {
|
||||||
|
this.$refs[modalRef].hide();
|
||||||
|
},
|
||||||
|
resetModal() {
|
||||||
|
this.pruefungData = {};
|
||||||
|
|
||||||
|
/* this.pruefungData.strasse = null;
|
||||||
|
this.pruefungData.zustellpruefunge = true;
|
||||||
|
this.pruefungData.heimatpruefunge = true;
|
||||||
|
this.pruefungData.rechnungspruefunge = false;
|
||||||
|
this.pruefungData.co_name = null;
|
||||||
|
this.pruefungData.firma_id = null;
|
||||||
|
this.pruefungData.name = null;
|
||||||
|
this.pruefungData.anmerkung = null;
|
||||||
|
this.pruefungData.typ = 'h';
|
||||||
|
this.pruefungData.nation = 'A';
|
||||||
|
this.pruefungData.plz = null;*/
|
||||||
|
|
||||||
|
this.statusNew = true;
|
||||||
|
},
|
||||||
|
reload() {
|
||||||
|
this.$refs.table.reloadTable();
|
||||||
|
},
|
||||||
|
getLvsByStudent(student_uid){
|
||||||
|
return this.$fhcApi.get('api/frontend/v1/stv/pruefung/getLvsByStudent/' + student_uid)
|
||||||
|
.then(result => {
|
||||||
|
this.listLvs = result.data;
|
||||||
|
})
|
||||||
|
.catch(this.$fhcAlert.handleSystemError);
|
||||||
|
},
|
||||||
|
getMaFromLv(lv_id){
|
||||||
|
return this.$fhcApi.get('api/frontend/v1/stv/pruefung/getMitarbeiterLv/' + lv_id)
|
||||||
|
.then(result => {
|
||||||
|
this.listMas = result.data;
|
||||||
|
})
|
||||||
|
.catch(this.$fhcAlert.handleSystemError);
|
||||||
|
},
|
||||||
|
getLehreinheiten(lv_id, studiensemester_kurzbz) {
|
||||||
|
const data = {
|
||||||
|
lv_id: lv_id,
|
||||||
|
studiensemester_kurzbz: studiensemester_kurzbz
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.$fhcApi.post('api/frontend/v1/stv/pruefung/getAllLehreinheiten/', data)
|
||||||
|
.then(response => {
|
||||||
|
this.listLes = response.data;
|
||||||
|
})
|
||||||
|
.catch(this.$fhcAlert.handleSystemError);
|
||||||
|
},
|
||||||
|
prepareDropdowns(){
|
||||||
|
|
||||||
|
// Get Lvs from Student
|
||||||
|
/* this.getLvsByStudent(this.pruefungData.student_uid).then(() => {
|
||||||
|
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('Error loading Lvs:', error);
|
||||||
|
});*/
|
||||||
|
|
||||||
|
|
||||||
|
// Get Ma from Lv
|
||||||
|
this.getMaFromLv(this.pruefungData.lehrveranstaltung_id).then(() => {
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('Error loading Ma data:', error);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Get Lehreinheiten
|
||||||
|
this.getLehreinheiten(this.pruefungData.lehrveranstaltung_id, this.pruefungData.studiensemester_kurzbz).then(() => {
|
||||||
|
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('Error loading Lehreinheiten multiple:', error);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
this.$refs.pruefungModal.show();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created(){
|
||||||
|
this.$fhcApi.get('api/frontend/v1/stv/pruefung/getLvsByStudent/' + this.uid)
|
||||||
|
.then(result => {
|
||||||
|
this.listLvs = result.data;
|
||||||
|
})
|
||||||
|
.catch(this.$fhcAlert.handleSystemError);
|
||||||
|
|
||||||
|
this.$fhcApi.get('api/frontend/v1/stv/pruefung/getLvsandLesByStudent/' + this.uid)
|
||||||
|
.then(result => {
|
||||||
|
this.listLvsAndLes = result.data;
|
||||||
|
})
|
||||||
|
.catch(this.$fhcAlert.handleSystemError);
|
||||||
|
|
||||||
|
this.$fhcApi.get('api/frontend/v1/stv/pruefung/getLvsAndMas/' + this.uid)
|
||||||
|
.then(result => {
|
||||||
|
this.listLvsAndMas = result.data;
|
||||||
|
})
|
||||||
|
.catch(this.$fhcAlert.handleSystemError);
|
||||||
|
|
||||||
|
this.$fhcApi.get('api/frontend/v1/stv/pruefung/getTypenPruefungen')
|
||||||
|
.then(result => {
|
||||||
|
this.listTypesExam = result.data;
|
||||||
|
})
|
||||||
|
.catch(this.$fhcAlert.handleSystemError);
|
||||||
|
|
||||||
|
this.$fhcApi.get('api/frontend/v1/stv/pruefung/getNoten')
|
||||||
|
.then(result => {
|
||||||
|
this.listMarks = result.data;
|
||||||
|
})
|
||||||
|
.catch(this.$fhcAlert.handleSystemError);
|
||||||
|
},
|
||||||
template: `
|
template: `
|
||||||
<div class="stv-details-pruefung-pruefung-list 100 pt-3">
|
<div class="stv-details-pruefung-pruefung-list 100 pt-3">
|
||||||
|
|
||||||
|
aktuelles Sem: {{defaultSemester}}
|
||||||
|
<hr>
|
||||||
|
|
||||||
<div class="justify-content-end pb-3">
|
<div class="justify-content-end pb-3">
|
||||||
<form-input
|
<form-inputlistTypesExam
|
||||||
container-class="form-switch"
|
container-class="form-switch"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
label="Aktuelles Studiensemester Anzeigen"
|
label="Aktuelles Studiensemester Anzeigen"
|
||||||
v-model="filter"
|
v-model="filter"
|
||||||
@update:model-value="setFilter('open')"
|
@update:model-value="setFilter('open')"
|
||||||
>
|
>
|
||||||
</form-input>
|
</form-inputlistTypesExam>
|
||||||
<!-- <div class="col-lg-3">
|
<!-- <div class="col-lg-3">
|
||||||
<form-input
|
<form-input
|
||||||
container-class="form-switch"
|
container-class="form-switch"
|
||||||
@@ -73,28 +362,150 @@ export default{
|
|||||||
</div>-->
|
</div>-->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<core-filter-cmpt
|
||||||
|
ref="table"
|
||||||
<div class="col-sm-6 pt-6">
|
:tabulator-options="tabulatorOptions"
|
||||||
<core-filter-cmpt
|
table-only
|
||||||
ref="table"
|
:side-menu="false"
|
||||||
:tabulator-options="tabulatorOptions"
|
reload
|
||||||
table-only
|
new-btn-show
|
||||||
:side-menu="false"
|
new-btn-label="Pruefung"
|
||||||
reload
|
@click:new="actionNewPruefung"
|
||||||
new-btn-show
|
>
|
||||||
new-btn-label="Pruefung"
|
</core-filter-cmpt>
|
||||||
@click:new="actionNewPruefung"
|
|
||||||
>
|
<p>Form </p>
|
||||||
</core-filter-cmpt>
|
|
||||||
</div>
|
<!--Modal: pruefungModal-->
|
||||||
|
<bs-modal ref="pruefungModal">
|
||||||
<div class="col-sm-6">
|
<template #title>
|
||||||
<p>Form </p>
|
<p v-if="statusNew" class="fw-bold mt-3">{{$p.t('ui', 'add_pruefung')}}</p>
|
||||||
|
<p v-else class="fw-bold mt-3">{{$p.t('ui', 'edit_pruefung')}}</p>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<form ref="form-pruefung" @submit.prevent class="row pt-3">
|
||||||
|
<legend>Details</legend>
|
||||||
|
|
||||||
aktuelles Sem: {{defaultSemester}}
|
<!--DropDown Lehrveranstaltung-->
|
||||||
|
<form-input
|
||||||
</div>
|
container-class="mb-3"
|
||||||
|
type="select"
|
||||||
|
name="lehrveranstaltung"
|
||||||
|
:label="$p.t('lehre/lehrveranstaltung')"
|
||||||
|
v-model="pruefungData.lehrveranstaltung_id"
|
||||||
|
>
|
||||||
|
<option
|
||||||
|
v-for="lv in listLvs"
|
||||||
|
:key="lv.lehrveranstaltung_id"
|
||||||
|
:value="lv.lehrveranstaltung_id"
|
||||||
|
>
|
||||||
|
{{lv.bezeichnung}} Semester {{lv.semester}} {{lv.lehrform_kurzbz}}
|
||||||
|
</option>
|
||||||
|
</form-input>
|
||||||
|
|
||||||
|
<!--DropDown Lv-Teil-->
|
||||||
|
<form-input
|
||||||
|
container-class="mb-3"
|
||||||
|
type="select"
|
||||||
|
name="lehreinheit"
|
||||||
|
:label="$p.t('lehre/lehreinheit')"
|
||||||
|
v-model="pruefungData.lehreinheit_id"
|
||||||
|
>
|
||||||
|
<option v-if="!listLes.length" disabled> -- Bitte Lv_Teil wählen --</option>
|
||||||
|
<option
|
||||||
|
v-for="le in isStartDropDown ? lv_teile : listLes"
|
||||||
|
:key="le.lehreinheit_id"
|
||||||
|
:value="le.lehreinheit_id"
|
||||||
|
>
|
||||||
|
{{le.kurzbz}}-{{le.lehrform_kurzbz}} {{le.bezeichnung}} {{le.gruppe}} ({{le.mitarbeiter_uid}})
|
||||||
|
</option>
|
||||||
|
</form-input>
|
||||||
|
|
||||||
|
<!--DropDown MitarbeiterIn-->
|
||||||
|
<form-input
|
||||||
|
container-class="mb-3"
|
||||||
|
type="select"
|
||||||
|
name="mitarbeiter"
|
||||||
|
:label="$p.t('fristenmanagement/mitarbeiterin')"
|
||||||
|
v-model="pruefungData.mitarbeiter_uid"
|
||||||
|
>
|
||||||
|
<option value="null"> -- keine Auswahl -- </option>
|
||||||
|
<option
|
||||||
|
v-for="ma in isStartDropDown ? lv_teile_ma : listMas"
|
||||||
|
:key="ma.mitarbeiter_uid"
|
||||||
|
:value="ma.mitarbeiter_uid"
|
||||||
|
>
|
||||||
|
{{ma.vorname}} {{ma.nachname}}
|
||||||
|
</option>
|
||||||
|
</form-input>
|
||||||
|
|
||||||
|
<!--DropDown Typ Prüfungstermin-->
|
||||||
|
<form-input
|
||||||
|
container-class="mb-3"
|
||||||
|
type="select"
|
||||||
|
name="typ"
|
||||||
|
:label="$p.t('global/typ')"
|
||||||
|
v-model="pruefungData.pruefungstyp_kurzbz"
|
||||||
|
>
|
||||||
|
<option
|
||||||
|
v-for="typ in listTypesExam"
|
||||||
|
:key="typ.pruefungstyp_kurzbz"
|
||||||
|
:value="typ.pruefungstyp_kurzbz"
|
||||||
|
>
|
||||||
|
{{typ.beschreibung}}
|
||||||
|
</option>
|
||||||
|
</form-input>
|
||||||
|
|
||||||
|
<!--DropDown Note-->
|
||||||
|
<form-input
|
||||||
|
container-class="mb-3"
|
||||||
|
type="select"
|
||||||
|
name="typ"
|
||||||
|
:label="$p.t('lehre/note')"
|
||||||
|
v-model="pruefungData.note"
|
||||||
|
>
|
||||||
|
<option
|
||||||
|
v-for="note in listMarks"
|
||||||
|
:key="note.note"
|
||||||
|
:value="note.note"
|
||||||
|
>
|
||||||
|
{{note.bezeichnung}}
|
||||||
|
</option>
|
||||||
|
</form-input>
|
||||||
|
|
||||||
|
<!--DropDown Datum-->
|
||||||
|
<form-input
|
||||||
|
container-class="mb-3"
|
||||||
|
type="DatePicker"
|
||||||
|
v-model="pruefungData.datum"
|
||||||
|
name="datum"
|
||||||
|
:label="$p.t('global/datum')"
|
||||||
|
auto-apply
|
||||||
|
:enable-time-picker="false"
|
||||||
|
format="dd.MM.yyyy"
|
||||||
|
preview-format="dd.MM.yyyy"
|
||||||
|
:teleport="true"
|
||||||
|
>
|
||||||
|
</form-input>
|
||||||
|
|
||||||
|
<form-input
|
||||||
|
container-class="mb-3"
|
||||||
|
type="text"
|
||||||
|
name="name"
|
||||||
|
:label="$p.t('global/anmerkung')"
|
||||||
|
v-model="pruefungData.anmerkung"
|
||||||
|
>
|
||||||
|
</form-input>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
statusNew: {{statusNew}}<br>
|
||||||
|
isStartDropDown: {{isStartDropDown}}
|
||||||
|
<button type="button" class="btn btn-primary" @click="statusNew ? addPruefung() : updatePruefung(pruefungData.pruefung_id)">{{$p.t('ui', 'speichern')}}</button>
|
||||||
|
</template>
|
||||||
|
</bs-modal>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>`
|
</div>`
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user