Added Empfehlungsnotiz in STGL Detailview + minor GUI change

Now STGL can save and update notes regarding recommendation.

Therefore minor GUI change by displaying tables within panels instead of
appending directly to panel - in STGL and lectors Detail view. This is
for clearer view and gives space for the notes.

Signed-off-by: cris-technikum <hainberg@technikum-wien.at>
This commit is contained in:
Cris
2021-04-29 09:54:57 +02:00
committed by cris-technikum
parent 21ce118f0b
commit 81bd719e39
6 changed files with 191 additions and 60 deletions
@@ -15,6 +15,7 @@ class approveAnrechnungDetail extends Auth_Controller
const ANRECHNUNGSTATUS_REJECTED = 'rejected';
const ANRECHNUNG_NOTIZTITEL_NOTIZ_BY_STGL = 'AnrechnungNotizSTGL';
const ANRECHNUNG_NOTIZTITEL_EMPFEHLUNGSNOTIZ_BY_STGL = 'AnrechnungEmpfehlungsnotizSTGL';
public function __construct()
{
@@ -27,7 +28,8 @@ class approveAnrechnungDetail extends Auth_Controller
'reject' => 'lehre/anrechnung_genehmigen:rw',
'requestRecommendation' => 'lehre/anrechnung_genehmigen:rw',
'withdraw' => 'lehre/anrechnung_genehmigen:rw',
'withdrawRequestRecommendation' => 'lehre/anrechnung_genehmigen:rw'
'withdrawRequestRecommendation' => 'lehre/anrechnung_genehmigen:rw',
'saveEmpfehlungsNotiz' => 'lehre/anrechnung_genehmigen:rw'
)
);
@@ -359,6 +361,30 @@ class approveAnrechnungDetail extends Auth_Controller
'status_bezeichnung' => $this->anrechnunglib->getLastAnrechnungstatus($anrechnung_id))
);
}
public function saveEmpfehlungsNotiz()
{
$anrechnung_id = $this->input->post('anrechnung_id');
$notiz_id = $this->input->post('notiz_id');
$empfehlungstext = $this->input->post('empfehlung_text');
// Validate data
if (isEmptyString($anrechnung_id))
{
$this->terminateWithJsonError($this->p->t('ui', 'systemFehler'));
}
// Save Empfehlungstext
$result = self::_saveEmpfehlungsNotiz($anrechnung_id, $empfehlungstext, $notiz_id);
if (isError($result))
{
$this->terminateWithJsonError($this->p->t('ui', 'fehlerBeimSpeichern'));
}
// Output success message
$this->outputJsonSuccess($this->p->t('ui', 'gespeichert'));
}
/**
* Download and open uploaded document (Nachweisdokument).
@@ -582,5 +608,31 @@ class approveAnrechnungDetail extends Auth_Controller
return $lector_arr;
}
private function _saveEmpfehlungsNotiz($anrechnung_id, $empfehlungstext, $notiz_id)
{
$this->load->model('person/Notiz_model', 'NotizModel');
if (!isEmptyString($notiz_id))
{
return $this->NotizModel->update(
$notiz_id,
array(
'text' => $empfehlungstext,
'updateamum' => (new DateTime())->format('Y-m-d H:i:s'),
'updatevon' => $this->_uid
)
);
}
return $this->NotizModel->addNotizForAnrechnung(
$anrechnung_id,
self::ANRECHNUNG_NOTIZTITEL_EMPFEHLUNGSNOTIZ_BY_STGL,
trim($empfehlungstext),
$this->_uid
);
}
}
+19 -4
View File
@@ -12,6 +12,7 @@ class AnrechnungLib
const ANRECHNUNG_NOTIZTITEL_NOTIZ_BY_LEKTOR = 'AnrechnungNotizLektor';
const ANRECHNUNG_NOTIZTITEL_NOTIZ_BY_STGL = 'AnrechnungNotizSTGL';
const ANRECHNUNG_NOTIZTITEL_EMPFEHLUNGSNOTIZ_BY_STGL = 'AnrechnungEmpfehlungsnotizSTGL';
public function __construct()
{
@@ -24,6 +25,7 @@ class AnrechnungLib
$this->ci->load->model('crm/Student_model', 'StudentModel');
$this->ci->load->model('content/DmsVersion_model', 'DmsVersionModel');
$this->ci->load->model('crm/Prestudent_model', 'PrestudentModel');
$this->ci->load->model('person/Notiz_model', 'NotizModel');
$this->ci->load->library('DmsLib');
}
@@ -226,13 +228,27 @@ class AnrechnungLib
$empfehlung_data->empfehlung_am = '-';
$empfehlung_data->empfehlungsanfrageAm = '-';
$empfehlung_data->empfehlungsanfrageAn = '-';
$empfehlung_data->notiz = '-'; // Begruendung, if not recommended
$empfehlung_data->begruendung = '-'; // Begruendung, if not recommended
$empfehlung_data->notiz_id = ''; // Empfehlungsnotiz from STGL
$empfehlung_data->notiz = ''; // Empfehlungsnotiz from STGL
if(!$anrechnung = getData($this->ci->AnrechnungModel->load($anrechnung_id))[0])
{
show_error('Failed loading Anrechnung');
}
// Get Empfehlungsnotiz
$result = $this->ci->NotizModel->getNotizByAnrechnung(
$anrechnung_id,
self::ANRECHNUNG_NOTIZTITEL_EMPFEHLUNGSNOTIZ_BY_STGL
);
if ($notiz = getData($result)[0])
{
$empfehlung_data->notiz_id = $notiz->notiz_id;
$empfehlung_data->notiz = $notiz->text;
}
// Get date, where recommendation was last requested
$result = $this->ci->AnrechnungModel->getLastAnrechnungstatus(
@@ -288,11 +304,10 @@ class AnrechnungLib
if (!$anrechnung->empfehlung_anrechnung)
{
// Get Ablehnungsbegruendung (only set, if Anrechnung was not recommended yet)
$this->ci->load->model('person/Notiz_model', 'NotizModel');
$result = $this->ci->NotizModel->getNotizByAnrechnung($anrechnung_id, self::ANRECHNUNG_NOTIZTITEL_NOTIZ_BY_LEKTOR);
if ($notiz = getData($result)[0])
{
$empfehlung_data->notiz = $notiz->text;
$empfehlung_data->begruendung = $notiz->text;
}
}
@@ -75,7 +75,6 @@ $this->load->view(
<div class="col-xs-8">
<div class="panel panel-default">
<div class="panel-body">
<!-- Antragsdaten -->
<div class="row">
<div class="col-lg-12">
@@ -90,7 +89,10 @@ $this->load->view(
<span class="pull-right"><?php echo $this->p->t('anrechnung', 'antragdatum'); ?>: <span
id="approveAnrechnung-status"><?php echo !empty($anrechnungData->anrechnung_id) ? $anrechnungData->insertamum : '-' ?></span></span>
</div>
<table class="panel-body table table-bordered table-condensed">
<div class="panel-body">
<div class="row">
<div class="col-lg-12">
<table class="table table-bordered table-condensed">
<tbody>
<tr>
<th class="col-xs-4"><?php echo ucfirst($this->p->t('person', 'studentIn')); ?></th>
@@ -143,16 +145,16 @@ $this->load->view(
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Empfehlungsdaten -->
<div class="row">
<div class="col-lg-12">
<form>
<input type="hidden" name="anrechnung_id"
value="<?php echo $anrechnungData->anrechnung_id ?>">
<div class="panel panel-default" id="approveAnrechnungDetail-empfehlung"
<div class="panel panel-default" id="approveAnrechnungDetail-empfehlung"
data-empfehlung="<?php echo json_encode($empfehlungData->empfehlung) ?>">
<div class="panel-heading">
<span class="text-uppercase"><b><?php echo $this->p->t('anrechnung', 'empfehlung'); ?></b></span>&emsp;
@@ -164,42 +166,67 @@ $this->load->view(
<span id="approveAnrechnungDetail-empfehlungAm"><?php echo $empfehlungData->empfehlung_am ?></span>
</div>
</div>
<table class="panel-body table table-bordered table-condensed">
<tbody>
<tr>
<th class="col-xs-4"><?php echo ucfirst($this->p->t('anrechnung', 'empfehlungsanfrageAm')); ?></th>
<td id="approveAnrechnungDetail-empfehlungDetail-empfehlungsanfrageAm">
<?php echo $empfehlungData->empfehlungsanfrageAm; ?>
</td>
</tr>
<tr>
<th class="col-xs-4"><?php echo $this->p->t('anrechnung', 'empfehlungsanfrageAn'); ?></th>
<td id="approveAnrechnungDetail-empfehlungDetail-empfehlungsanfrageAn">
<?php echo $empfehlungData->empfehlungsanfrageAn; ?>
</td>
</tr>
<tr>
<th class="col-xs-4"><?php echo ucfirst($this->p->t('anrechnung', 'empfehlungAm')); ?></th>
<td><?php echo $empfehlungData->empfehlung_am ?></td>
</tr>
<tr>
<th class="col-xs-4"><?php echo ucfirst($this->p->t('anrechnung', 'empfehlungVon')); ?></th>
<td><?php echo $empfehlungData->empfehlung_von ?></td>
</tr>
<tr>
<th class="col-xs-4"><?php echo $this->p->t('anrechnung', 'empfehlung'); ?></th>
<td id="approveAnrechnungDetail-empfehlungDetail-empfehlung"></td>
</tr>
<tr>
<th class="col-xs-4"><?php echo $this->p->t('global', 'begruendung'); ?></th>
<td id="approveAnrechnungDetail-empfehlungDetail-begruendung">
<?php echo htmlentities($empfehlungData->notiz) ?>
</td>
</tr>
</tbody>
</table>
<div class="panel-body">
<div class="row">
<div class="col-lg-7">
<form id="form-empfehlung">
<input type="hidden" name="anrechnung_id"
value="<?php echo $anrechnungData->anrechnung_id ?>">
<table class="table table-bordered table-condensed">
<tbody>
<tr>
<th class="col-xs-4"><?php echo ucfirst($this->p->t('anrechnung', 'empfehlungsanfrageAm')); ?></th>
<td id="approveAnrechnungDetail-empfehlungDetail-empfehlungsanfrageAm">
<?php echo $empfehlungData->empfehlungsanfrageAm; ?>
</td>
</tr>
<tr>
<th class="col-xs-4"><?php echo $this->p->t('anrechnung', 'empfehlungsanfrageAn'); ?></th>
<td id="approveAnrechnungDetail-empfehlungDetail-empfehlungsanfrageAn">
<?php echo $empfehlungData->empfehlungsanfrageAn; ?>
</td>
</tr>
<tr>
<th class="col-xs-4"><?php echo ucfirst($this->p->t('anrechnung', 'empfehlungAm')); ?></th>
<td><?php echo $empfehlungData->empfehlung_am ?></td>
</tr>
<tr>
<th class="col-xs-4"><?php echo ucfirst($this->p->t('anrechnung', 'empfehlungVon')); ?></th>
<td><?php echo $empfehlungData->empfehlung_von ?></td>
</tr>
<tr>
<th class="col-xs-4"><?php echo $this->p->t('anrechnung', 'empfehlung'); ?></th>
<td id="approveAnrechnungDetail-empfehlungDetail-empfehlung"></td>
</tr>
<tr>
<th class="col-xs-4"><?php echo $this->p->t('global', 'begruendung'); ?></th>
<td id="approveAnrechnungDetail-empfehlungDetail-begruendung">
<?php echo htmlentities($empfehlungData->begruendung) ?>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<div class="col-lg-5">
<form id="form-empfehlungNotiz">
<input type="hidden" name="anrechnung_id"
value="<?php echo $anrechnungData->anrechnung_id ?>">
<input type="hidden" name="notiz_id"
value="<?php echo $empfehlungData->notiz_id ?>">
<div class="form-group">
<label class="text-center">
<?php echo ucfirst($this->p->t('global', 'notiz')); ?>
</label>
<textarea name="empfehlungText" rows="4"><?php echo htmlentities($empfehlungData->notiz) ?></textarea>
</div>
<input type="submit" class="btn btn-default pull-right" value="<?php echo ucfirst($this->p->t('ui', 'speichern')); ?>">
</form>
</div>
</div>
</div>
</div>
</form>
<div class="pull-right">
<button id="approveAnrechnungDetail-withdraw-request-recommedation"
class="btn btn-default btn-w200 <?php echo (is_null($empfehlungData->empfehlung) &&
@@ -342,10 +369,8 @@ $this->load->view(
</div>
</div>
</div>
</div>
<div class="pull-right">
<button id="approveAnrechnungDetail-withdraw-anrechnung-approvement"
class="btn btn-default btn-w200 <?php echo ($anrechnungData->status_kurzbz == 'approved' ||
@@ -364,7 +389,6 @@ $this->load->view(
<?php echo ucfirst($this->p->t('global', 'genehmigen')); ?>
</button>
</div>
</div>
<div class="col-xs-4">
@@ -378,7 +402,7 @@ $this->load->view(
<br>
<?php $this->load->view('lehre/anrechnung/reviewAnrechnungInfo'); ?>
</div>
</div>
</div><!--end row-->
</div>
</div>
@@ -85,7 +85,8 @@ $this->load->view(
<span class="pull-right"><?php echo $this->p->t('anrechnung', 'antragdatum'); ?>: <span
id="reviewAnrechnung-status"><?php echo !empty($anrechnungData->anrechnung_id) ? $anrechnungData->insertamum : '-' ?></span></span>
</div>
<table class="panel-body table table-bordered table-condensed">
<div class="panel-body">
<table class="table table-bordered table-condensed">
<tbody>
<tr>
<th class="col-xs-4"><?php echo ucfirst($this->p->t('person', 'studentIn')); ?></th>
@@ -138,6 +139,7 @@ $this->load->view(
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
@@ -157,8 +159,8 @@ $this->load->view(
</div>
</div>
<table class="panel-body table table-bordered table-condensed">
<div class="panel-body">
<table class="table table-bordered table-condensed">
<tbody>
<tr>
@@ -192,11 +194,12 @@ $this->load->view(
<tr>
<th class="col-xs-4"><?php echo $this->p->t('global', 'begruendung'); ?></th>
<td id="reviewAnrechnungDetail-empfehlungDetail-begruendung">
<?php echo htmlentities($empfehlungData->notiz) ?>
<?php echo htmlentities($empfehlungData->begruendung) ?>
</td>
</tr>
</tbody>
</table>
</div>
<div class="panel-body">
<form>
<input type="hidden" name="anrechnung_id"
@@ -164,10 +164,12 @@ $(function(){
});
// Request Recommendation for Anrechnungen
$("#approveAnrechnungDetail-request-recommendation").click(function(){
$("#approveAnrechnungDetail-request-recommendation").click(function(e){
e.preventDefault();
// Get form data
let form_data = $('form').serializeArray();
let form_data = $('#form-empfehlung').serializeArray();
// Prepare data object for ajax call
@@ -256,7 +258,9 @@ $(function(){
});
// Withdraw request for recommendation
$("#approveAnrechnungDetail-withdraw-request-recommedation").click(function(){
$("#approveAnrechnungDetail-withdraw-request-recommedation").click(function(e){
e.preventDefault();
if(!confirm(FHC_PhrasesLib.t("anrechnung", "empfehlungsanforderungWirklichZuruecknehmen")))
{
@@ -264,7 +268,7 @@ $(function(){
}
// Get form data
let form_data = $('form').serializeArray();
let form_data = $('#form-empfehlung').serializeArray();
// Prepare data object for ajax call
let data = {
@@ -304,6 +308,39 @@ $(function(){
);
});
$('#form-empfehlungNotiz').submit(function(e){
e.preventDefault();
FHC_AjaxClient.ajaxCallPost(
FHC_JS_DATA_STORAGE_OBJECT.called_path + "/saveEmpfehlungsNotiz",
{
anrechnung_id: this.anrechnung_id.value,
notiz_id: this.notiz_id.value,
empfehlung_text: this.empfehlungText.value
},
{
successCallback: function (data){
if (FHC_AjaxClient.isError(data)){
// Print error message
FHC_DialogLib.alertWarning(FHC_AjaxClient.getError(data));
}
if (FHC_AjaxClient.hasData(data)){
// Print success message
FHC_DialogLib.alertSuccess((FHC_AjaxClient.getData(data)))
}
},
errorCallback(){
FHC_DialogLib.alertError(FHC_PhrasesLib.t("ui", "systemfehler"));
}
}
)
})
// Copy Begruendung into textarea
$(".btn-copyIntoTextarea").click(function(){
approveAnrechnungDetail.copyIntoTextarea(this);
+2 -2
View File
@@ -12001,7 +12001,7 @@ array(
'phrases' => array(
array(
'sprache' => 'German',
'text' => "Empfehlung angefragt an",
'text' => "Anfrage an",
'description' => '',
'insertvon' => 'system'
),
@@ -12021,7 +12021,7 @@ array(
'phrases' => array(
array(
'sprache' => 'German',
'text' => "Empfehlung angefragt am",
'text' => "Anfrage am",
'description' => '',
'insertvon' => 'system'
),