Popup Löschen bei letzter Rolle

This commit is contained in:
ma0068
2024-03-19 14:31:50 +01:00
parent 54b2dce3d6
commit a495ff9b98
2 changed files with 55 additions and 8 deletions
@@ -55,6 +55,22 @@ class Status extends FHC_Controller
$this->outputJson($result);
}
public function isLastStatus($prestudent_id)
{
$this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
$result = $this->PrestudentstatusModel->checkIfLastStatusEntry($prestudent_id);
if (isError($result))
{
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
return $this->outputJson($result);
}
if($result->retval == "1")
{
return $this->outputJson($result->retval);
}
$this->outputJson($result);
}
public function addNewStatus($prestudent_id)
{
//get Studiengang von prestudent_id
@@ -627,7 +643,7 @@ $sqlundo =
//Delete Prestudent if no data is left
if($deletePrestudent)
if($deletePrestudent && $isBerechtigtAdmin)
{
//TODO(manu) check all connected tables
@@ -652,7 +668,7 @@ $sqlundo =
$output .= ' '. $doc->dokument_kurzbz;
}
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
return $this->outputJson("Achtung, es sind noch zu loeschende Dokumente vorhanden: " . $output);
return $this->outputJson("Es sind noch zu loeschende Dokumente vorhanden: " . $output);
}
//check if Anrechnungen tbl_anrechnung
@@ -676,7 +692,7 @@ $sqlundo =
$output_anrechnungen .= ' '. $anr->anrechnung_id;
}
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
return $this->outputJson("Achtung, es sind mit dieser Prestudent_id verbundene Anrechnungen vorhanden (id) : " . $output_anrechnungen);
return $this->outputJson("Mit dieser Prestudent_id sind verbundene Anrechnungen vorhanden (id) : " . $output_anrechnungen);
}
//DELETE Prestudent
@@ -1222,7 +1238,8 @@ $sqlundo =
}
//Data of current Semester
$studentlvbData = current(getData($result));
$result = getData($result) ? : [];
$studentlvbData = current($result);
$this->load->model('education/Studentlehrverband_model', 'StudentlehrverbandModel');
$result = $this->StudentlehrverbandModel->processStudentlehrverband($student_uid, $studentlvbData->studiengang_kz, $ausbildungssem_next, $studentlvbData->verband, $studentlvbData->gruppe, $studiensem_next);
@@ -156,7 +156,8 @@ export default{
statusId: {},
gruendeLength: {},
dataMeldestichtag: null,
stichtag: {}
stichtag: {},
isLastStatus: {}
}
},
computed: {
@@ -205,6 +206,8 @@ export default{
'ausbildungssemester': ausbildungssemester
};
this.checkIfLastStatus();
this.loadStatus(this.statusId).then(() => {
if(this.statusData)
this.$refs.deleteStatusModal.show();
@@ -306,8 +309,8 @@ export default{
const errorData = result.data.retval;
this.$fhcAlert.alertError('Kein Status mit Id ' + status_id + ' gefunden');
}
/* return result;*/
}).catch(error => {
}
).catch(error => {
if (error.response) {
console.log(error.response);
this.$fhcAlert.alertError(error.response.data);
@@ -373,6 +376,24 @@ export default{
this.reload();
});
},
checkIfLastStatus(){
return CoreRESTClient.get('components/stv/Status/isLastStatus/' + this.prestudent_id)
.then(
result => {
if(result.data){
this.isLastStatus = result.data;
} else {
this.isLastStatus = {};
}
return result;
}).catch(error => {
if (error.response) {
console.log(error.response);
this.$fhcAlert.alertError(error.response.data);
}
}
);
},
loadStatus(status_id){
return CoreRESTClient.post('components/stv/Status/loadStatus/',
status_id)
@@ -439,6 +460,9 @@ export default{
<p>TestData</p>
isLastStatus: {{isLastStatus}}
<br>
Bismeldestichtag
{{dataMeldestichtag }}
@@ -795,8 +819,14 @@ export default{
<BsModal ref="deleteStatusModal">
<template #title>Status löschen</template>
<template #default>
<div v-if="isLastStatus == 1">
<p>Das Loeschen der letzten Rolle loescht auch den gesamten Prestudent-Datensatz! Moechten Sie fortfahren?</p>
</div>
<div v-else>
<p>Prestudentstatus {{statusData.status_kurzbz}} (id: {{statusData.prestudent_id}}
/ {{statusData.studiensemester_kurzbz}}) im {{statusData.ausbildungssemester}}. Ausbildungssemester wirklich löschen?</p>
/ {{statusData.studiensemester_kurzbz}}) im {{statusData.ausbildungssemester}}. Ausbildungssemester wirklich löschen?</p>
</div>
</template>
<template #footer>
<button ref="Close" type="button" class="btn btn-primary" @click="deleteStatus(statusId)">OK</button>