mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-16 22:42:16 +00:00
qualgate 1&2 dbupdate script, note fkey reference & upload required flag in paabgabe; noten api duplicate from notentool for now; WIP more emails; qualgates benotbar & saveable aswell as upload flag;
This commit is contained in:
@@ -27,7 +27,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
//require_once('../../../include/projektarbeit.class.php');
|
||||
//require_once('../../../include/projektbetreuer.class.php');
|
||||
|
||||
class Lehre extends FHCAPI_Controller
|
||||
class Abgabe extends FHCAPI_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -45,7 +45,8 @@ class Lehre extends FHCAPI_Controller
|
||||
'deleteProjektarbeitAbgabe' => self::PERM_LOGGED,
|
||||
'postSerientermin' => self::PERM_LOGGED,
|
||||
'fetchDeadlines' => self::PERM_LOGGED, // TODO: mitarbeiter recht prüfen
|
||||
'getPaAbgabetypen' => self::PERM_LOGGED
|
||||
'getPaAbgabetypen' => self::PERM_LOGGED,
|
||||
'getNoten' => self::PERM_LOGGED
|
||||
]);
|
||||
|
||||
$this->load->library('PhrasesLib');
|
||||
@@ -100,8 +101,10 @@ class Lehre extends FHCAPI_Controller
|
||||
/**
|
||||
* fetches all projektarbeiten and betreuer for a given student_uid used in cis4 student abgabetool
|
||||
*/
|
||||
public function getStudentProjektarbeiten($uid)
|
||||
public function getStudentProjektarbeiten()
|
||||
{
|
||||
$uid = $this->input->get("uid",TRUE);
|
||||
|
||||
$this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel');
|
||||
$this->load->model('education/Projektarbeit_model', 'ProjektarbeitModel');
|
||||
|
||||
@@ -254,8 +257,7 @@ class Lehre extends FHCAPI_Controller
|
||||
}
|
||||
|
||||
private function signaturFehltEmail($student_uid) {
|
||||
|
||||
|
||||
|
||||
// Mail an Studiengang wenn keine Signatur gefunden wurde
|
||||
$student = new student();
|
||||
if(!$student->load($student_uid))
|
||||
@@ -326,6 +328,10 @@ class Lehre extends FHCAPI_Controller
|
||||
$maildata['bewertunglink'] = $num_rows_sem >= 1 && $paabgabetyp_kurzbz == 'end' ? "<p><a href='$mail_fulllink'>Zur Beurteilung der Arbeit</a></p>" : "";
|
||||
$maildata['token'] = "";
|
||||
|
||||
// TODO: clarify if all betreuer are mitarbeiter and have benutzer entries
|
||||
// or if uid = null has to be checked WITH
|
||||
// 'CASE WHEN tbl_benutzer.uid IS NULL THEN kontakt ELSE tbl_benutzer.uid || '@".DOMAIN."' END AS email'
|
||||
|
||||
$email = $this->getBetreuerEmail($bperson_id);
|
||||
|
||||
if(!$email) $this->terminateWithError($this->p->t('abgabetool', 'fehlerMailBegutachter'), 'general');
|
||||
@@ -334,7 +340,6 @@ class Lehre extends FHCAPI_Controller
|
||||
'ParbeitsbeurteilungEndupload',
|
||||
$maildata,
|
||||
$email,
|
||||
// $betreuerRow->mitarbeiter_uid."@".DOMAIN,
|
||||
$subject,
|
||||
'sancho_header_min_bw.jpg',
|
||||
'sancho_footer_min_bw.jpg',
|
||||
@@ -397,6 +402,12 @@ class Lehre extends FHCAPI_Controller
|
||||
$zweitbetmaildata['bewertunglink'] = $num_rows_sem >= 1 ? "<p><a href='$mail_link'>Zur Beurteilung der Arbeit</a></p>" : "";
|
||||
$zweitbetmaildata['token'] = $num_rows_sem >= 1 && isset($begutachterMitToken->zugangstoken) && !$intern ? "<p>Zugangstoken: " . $begutachterMitToken->zugangstoken . "</p>" : "";
|
||||
|
||||
|
||||
$email = $this->getBetreuerEmail($bperson_id);
|
||||
|
||||
if(!$email) $this->terminateWithError($this->p->t('abgabetool', 'fehlerMailBegutachter'), 'general');
|
||||
|
||||
|
||||
$mailres = sendSanchoMail(
|
||||
'ParbeitsbeurteilungEndupload',
|
||||
$zweitbetmaildata,
|
||||
@@ -443,7 +454,8 @@ class Lehre extends FHCAPI_Controller
|
||||
|
||||
$this->terminateWithSuccess(array($projektarbeiten, DOMAIN));
|
||||
}
|
||||
|
||||
|
||||
// called by abgabetool/mitarbeiter when adding a new termin
|
||||
public function postProjektarbeitAbgabe() {
|
||||
$projektarbeit_id = $_POST['projektarbeit_id'];
|
||||
$paabgabe_id = $_POST['paabgabe_id'];
|
||||
@@ -451,6 +463,8 @@ class Lehre extends FHCAPI_Controller
|
||||
$datum = $_POST['datum'];
|
||||
$fixtermin = $_POST['fixtermin'];
|
||||
$kurzbz = $_POST['kurzbz'];
|
||||
$note = $_POST['note'];
|
||||
$upload_required = $_POST['upload_required'];
|
||||
|
||||
if (!isset($projektarbeit_id) || isEmptyString($projektarbeit_id)
|
||||
|| !isset($paabgabe_id) || isEmptyString($paabgabe_id)
|
||||
@@ -469,12 +483,14 @@ class Lehre extends FHCAPI_Controller
|
||||
'fixtermin' => $fixtermin,
|
||||
'datum' => $datum,
|
||||
'kurzbz' => $kurzbz,
|
||||
'note' => $note,
|
||||
'upload_required' => $upload_required,
|
||||
'insertvon' => getAuthUID(),
|
||||
'insertamum' => date('Y-m-d H:i:s')
|
||||
)
|
||||
);
|
||||
|
||||
$this->terminateWithSuccess($result);
|
||||
|
||||
} else {
|
||||
$result = $this->PaabgabeModel->update(
|
||||
$paabgabe_id,
|
||||
@@ -482,13 +498,25 @@ class Lehre extends FHCAPI_Controller
|
||||
'paabgabetyp_kurzbz' => $paabgabetyp_kurzbz,
|
||||
'datum' => $datum,
|
||||
'kurzbz' => $kurzbz,
|
||||
'note' => $note,
|
||||
'upload_required' => $upload_required,
|
||||
'updatevon' => getAuthUID(),
|
||||
'updateamum' => date('Y-m-d H:i:s')
|
||||
)
|
||||
);
|
||||
|
||||
$this->terminateWithSuccess($result);
|
||||
|
||||
}
|
||||
|
||||
$paabgabe_id = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$paabgabe = $this->PaabgabeModel->load($paabgabe_id);
|
||||
|
||||
// check if $paaabgabe is a qual gate and its note is deemed negative
|
||||
// -> send email to student with that info
|
||||
|
||||
// TODO: DEFAULT NOTE 9 OR DEFAULT NOTE NULL? 9 COUNTS AS NEGATIV :/
|
||||
|
||||
$this->terminateWithSuccess($result);
|
||||
}
|
||||
|
||||
public function deleteProjektarbeitAbgabe() {
|
||||
@@ -631,17 +659,58 @@ class Lehre extends FHCAPI_Controller
|
||||
|
||||
$result = $this->PaabgabetypModel->getAll();
|
||||
$paabgabetypen = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
|
||||
$this->terminateWithSuccess($paabgabetypen);
|
||||
}
|
||||
|
||||
private function getBetreuerEmail($person_id) {
|
||||
// check if betreuer is intern (fixangestellt = true)
|
||||
// -> email: uid@DOMAIN
|
||||
|
||||
// if betreuer is extern, check if there are private email contacts
|
||||
// in tbl_kontakt. if so, return them
|
||||
|
||||
return null;
|
||||
$this->load->model('education/Projektbetreuer_model', 'ProjektbetreuerModel');
|
||||
$result = $this->ProjektbetreuerModel->getBetreuerEmail($person_id);
|
||||
$email = $this->getDataOrTerminateWithError($result);
|
||||
return $email[0]->email;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: SWITCH TO NOTEN API ONCE NOTENTOOL IS IN MASTER TO AVOID DUPLICATE API
|
||||
|
||||
/**
|
||||
* GET METHOD
|
||||
* returns List of all available & active NotenOptions
|
||||
*/
|
||||
public function getNoten() {
|
||||
$this->load->model('education/Note_model', 'NoteModel');
|
||||
|
||||
$result = $this->NoteModel->getAllActive();
|
||||
$noten = $this->getDataOrTerminateWithError($result);
|
||||
$this->terminateWithSuccess($noten);
|
||||
}
|
||||
|
||||
private function sendQualGateNegativEmail($student_uid) {
|
||||
// Mail an Student wenn Qualgate negativ beurteilt wurde
|
||||
$student = new student();
|
||||
if(!$student->load($student_uid))
|
||||
$this->terminateWithError($this->p->t('global','userNichtGefunden'), 'general');
|
||||
|
||||
// TODO: frasen
|
||||
$subject = 'Quality Gate Negativ';
|
||||
$tomail = $student_uid.'@'.DOMAIN;
|
||||
|
||||
|
||||
// TODO: emaildata
|
||||
$data = array(
|
||||
'betreuerfullname' => $student->vorname,
|
||||
'qualgatebezeichnung' => $student->nachname,
|
||||
'datum' => $datum,
|
||||
'projektarbeitname' => $name
|
||||
);
|
||||
|
||||
$mailres = sendSanchoMail(
|
||||
'QualGateNegativ',
|
||||
$data,
|
||||
$tomail,
|
||||
$subject
|
||||
);
|
||||
|
||||
return $mailres;
|
||||
}
|
||||
}
|
||||
@@ -11,4 +11,12 @@ class Note_model extends DB_Model
|
||||
$this->dbTable = 'lehre.tbl_note';
|
||||
$this->pk = 'note';
|
||||
}
|
||||
|
||||
public function getAllActive() {
|
||||
$qry ="SELECT *
|
||||
FROM lehre.tbl_note
|
||||
WHERE aktiv = true";
|
||||
|
||||
return $this->execReadOnlyQuery($qry);
|
||||
}
|
||||
}
|
||||
@@ -167,6 +167,8 @@ class Projektarbeit_model extends DB_Model
|
||||
campus.tbl_paabgabe.fixtermin,
|
||||
campus.tbl_paabgabe.kurzbz,
|
||||
campus.tbl_paabgabe.datum,
|
||||
campus.tbl_paabgabe.note,
|
||||
campus.tbl_paabgabe.upload_required,
|
||||
campus.tbl_paabgabetyp.paabgabetyp_kurzbz,
|
||||
campus.tbl_paabgabetyp.bezeichnung,
|
||||
campus.tbl_paabgabe.abgabedatum,
|
||||
|
||||
@@ -231,4 +231,40 @@ class Projektbetreuer_model extends DB_Model
|
||||
|
||||
return $this->execQuery($qry, array($projektarbeit_id, $betreuer_person_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets email of a Betreuer for a Projektarbeit.
|
||||
* Projektarbeitbetreuer can be external employees, which should be contacted on their private
|
||||
* email contact, if they have one. Internal Betreuer should be contacted on their "uid@DOMAIN" adress.
|
||||
* @param int betreuer_person_id
|
||||
* @return object success or error
|
||||
*/
|
||||
public function getBetreuerEmail($betreuer_person_id) {
|
||||
// TODO: check if benutzer uid exists, not fixangestellt
|
||||
|
||||
$qry ="
|
||||
SELECT uid,
|
||||
CASE
|
||||
WHEN public.tbl_mitarbeiter.fixangestellt = false
|
||||
THEN (
|
||||
SELECT kontakt AS email
|
||||
FROM public.tbl_kontakt
|
||||
WHERE
|
||||
public.tbl_kontakt.person_id = ? AND
|
||||
kontakttyp = 'email'
|
||||
)
|
||||
|
||||
ELSE (
|
||||
SELECT public.tbl_benutzer.uid || '@' || '".DOMAIN."' AS email
|
||||
FROM public.tbl_benutzer
|
||||
WHERE person_id = ?
|
||||
)
|
||||
END AS email
|
||||
FROM public.tbl_benutzer
|
||||
JOIN public.tbl_mitarbeiter ON (public.tbl_benutzer.uid = public.tbl_mitarbeiter.mitarbeiter_uid)
|
||||
WHERE person_id = ?
|
||||
";
|
||||
|
||||
return $this->execReadOnlyQuery($qry, array($betreuer_person_id, $betreuer_person_id, $betreuer_person_id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,25 +17,17 @@ export default {
|
||||
return {
|
||||
method: 'post',
|
||||
url: '/api/frontend/v1/Abgabe/postStudentProjektarbeitEndupload',
|
||||
params: { formData },
|
||||
params: formData,
|
||||
config: {Headers: { "Content-Type": "multipart/form-data" }}
|
||||
};
|
||||
|
||||
// const url = '/api/frontend/v1/Lehre/postStudentProjektarbeitEndupload';
|
||||
// const headers = {Headers: { "Content-Type": "multipart/form-data" }}
|
||||
// return this.$fhcApi.post(url, formData, headers)
|
||||
},
|
||||
postStudentProjektarbeitZwischenabgabe(formData) {
|
||||
return {
|
||||
method: 'post',
|
||||
url: '/api/frontend/v1/Abgabe/postStudentProjektarbeitZwischenabgabe',
|
||||
params: { formData },
|
||||
params: formData,
|
||||
config: {Headers: { "Content-Type": "multipart/form-data" }}
|
||||
};
|
||||
|
||||
// const url = '/api/frontend/v1/Lehre/postStudentProjektarbeitZwischenabgabe';
|
||||
// const headers = {Headers: { "Content-Type": "multipart/form-data" }}
|
||||
// return this.$fhcApi.post(url, formData, headers)
|
||||
},
|
||||
getStudentProjektarbeitAbgabeFile(paabgabe_id, student_uid) {
|
||||
// TODO: check if this is fine with new api scheme
|
||||
@@ -59,6 +51,8 @@ export default {
|
||||
paabgabe_id: termin.paabgabe_id,
|
||||
paabgabetyp_kurzbz: termin.bezeichnung.paabgabetyp_kurzbz,
|
||||
datum: termin.datum,
|
||||
note: termin.note,
|
||||
upload_required: termin.upload_required,
|
||||
fixtermin: termin.fixtermin,
|
||||
insertvon: termin.insertvon,
|
||||
kurzbz: termin.kurzbz,
|
||||
@@ -92,5 +86,12 @@ export default {
|
||||
method: 'get',
|
||||
url: '/api/frontend/v1/Abgabe/getPaAbgabetypen'
|
||||
};
|
||||
}
|
||||
},
|
||||
//TODO: SWITCH TO NOTEN API ONCE NOTENTOOL IS IN MASTER TO AVOID DUPLICATE API
|
||||
getNoten(){
|
||||
return {
|
||||
method: 'get',
|
||||
url: '/api/frontend/v1/Abgabe/getNoten'
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -1,5 +1,6 @@
|
||||
import BsModal from '../../Bootstrap/Modal.js';
|
||||
import VueDatePicker from '../../vueDatepicker.js.php';
|
||||
import ApiAbgabe from '../../../api/factory/abgabe.js'
|
||||
|
||||
const today = new Date()
|
||||
export const AbgabeMitarbeiterDetail = {
|
||||
@@ -12,6 +13,7 @@ export const AbgabeMitarbeiterDetail = {
|
||||
Textarea: primevue.textarea,
|
||||
VueDatePicker
|
||||
},
|
||||
inject: ['abgabeTypeOptions', 'allowedNotenOptions'],
|
||||
props: {
|
||||
projektarbeit: {
|
||||
type: Object,
|
||||
@@ -23,30 +25,7 @@ export const AbgabeMitarbeiterDetail = {
|
||||
oldPaBeurteilungLink: 'https://moodle.technikum-wien.at/mod/page/view.php?id=1005052', // TODO: inject from app & app provide link from config
|
||||
eidAkzeptiert: false,
|
||||
enduploadTermin: null,
|
||||
allActiveLanguages: FHC_JS_DATA_STORAGE_OBJECT.server_languages,
|
||||
// TODO: fetch types
|
||||
allAbgabeTypes: [
|
||||
{
|
||||
paabgabetyp_kurzbz: 'abstract',
|
||||
bezeichnung: 'Entwurf'
|
||||
},
|
||||
{
|
||||
paabgabetyp_kurzbz: 'zwischen',
|
||||
bezeichnung: 'Zwischenabgabe'
|
||||
},
|
||||
{
|
||||
paabgabetyp_kurzbz: 'note',
|
||||
bezeichnung: 'Benotung'
|
||||
},
|
||||
{
|
||||
paabgabetyp_kurzbz: 'end',
|
||||
bezeichnung: 'Endupload'
|
||||
},
|
||||
{
|
||||
paabgabetyp_kurzbz: 'enda',
|
||||
bezeichnung: 'Endabgabe im Sekretariat'
|
||||
}
|
||||
]
|
||||
allActiveLanguages: FHC_JS_DATA_STORAGE_OBJECT.server_languages
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -55,6 +34,9 @@ export const AbgabeMitarbeiterDetail = {
|
||||
},
|
||||
saveTermin(termin) {
|
||||
const paabgabe_id = termin.paabgabe_id
|
||||
// 9 => magic number for "noch nicht eingetragen"
|
||||
termin.note = termin.note?.note ?? 9
|
||||
|
||||
this.$api.call(ApiAbgabe.postProjektarbeitAbgabe(termin)).then( (res) => {
|
||||
if(res?.meta?.status == 'success') {
|
||||
this.$fhcAlert.alertSuccess(this.$p.t('ui/gespeichert'))
|
||||
@@ -69,8 +51,10 @@ export const AbgabeMitarbeiterDetail = {
|
||||
'fixtermin': false,
|
||||
'kurzbz': '',
|
||||
'datum': new Date().toISOString().split('T')[0],
|
||||
'paabgabetyp_kurzbz': '',
|
||||
'bezeichnung': '',
|
||||
'paabgabetyp_kurzbz': termin.paabgabetyp_kurzbz,
|
||||
'note': this.allowedNotenOptions.find(opt => opt.note == termin.note?.note),
|
||||
'upload_required': termin.upload_required,
|
||||
'bezeichnung': this.abgabeTypeOptions.find(opt => opt.paabgabetyp_kurzbz === termin.paabgabetyp_kurzbz),
|
||||
'abgabedatum': null,
|
||||
'insertvon': this.viewData?.uid ?? '',
|
||||
'allowedToSave': true,
|
||||
@@ -149,6 +133,9 @@ export const AbgabeMitarbeiterDetail = {
|
||||
getOptionLabelAbgabetyp(option){
|
||||
return option.bezeichnung
|
||||
},
|
||||
getNotenOptionLabel(option) {
|
||||
return option.bezeichnung
|
||||
},
|
||||
formatDate(dateParam) {
|
||||
const date = new Date(dateParam)
|
||||
// handle missing leading 0
|
||||
@@ -200,10 +187,8 @@ export const AbgabeMitarbeiterDetail = {
|
||||
template: `
|
||||
<div v-if="projektarbeit">
|
||||
|
||||
|
||||
<h5>{{$p.t('abgabetool/c4abgabeMitarbeiterbereich')}}</h5>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<p> {{projektarbeit?.student}}</p>
|
||||
@@ -248,7 +233,9 @@ export const AbgabeMitarbeiterDetail = {
|
||||
<div style="width: 100px">{{$p.t('abgabetool/c4fixtermin')}}</div>
|
||||
<div class="col-2">{{$p.t('abgabetool/c4zieldatum')}}</div>
|
||||
<div class="col-2">{{$p.t('abgabetool/c4abgabetyp')}}</div>
|
||||
<div class="col-4">{{$p.t('abgabetool/c4abgabekurzbz')}}</div>
|
||||
<div class="col-2">{{$p.t('abgabetool/c4note')}}</div>
|
||||
<div class="col-1">{{$p.t('abgabetool/c4upload_required')}}</div>
|
||||
<div class="col-2">{{$p.t('abgabetool/c4abgabekurzbz')}}</div>
|
||||
<div class="col-1">{{$p.t('abgabetool/c4abgabedatum')}}</div>
|
||||
<div class="col">
|
||||
|
||||
@@ -278,12 +265,30 @@ export const AbgabeMitarbeiterDetail = {
|
||||
:style="{'width': '100%'}"
|
||||
:disabled="!termin.allowedToSave"
|
||||
v-model="termin.bezeichnung"
|
||||
:options="allAbgabeTypes"
|
||||
:options="abgabeTypeOptions"
|
||||
:optionLabel="getOptionLabelAbgabetyp">
|
||||
</Dropdown>
|
||||
</div>
|
||||
<div class="col-4 d-flex justify-content-center align-items-center">
|
||||
<Textarea style="margin-bottom: 4px;" v-model="termin.kurzbz" rows="3" cols="60" :disabled="!termin.allowedToSave"></Textarea>
|
||||
<div class="col-2 d-flex justify-content-center align-items-center">
|
||||
<Dropdown
|
||||
v-if="termin.bezeichnung?.paabgabetyp_kurzbz === 'qualgate1' || termin.bezeichnung?.paabgabetyp_kurzbz === 'qualgate2'"
|
||||
:style="{'width': '100%'}"
|
||||
v-model="termin.note"
|
||||
:options="allowedNotenOptions"
|
||||
:optionLabel="getNotenOptionLabel">
|
||||
</Dropdown>
|
||||
</div>
|
||||
<div class="col-1 d-flex justify-content-center align-items-center">
|
||||
<Checkbox
|
||||
v-if="termin.bezeichnung?.paabgabetyp_kurzbz === 'qualgate1' || termin.bezeichnung?.paabgabetyp_kurzbz === 'qualgate2'"
|
||||
v-model="termin.upload_required"
|
||||
:binary="true"
|
||||
:pt="{ root: { class: 'ml-auto' }}"
|
||||
>
|
||||
</Checkbox>
|
||||
</div>
|
||||
<div class="col-2 d-flex justify-content-center align-items-center">
|
||||
<Textarea style="margin-bottom: 4px;" v-model="termin.kurzbz" rows="3" cols="30" :disabled="!termin.allowedToSave"></Textarea>
|
||||
</div>
|
||||
<div class="col-1 d-flex justify-content-center align-items-center">
|
||||
{{ termin.abgabedatum?.split("-").reverse().join(".") }}
|
||||
@@ -310,7 +315,6 @@ export const AbgabeMitarbeiterDetail = {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
`,
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import Upload from '../../../components/Form/Upload/Dms.js';
|
||||
import BsModal from '../../Bootstrap/Modal.js';
|
||||
import VueDatePicker from '../../vueDatepicker.js.php';
|
||||
import ApiAbgabe from '../../../api/factory/abgabe.js'
|
||||
|
||||
const today = new Date()
|
||||
export const AbgabeStudentDetail = {
|
||||
@@ -198,7 +199,7 @@ export const AbgabeStudentDetail = {
|
||||
getEid() {
|
||||
return this.$p.t('abgabetool/c4eidesstattlicheErklaerung')
|
||||
},
|
||||
getEnduploadErlaubt() {
|
||||
getAllowedToSendEndupload() {
|
||||
return !this.eidAkzeptiert
|
||||
}
|
||||
},
|
||||
@@ -371,7 +372,7 @@ export const AbgabeStudentDetail = {
|
||||
|
||||
</template>
|
||||
<template v-slot:footer>
|
||||
<button class="btn btn-primary" :disabled="getEnduploadErlaubt" @click="triggerEndupload">{{$p.t('ui/hochladen')}}</button>
|
||||
<button class="btn btn-primary" :disabled="getAllowedToSendEndupload" @click="triggerEndupload">{{$p.t('ui/hochladen')}}</button>
|
||||
</template>
|
||||
</bs-modal>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import AbgabeDetail from "./AbgabeMitarbeiterDetail.js";
|
||||
import VerticalSplit from "../../verticalsplit/verticalsplit.js"
|
||||
import BsModal from '../../Bootstrap/Modal.js';
|
||||
import VueDatePicker from '../../vueDatepicker.js.php';
|
||||
import ApiAbgabe from '../../../api/abgabe.js'
|
||||
import ApiAbgabe from '../../../api/factory/abgabe.js'
|
||||
|
||||
export const AbgabetoolMitarbeiter = {
|
||||
name: "AbgabetoolMitarbeiter",
|
||||
@@ -16,6 +16,12 @@ export const AbgabetoolMitarbeiter = {
|
||||
Textarea: primevue.textarea,
|
||||
VueDatePicker
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
abgabeTypeOptions: Vue.computed(() => this.abgabeTypeOptions),
|
||||
allowedNotenOptions: Vue.computed(() => this.allowedNotenOptions)
|
||||
}
|
||||
},
|
||||
props: {
|
||||
viewData: {
|
||||
type: Object,
|
||||
@@ -30,29 +36,9 @@ export const AbgabetoolMitarbeiter = {
|
||||
return {
|
||||
saving: false,
|
||||
loading: false,
|
||||
// TODO: fetch types
|
||||
allAbgabeTypes: [
|
||||
{
|
||||
paabgabetyp_kurzbz: 'abstract',
|
||||
bezeichnung: 'Entwurf'
|
||||
},
|
||||
{
|
||||
paabgabetyp_kurzbz: 'zwischen',
|
||||
bezeichnung: 'Zwischenabgabe'
|
||||
},
|
||||
{
|
||||
paabgabetyp_kurzbz: 'note',
|
||||
bezeichnung: 'Benotung'
|
||||
},
|
||||
{
|
||||
paabgabetyp_kurzbz: 'end',
|
||||
bezeichnung: 'Endupload'
|
||||
},
|
||||
{
|
||||
paabgabetyp_kurzbz: 'enda',
|
||||
bezeichnung: 'Endabgabe im Sekretariat'
|
||||
}
|
||||
],
|
||||
abgabeTypeOptions: null,
|
||||
notenOptions: null,
|
||||
allowedNotenOptions: null,
|
||||
serienTermin: Vue.reactive({
|
||||
datum: new Date(),
|
||||
bezeichnung: {
|
||||
@@ -222,6 +208,8 @@ export const AbgabetoolMitarbeiter = {
|
||||
'fixtermin': false,
|
||||
'kurzbz': '',
|
||||
'datum': new Date().toISOString().split('T')[0],
|
||||
'note': this.allowedNotenOptions.find(opt => opt.note == 9),
|
||||
'upload_required': false,
|
||||
'paabgabetyp_kurzbz': '',
|
||||
'bezeichnung': '',
|
||||
'abgabedatum': null,
|
||||
@@ -229,6 +217,7 @@ export const AbgabetoolMitarbeiter = {
|
||||
|
||||
})
|
||||
pa.abgabetermine.forEach(termin => {
|
||||
termin.note = this.allowedNotenOptions.find(opt => opt.note == termin.note)
|
||||
termin.file = []
|
||||
termin.allowedToSave = termin.insertvon == this.viewData?.uid && pa.betreuerart_kurzbz != 'Zweitbegutachter'
|
||||
termin.allowedToDelete = termin.allowedToSave && !termin.abgabedatum
|
||||
@@ -370,10 +359,23 @@ export const AbgabetoolMitarbeiter = {
|
||||
|
||||
},
|
||||
created() {
|
||||
// fetch noten options
|
||||
//TODO: SWITCH TO NOTEN API ONCE NOTENTOOL IS IN MASTER TO AVOID DUPLICATE API
|
||||
this.$api.call(ApiAbgabe.getNoten()).then(res => {
|
||||
this.notenOptions = res.data
|
||||
// TODO: more sophisticated way to filter for these two, in essence it is still hardcoded
|
||||
this.allowedNotenOptions = this.notenOptions.filter(
|
||||
opt => opt.bezeichnung === 'Bestanden'
|
||||
|| opt.bezeichnung === 'Nicht bestanden'
|
||||
|| opt.bezeichnung === 'Noch nicht eingetragen'
|
||||
)
|
||||
}).catch(e => {
|
||||
this.loading = false
|
||||
})
|
||||
|
||||
// fetch abgabetypen options
|
||||
this.$api.call(ApiAbgabe.getPaAbgabetypen()).then(res => {
|
||||
this.paabgabetypOptions = res.data
|
||||
this.tabulatorCanBeBuilt = true // because promises would be more work and not much better here
|
||||
this.abgabeTypeOptions = res.data
|
||||
}).catch(e => {
|
||||
this.loading = false
|
||||
})
|
||||
@@ -419,7 +421,7 @@ export const AbgabetoolMitarbeiter = {
|
||||
<Dropdown
|
||||
:style="{'width': '100%'}"
|
||||
v-model="serienTermin.bezeichnung"
|
||||
:options="allAbgabeTypes"
|
||||
:options="abgabeTypeOptions"
|
||||
:optionLabel="getOptionLabelAbgabetyp">
|
||||
</Dropdown>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {CoreFilterCmpt} from "../../../components/filter/Filter.js";
|
||||
import AbgabeDetail from "./AbgabeStudentDetail.js";
|
||||
import VerticalSplit from "../../verticalsplit/verticalsplit.js";
|
||||
import ApiAbgabe from '../../../api/factory/abgabe.js'
|
||||
|
||||
export const AbgabetoolStudent = {
|
||||
name: "AbgabetoolStudent",
|
||||
@@ -82,6 +83,9 @@ export const AbgabetoolStudent = {
|
||||
]};
|
||||
},
|
||||
methods: {
|
||||
checkQualityGates(termine, enduploadtermin) {
|
||||
return true
|
||||
},
|
||||
isPastDate(date) {
|
||||
return new Date(date) < new Date(Date.now())
|
||||
},
|
||||
@@ -91,10 +95,11 @@ export const AbgabetoolStudent = {
|
||||
pa.abgabetermine = res.data[0].retval
|
||||
pa.abgabetermine.forEach(termin => {
|
||||
termin.file = []
|
||||
termin.allowedToUpload = true
|
||||
// termin.allowedToUpload = true
|
||||
|
||||
// TODO: fixtermin logic?
|
||||
if(termin.bezeichnung == 'Endupload' && this.isPastDate(termin.datum)) {
|
||||
if(termin.bezeichnung == 'Endupload' &&
|
||||
(this.isPastDate(termin.datum) || this.checkQualityGates(pa.abgabetermine, termin))) {
|
||||
|
||||
// termin.allowedToUpload = false
|
||||
} else {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {CoreFilterCmpt} from "../../../components/filter/Filter.js";
|
||||
import ApiAbgabe from '../../../api/factory/abgabe.js'
|
||||
|
||||
export const DeadlineOverview = {
|
||||
name: "DeadlineOverview",
|
||||
|
||||
@@ -164,6 +164,7 @@ export default {
|
||||
return fhcApiAxios.post(uri, data, config);
|
||||
},
|
||||
call(factory, configoverwrite, form) {
|
||||
debugger
|
||||
if (Array.isArray(factory)) {
|
||||
const $fhcAlert = app.config.globalProperties.$fhcAlert;
|
||||
const $api = app.config.globalProperties.$api;
|
||||
|
||||
@@ -27,3 +27,36 @@ if($result = $db->db_query("SELECT 1 FROM campus.tbl_paabgabetyp WHERE paabgabet
|
||||
echo '<br>paabgabetyp quality gate 2 hinzugefuegt';
|
||||
}
|
||||
}
|
||||
|
||||
if($result = $db->db_query("SELECT 1 FROM information_schema.columns WHERE table_schema = 'campus' AND table_name = 'tbl_paabgabe' AND column_name = 'note'"))
|
||||
{
|
||||
if($db->db_num_rows($result) === 0)
|
||||
{
|
||||
|
||||
$qry = "ALTER TABLE campus.tbl_paabgabe
|
||||
ADD COLUMN note SMALLINT NOT NULL DEFAULT 9,
|
||||
ADD CONSTRAINT tbl_paabgabe_note_fkey
|
||||
FOREIGN KEY (note)
|
||||
REFERENCES lehre.tbl_note(note)
|
||||
ON UPDATE CASCADE ON DELETE RESTRICT;";
|
||||
|
||||
if(!$db->db_query($qry))
|
||||
echo '<strong>campus.tbl_paabgabe: '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo '<br>paabgabe column note default 9 (noch nicht eingetragen) hinzugefuegt';
|
||||
}
|
||||
}
|
||||
|
||||
if($result = $db->db_query("SELECT 1 FROM information_schema.columns WHERE table_schema = 'campus' AND table_name = 'tbl_paabgabe' AND column_name = 'upload_required'"))
|
||||
{
|
||||
if($db->db_num_rows($result) === 0)
|
||||
{
|
||||
$qry = "ALTER TABLE campus.tbl_paabgabe
|
||||
ADD COLUMN IF NOT EXISTS upload_required boolean DEFAULT false;";
|
||||
|
||||
if(!$db->db_query($qry))
|
||||
echo '<strong>campus.tbl_paabgabe: '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo '<br>paabgabe column upload_required default false hinzugefuegt';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user