mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-22 01:12:17 +00:00
ChangeStatusLogic in component Dropdown
This commit is contained in:
@@ -402,7 +402,7 @@ class Status extends FHCAPI_Controller
|
||||
$this->terminateWithSuccess($prestudent_id);
|
||||
}
|
||||
break;
|
||||
/* case Prestudentstatus_model::STATUS_STUDENT:
|
||||
case Prestudentstatus_model::STATUS_STUDENT:
|
||||
{
|
||||
$this->load->library('PrestudentLib');
|
||||
$result = $this->prestudentlib->setStudent($prestudent_id, $studiensemester_kurzbz, $ausbildungssemester, $statusgrund_id, $bestaetigtam, $bestaetigtvon);
|
||||
@@ -415,7 +415,7 @@ class Status extends FHCAPI_Controller
|
||||
$this->terminateWithSuccess($prestudent_id);
|
||||
|
||||
}
|
||||
break;*/
|
||||
break;
|
||||
case Prestudentstatus_model::STATUS_DIPLOMAND:
|
||||
{
|
||||
$this->load->library('PrestudentLib');
|
||||
|
||||
@@ -3,13 +3,15 @@ import BsModal from "../../../../Bootstrap/Modal.js";
|
||||
import BsConfirm from "../../../../Bootstrap/Confirm.js";
|
||||
import FormInput from '../../../../Form/Input.js';
|
||||
import StatusModal from '../Status/Modal.js';
|
||||
import StatusDropdown from '../Status/Dropdown.js';
|
||||
|
||||
export default{
|
||||
components: {
|
||||
CoreFilterCmpt,
|
||||
BsModal,
|
||||
FormInput,
|
||||
StatusModal
|
||||
StatusModal,
|
||||
StatusDropdown
|
||||
},
|
||||
inject: {
|
||||
defaultSemester: {
|
||||
@@ -79,101 +81,6 @@ export default{
|
||||
return !this.modelValue.some(item => item.uid);
|
||||
}
|
||||
return !this.modelValue.uid;
|
||||
},
|
||||
toolbarInteressent() {
|
||||
return this.listDataToolbar.filter(item => this.statiInteressent.includes(item.status_kurzbz));
|
||||
},
|
||||
toolbarStudent() {
|
||||
return this.listDataToolbar.filter(item => this.statiStudent.includes(item.status_kurzbz));
|
||||
},
|
||||
sortedGruende() {
|
||||
return this.listDataToolbar.reduce((result,current) => {
|
||||
if (!result[current.status_kurzbz])
|
||||
result[current.status_kurzbz] = [];
|
||||
result[current.status_kurzbz].push(current);
|
||||
return result;
|
||||
}, {});
|
||||
},
|
||||
resultInteressentArray() {
|
||||
const result = [];
|
||||
this.statiInteressent.forEach(status => {
|
||||
const defaultObject = {
|
||||
status_kurzbz: status,
|
||||
statusgrund_id: null,
|
||||
link: `changeStatusTo${status}`,
|
||||
children: []
|
||||
};
|
||||
|
||||
if (status === "Student") {
|
||||
defaultObject.link = 'changeInteressentToStudent';
|
||||
|
||||
}
|
||||
result.push(defaultObject);
|
||||
if(this.sortedGruende[status]) {
|
||||
this.sortedGruende[status].forEach(item => {
|
||||
const itemObject = {
|
||||
status_kurzbz: item.status_kurzbz,
|
||||
statusgrund_id: item.statusgrund_id,
|
||||
beschreibung: item.beschreibung,
|
||||
link: `changeStatusTo${item.status_kurzbz}(${item.statusgrund_id})`,
|
||||
};
|
||||
|
||||
if (item.status_kurzbz === "Student") {
|
||||
itemObject.link = `changeInteressentTo${item.status_kurzbz}(${item.statusgrund_id})`;
|
||||
}
|
||||
defaultObject.children.push(itemObject);
|
||||
});
|
||||
//push one item object if student is in the array
|
||||
const hasStudentChild = defaultObject.children.some(child => child.status_kurzbz === "Student");
|
||||
|
||||
if (hasStudentChild) {
|
||||
defaultObject.children.push({
|
||||
status_kurzbz: 'Student',
|
||||
statusgrund_id: null,
|
||||
beschreibung: 'Student',
|
||||
link: 'changeInteressentToStudent'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return result;
|
||||
},
|
||||
resultStudentArray() {
|
||||
const result = [];
|
||||
this.statiStudent.forEach(status => {
|
||||
const defaultObject = {
|
||||
status_kurzbz: status,
|
||||
statusgrund_id: null,
|
||||
link: `changeStatusTo${status}`,
|
||||
dropEntry: null,
|
||||
children: []
|
||||
};
|
||||
result.push(defaultObject);
|
||||
if(this.sortedGruende[status]) {
|
||||
this.sortedGruende[status].forEach(item => {
|
||||
const itemObject = {
|
||||
status_kurzbz: item.status_kurzbz,
|
||||
statusgrund_id: item.statusgrund_id,
|
||||
beschreibung: item.beschreibung,
|
||||
link: `changeStatusTo${item.status_kurzbz}(${item.statusgrund_id})`,
|
||||
dropEntry: `[${item.beschreibung}]`,
|
||||
};
|
||||
defaultObject.children.push(itemObject);
|
||||
});
|
||||
}
|
||||
//push one item object if student is in the array
|
||||
const hasStudentChild = defaultObject.children.some(child => child.status_kurzbz === "Student");
|
||||
|
||||
if (hasStudentChild) {
|
||||
defaultObject.children.push({
|
||||
status_kurzbz: 'Student',
|
||||
statusgrund_id: null,
|
||||
beschreibung: 'Student',
|
||||
link: 'changeStatusToStudent'
|
||||
});
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
},
|
||||
props: {
|
||||
@@ -335,20 +242,12 @@ export default{
|
||||
statusId: {},
|
||||
dataMeldestichtag: null,
|
||||
isLastStatus: {},
|
||||
actionButton: {},
|
||||
actionStatusText: {},
|
||||
actionSem: null,
|
||||
newArray: {},
|
||||
//newArray: {},
|
||||
abbruchData: {},
|
||||
newStatus: '',
|
||||
statusNew: true,
|
||||
isErsterStudent: false,
|
||||
isBewerber: true,
|
||||
listDataToolbar: [],
|
||||
//TODO(Manu) get from config
|
||||
statiInteressent: ["Bewerber", "Aufgenommener", "Student" , "Wartender", "Abgewiesener"],
|
||||
statiStudent: ["Abbrecher", "Unterbrecher", "Student" , "Diplomand", "Absolvent"],
|
||||
selectedStatus: 'default'
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -424,321 +323,6 @@ export default{
|
||||
.then(this.reload)
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
actionConfirmDialogue(data, statusgrund, statusText){
|
||||
this.actionButton = statusgrund;
|
||||
this.actionStatusText = statusText;
|
||||
this.$refs.confirmStatusAction.show();
|
||||
},
|
||||
changeStatusToAbbrecher(statusgrund_id){
|
||||
this.resetChangeModals();
|
||||
let def_date = this.getDefaultDate();
|
||||
let abbruchData =
|
||||
{
|
||||
status_kurzbz: 'Abbrecher',
|
||||
datum: def_date,
|
||||
bestaetigtam: def_date,
|
||||
statusgrund_id: statusgrund_id
|
||||
};
|
||||
this.newArray = this.updateData.map(objekt => ({ ...objekt, ...abbruchData }));
|
||||
|
||||
this.actionConfirmDialogue(this.updateData, 'studenten','Abbrecher');
|
||||
//this.changeStatus(prestudentIds);
|
||||
},
|
||||
changeStatusToUnterbrecher(){
|
||||
this.resetChangeModals();
|
||||
let def_date = this.getDefaultDate();
|
||||
let deltaData =
|
||||
{
|
||||
status_kurzbz: 'Unterbrecher',
|
||||
datum: def_date,
|
||||
bestaetigtam: def_date
|
||||
};
|
||||
|
||||
this.newArray = this.updateData.map(objekt => ({ ...objekt, ...deltaData }));
|
||||
this.actionConfirmDialogue(this.updateData, 'studenten','Unterbrecher');
|
||||
},
|
||||
changeStatusToStudent(statusgrund_id){
|
||||
this.resetChangeModals();
|
||||
console.log("in function changeStatusToStudent: ", statusgrund_id);
|
||||
let def_date = this.getDefaultDate();
|
||||
//TODO Manu validation if Bewerber already before asking for ausbildungssemester
|
||||
//this.checkIfBewerber();
|
||||
|
||||
this.actionButton = 'student';
|
||||
|
||||
if(statusgrund_id == 19){
|
||||
this.actionStatusText = 'Pre-Abbrecher';
|
||||
}
|
||||
if(statusgrund_id == 15){
|
||||
this.actionStatusText = 'Pre-Wiederholer';
|
||||
}
|
||||
if(statusgrund_id == 16){
|
||||
this.actionStatusText = 'Wiederholer';
|
||||
}
|
||||
if(!statusgrund_id){
|
||||
this.actionStatusText = 'Student';
|
||||
}
|
||||
let deltaData =
|
||||
{
|
||||
status_kurzbz: 'Student',
|
||||
datum: def_date,
|
||||
bestaetigtam: def_date,
|
||||
statusgrund_id: statusgrund_id
|
||||
};
|
||||
this.newArray = this.updateData.map(objekt => ({ ...objekt, ...deltaData}));
|
||||
|
||||
if(statusgrund_id == 16 || !statusgrund_id){
|
||||
this.$refs.askForAusbildungssemester.show();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.actionConfirmDialogue(this.updateData, this.actionButton, this.actionStatusText);
|
||||
}
|
||||
},
|
||||
changeStatusToDiplomand(){
|
||||
let def_date = this.getDefaultDate();
|
||||
let deltaData =
|
||||
{
|
||||
status_kurzbz: 'Diplomand',
|
||||
datum: def_date,
|
||||
bestaetigtam: def_date,
|
||||
};
|
||||
|
||||
this.newArray = this.updateData.map(objekt => ({ ...objekt, ...deltaData}));
|
||||
this.changeStatus(this.prestudentIds);
|
||||
},
|
||||
changeStatusToAbsolvent(){
|
||||
let def_date = this.getDefaultDate();
|
||||
let deltaData =
|
||||
{
|
||||
status_kurzbz: 'Absolvent',
|
||||
datum: def_date,
|
||||
bestaetigtam: def_date,
|
||||
};
|
||||
|
||||
this.newArray = this.updateData.map(objekt => ({ ...objekt, ...deltaData}));
|
||||
this.changeStatus(this.prestudentIds);
|
||||
},
|
||||
saveNewAusbildungssemester(){
|
||||
this.newArray = this.newArray.map(objekt => ({ ...objekt, ausbildungssemester: this.actionSem}));
|
||||
this.changeStatus(this.prestudentIds);
|
||||
},
|
||||
changeStatusToBewerber(){
|
||||
this.resetChangeModals();
|
||||
let def_date = this.getDefaultDate();
|
||||
let deltaData =
|
||||
{
|
||||
status_kurzbz: 'Bewerber',
|
||||
datum: def_date,
|
||||
bestaetigtam: def_date,
|
||||
ausbildungssemester: 1
|
||||
};
|
||||
|
||||
this.newArray = this.updateData.map(objekt => ({
|
||||
...objekt,
|
||||
...deltaData}));
|
||||
this.changeStatus(this.prestudentIds);
|
||||
},
|
||||
changeStatusToAufgenommener(){
|
||||
this.resetChangeModals();
|
||||
let def_date = this.getDefaultDate();
|
||||
let deltaData =
|
||||
{
|
||||
status_kurzbz: 'Aufgenommener',
|
||||
datum: def_date,
|
||||
bestaetigtam: def_date
|
||||
};
|
||||
|
||||
this.newArray = this.updateData.map(objekt => ({
|
||||
...objekt,
|
||||
...deltaData,
|
||||
}));
|
||||
|
||||
this.actionConfirmDialogue(this.updateData, 'aufgenommener','Aufgenommenen');
|
||||
|
||||
},
|
||||
changeInteressentToStudent(statusgrund_id){
|
||||
this.resetChangeModals();
|
||||
//TODO(Manu) test statusgrund_id
|
||||
console.log("in function changeInteressentToStudent mit statusgrund_id", statusgrund_id);
|
||||
let def_date = this.getDefaultDate();
|
||||
let deltaData =
|
||||
{
|
||||
status_kurzbz: 'Student',
|
||||
datum: def_date,
|
||||
bestaetigtam: def_date,
|
||||
statusgrund_id: statusgrund_id
|
||||
};
|
||||
|
||||
this.newArray = this.updateData.map(objekt => ({
|
||||
...objekt,
|
||||
...deltaData,
|
||||
}));
|
||||
|
||||
this.addStudent(this.prestudentIds);
|
||||
|
||||
},
|
||||
changeStatusToAbgewiesener(statusgrund_id){
|
||||
this.resetChangeModals();
|
||||
let def_date = this.getDefaultDate();
|
||||
let deltaData =
|
||||
{
|
||||
status_kurzbz: 'Abgewiesener',
|
||||
datum: def_date,
|
||||
bestaetigtam: def_date,
|
||||
statusgrund_id: statusgrund_id
|
||||
};
|
||||
|
||||
this.newArray = this.updateData.map(objekt => ({
|
||||
...objekt,
|
||||
...deltaData,
|
||||
}));
|
||||
|
||||
this.actionConfirmDialogue(this.updateData, 'abgewiesener','Abgewiesenen');
|
||||
},
|
||||
changeStatusToWartender(){
|
||||
this.resetChangeModals();
|
||||
let def_date = this.getDefaultDate();
|
||||
let deltaData =
|
||||
{
|
||||
status_kurzbz: 'Wartender',
|
||||
datum: def_date,
|
||||
bestaetigtam: def_date
|
||||
};
|
||||
this.newArray = this.updateData.map(objekt => ({
|
||||
...objekt,
|
||||
...deltaData,
|
||||
}));
|
||||
|
||||
this.actionConfirmDialogue(this.updateData, 'wartender','Wartenden');
|
||||
},
|
||||
addStudent(prestudentIds){
|
||||
//this.hideModal('confirmStatusAction');
|
||||
let changeData = {};
|
||||
|
||||
//for Feedback Sucess, Error
|
||||
let countSuccess = 0;
|
||||
let countError = 0;
|
||||
|
||||
if(!prestudentIds)
|
||||
prestudentIds = [this.modelValue.prestudent_id];
|
||||
|
||||
const promises = prestudentIds.map(prestudentId => {
|
||||
|
||||
changeData = this.statusData.status_kurzbz ? this.statusData : this.newArray.find(item => item.prestudent_id === prestudentId);
|
||||
|
||||
return this.$fhcApi.post('api/frontend/v1/stv/status/addStudent/' + prestudentId,
|
||||
changeData
|
||||
).then(response => {
|
||||
countSuccess++;
|
||||
return response;
|
||||
})
|
||||
//.catch(this.$fhcAlert.handleSystemError)
|
||||
.catch(error => {
|
||||
countError++;
|
||||
//For each Prestudent show Error in Alert
|
||||
this.$fhcAlert.handleSystemError(error);
|
||||
});
|
||||
});
|
||||
|
||||
Promise
|
||||
.allSettled(promises)
|
||||
.then(values => {
|
||||
|
||||
this.newStatus = 'Student';
|
||||
|
||||
//Feedback Success als infoalert
|
||||
if (countSuccess > 0) {
|
||||
this.$fhcAlert.alertInfo(this.$p.t('ui', 'successNewStatus', {
|
||||
'countSuccess': countSuccess,
|
||||
'status': this.newStatus,
|
||||
'countError': countError
|
||||
}));
|
||||
}
|
||||
|
||||
if (this.modelValue.prestudent_id) {
|
||||
this.reload();
|
||||
}
|
||||
else {
|
||||
this.$reloadList();
|
||||
}
|
||||
this.resetModal();
|
||||
});
|
||||
},
|
||||
changeStatus(prestudentIds){
|
||||
this.resetChangeModals();
|
||||
//Array.isArray(prestudentIds) ? this.modelValue.prestudent_id : [prestudentIds];
|
||||
let changeData = {};
|
||||
|
||||
//for Feedback Sucess, Error
|
||||
let countSuccess = 0;
|
||||
let countError = 0;
|
||||
|
||||
if(!prestudentIds)
|
||||
prestudentIds = [this.modelValue.prestudent_id];
|
||||
|
||||
// Check if ausbildungssemester is already in this.newArray
|
||||
const existingEntry = this.newArray.find(
|
||||
(entry) => entry.ausbildungssemester === this.actionSem
|
||||
);
|
||||
|
||||
// If the entry doesn't exist, add a new object with ausbildungssemester
|
||||
if (!existingEntry) {
|
||||
this.newArray.push({ ausbildungssemester: this.actionSem });
|
||||
}
|
||||
|
||||
const promises = prestudentIds.map(prestudentId => {
|
||||
//TODO(manu) besserer check
|
||||
changeData = this.statusData.status_kurzbz ? this.statusData : this.newArray.find(item => item.prestudent_id === prestudentId);
|
||||
|
||||
return this.$fhcApi.post('api/frontend/v1/stv/status/changeStatus/' + prestudentId,
|
||||
changeData
|
||||
).then(response => {
|
||||
countSuccess++;
|
||||
return response;
|
||||
})
|
||||
//.catch(this.$fhcAlert.handleSystemError)
|
||||
.catch(error => {
|
||||
countError++;
|
||||
//For each Prestudent show Error in Alert
|
||||
this.$fhcAlert.handleSystemError(error);
|
||||
});
|
||||
});
|
||||
|
||||
Promise
|
||||
.allSettled(promises)
|
||||
.then(values => {
|
||||
/* if (this.abbruchData.length < 1) {
|
||||
}
|
||||
else{*/
|
||||
if(this.newArray.length > 0) {
|
||||
this.newStatus = this.newArray[0].status_kurzbz;
|
||||
}
|
||||
else {
|
||||
this.newStatus = this.statusData.status_kurzbz;
|
||||
}
|
||||
// }
|
||||
|
||||
//Feedback Success als infoalert
|
||||
if (countSuccess > 0) {
|
||||
this.$fhcAlert.alertInfo(this.$p.t('ui', 'successNewStatus', {
|
||||
'countSuccess': countSuccess,
|
||||
'status': this.newStatus,
|
||||
'countError': countError
|
||||
}));
|
||||
}
|
||||
|
||||
//TODO(Manu) bei status Interessent, Bewerber, aufgenommener, reload nicht working
|
||||
|
||||
if (this.modelValue.prestudent_id) {
|
||||
this.reload();
|
||||
}
|
||||
else {
|
||||
this.$reloadList();
|
||||
}
|
||||
this.resetModal();
|
||||
});
|
||||
},
|
||||
advanceStatus(statusId){
|
||||
return this.$fhcApi.post('api/frontend/v1/stv/status/advanceStatus/' +
|
||||
this.statusId.prestudent_id + '/' +
|
||||
@@ -784,16 +368,16 @@ export default{
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
checkIfErsterStudent(prestudent_id){
|
||||
return this.$fhcApi
|
||||
.get('api/frontend/v1/stv/status/isErsterStudent/' + prestudent_id)
|
||||
.then(
|
||||
result => {
|
||||
this.isErsterStudent = result.data.retval == 0 ? 1 : 0;
|
||||
return result;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
// checkIfErsterStudent(prestudent_id){
|
||||
// return this.$fhcApi
|
||||
// .get('api/frontend/v1/stv/status/isErsterStudent/' + prestudent_id)
|
||||
// .then(
|
||||
// result => {
|
||||
// this.isErsterStudent = result.data.retval == 0 ? 1 : 0;
|
||||
// return result;
|
||||
// })
|
||||
// .catch(this.$fhcAlert.handleSystemError);
|
||||
// },
|
||||
/*checkIfBewerber(prestudentIds){
|
||||
|
||||
if(!prestudentIds)
|
||||
@@ -870,27 +454,7 @@ export default{
|
||||
this.actionButton = {};
|
||||
this.actionStatusText = {};
|
||||
this.actionSem = null;
|
||||
},
|
||||
resetChangeModals(){
|
||||
this.hideModal('confirmStatusAction');
|
||||
this.hideModal('askForAusbildungssemester');
|
||||
},
|
||||
getDefaultDate() {
|
||||
const today = new Date();
|
||||
return today;
|
||||
},
|
||||
executeLink(link) {
|
||||
// Split the link string to extract the function name and arguments
|
||||
const match = link.match(/(\w+)\(([^)]*)\)/);
|
||||
const functionName = match ? match[1] : link;
|
||||
const args = match ? match[2].split(',').map(arg => arg.trim()) : [];
|
||||
|
||||
if (typeof this[functionName] === 'function') {
|
||||
this[functionName](...args);
|
||||
} else {
|
||||
console.error(`Method ${functionName} not found`);
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.$fhcApi
|
||||
@@ -901,98 +465,12 @@ export default{
|
||||
this.$refs.table.tabulator.redraw(true);
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
this.$fhcApi
|
||||
.get('api/frontend/v1/stv/status/getStatusarray/')
|
||||
.then(result => result.data)
|
||||
.then(result => {
|
||||
this.listDataToolbar = result;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
template: `
|
||||
<div class="stv-list h-100 pt-3">
|
||||
|
||||
<status-modal ref="test" :meldestichtag="new Date(dataMeldestichtag)" @saved="reload"></status-modal>
|
||||
|
||||
<!--Modal: Confirm Abbruch-->
|
||||
<BsModal ref="confirmStatusAction">
|
||||
<template #title>{{$p.t('lehre', 'status_edit', modelValue)}}</template>
|
||||
<template #default>
|
||||
<div v-if="prestudentIds.length == 1">
|
||||
<p>Diese Person wirklich zum {{actionStatusText}} machen?</p>
|
||||
</div>
|
||||
<div v-else>
|
||||
<p>Diese {{prestudentIds.length}} Personen wirklich zum {{actionStatusText}} machen?</p>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<template #footer>
|
||||
<!-- <div v-if="actionButton=='abbrecherStgl'">
|
||||
<button ref="Close" type="button" class="btn btn-primary" @click="changeStatusToAbbrecher(17)">OK</button>
|
||||
</div>
|
||||
<div v-if="actionButton=='abbrecherStud'">
|
||||
<button ref="Close" type="button" class="btn btn-primary" @click="changeStatusToAbbrecher(18)">OK</button>
|
||||
</div>
|
||||
<div v-if="actionButton=='unterbrecher'">
|
||||
<button ref="Close" type="button" class="btn btn-primary" @click="changeStatusToUnterbrecher()">OK</button>
|
||||
</div>
|
||||
<div v-if="actionButton=='aufgenommener'">
|
||||
<button ref="Close" type="button" class="btn btn-primary" @click="changeStatus(prestudentIds)">OK</button>
|
||||
</div>-->
|
||||
|
||||
<!-- <div v-if="actionButton=='student'">
|
||||
<button ref="Close" type="button" class="btn btn-primary" @click="changeInteressentToStudent(prestudentIds)">OK</button>
|
||||
</div>
|
||||
<div v-if="actionButton=='wartender'">
|
||||
<button ref="Close" type="button" class="btn btn-primary" @click="changeStatus(prestudentIds)">OK</button>
|
||||
</div>
|
||||
<div v-if="actionButton=='abgewiesener'">
|
||||
<button ref="Close" type="button" class="btn btn-primary" @click="changeStatus(prestudentIds)">OK</button>
|
||||
</div>-->
|
||||
|
||||
<!--Action changeStatus-->
|
||||
<div>
|
||||
<button ref="Close" type="button" class="btn btn-primary" @click="changeStatus(prestudentIds)">OK</button>
|
||||
</div>
|
||||
</template>
|
||||
</BsModal>
|
||||
|
||||
<!--Modal: askForAusbildungssemester-->
|
||||
<BsModal ref="askForAusbildungssemester">
|
||||
<template #title>{{$p.t('lehre', 'status_edit')}}</template>
|
||||
<template #default>
|
||||
<div v-if="prestudentIds.length == 1">
|
||||
<p>
|
||||
{{$p.t('lehre', 'modal_askAusbildungssem', { status: actionStatusText })}}</p>
|
||||
</div>
|
||||
<div v-else>
|
||||
<p>
|
||||
{{$p.t('lehre', 'modal_askAusbildungssemPlural', { count: prestudentIds.length,
|
||||
status: actionStatusText
|
||||
})}}</p>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="studiensemester" class="form-label col-sm-4">{{$p.t('lehre', 'studiensemester')}}</label>
|
||||
<div class="col-sm-6">
|
||||
<form-input
|
||||
type="text"
|
||||
name="studiensemester"
|
||||
v-model="actionSem"
|
||||
maxlength="2"
|
||||
>
|
||||
</form-input>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #footer>
|
||||
<div>
|
||||
<button ref="Close" type="button" class="btn btn-primary" @click="saveNewAusbildungssemester()">OK</button>
|
||||
</div>
|
||||
</template>
|
||||
</BsModal>
|
||||
|
||||
|
||||
<core-filter-cmpt
|
||||
v-if="!this.modelValue.length"
|
||||
ref="table"
|
||||
@@ -1008,147 +486,36 @@ export default{
|
||||
|
||||
<template #actions="{updateData2}">
|
||||
<!-- SingleSelectButton-->
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false">
|
||||
{{$p.t('lehre', 'btn_statusAendern')}}
|
||||
</button>
|
||||
|
||||
<ul v-if="showToolbarInteressent" class="dropdown-menu">
|
||||
<li v-for="item in resultInteressentArray" :key="item.status_kurzbz" class="w-100">
|
||||
|
||||
<div v-if="item.children.length > 0" class="btn-group dropend w-100">
|
||||
<a
|
||||
class="dropdown-item dropdown-toggle"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-expanded="false"
|
||||
href="#"
|
||||
>
|
||||
{{ item.status_kurzbz }}
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
<li v-for="child in item.children" :key="child.statusgrund_id">
|
||||
<a class="dropdown-item" @click="executeLink(child.link)">{{ child.beschreibung }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
<a
|
||||
class="dropdown-item"
|
||||
@click="executeLink(item.link)"
|
||||
>
|
||||
{{ item.status_kurzbz }}
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!--toolbar Student-->
|
||||
<ul v-if="showToolbarStudent" class="dropdown-menu">
|
||||
<li v-for="item in resultStudentArray" :key="item.status_kurzbz" class="w-100">
|
||||
|
||||
<div v-if="item.children.length > 0" class="btn-group dropend w-100">
|
||||
<a
|
||||
class="dropdown-item dropdown-toggle"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-expanded="false"
|
||||
href="#"
|
||||
>
|
||||
{{ item.status_kurzbz }}
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
<li v-for="child in item.children" :key="child.statusgrund_id">
|
||||
<a class="dropdown-item" @click="executeLink(child.link)">{{ child.beschreibung }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
<a
|
||||
class="dropdown-item"
|
||||
@click="executeLink(item.link)"
|
||||
>
|
||||
{{ item.status_kurzbz }}
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
<status-dropdown
|
||||
ref="statusDropdown"
|
||||
:showToolbar="showToolbar"
|
||||
:showToolbarStudent="showToolbarStudent"
|
||||
:showToolbarInteressent="showToolbarInteressent"
|
||||
:prestudentIds="prestudentIds"
|
||||
:updateData="updateData"
|
||||
@reload-table="reload"
|
||||
>
|
||||
</status-dropdown>
|
||||
</template>
|
||||
|
||||
</core-filter-cmpt>
|
||||
|
||||
|
||||
<div
|
||||
v-if="this.modelValue.length"
|
||||
ref="buttonsStatusMulti"
|
||||
>
|
||||
<!--MultiSelectButton-->
|
||||
<div v-if="showToolbar" class="btn-group">
|
||||
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false">
|
||||
{{$p.t('lehre', 'btn_statusAendern')}}
|
||||
</button>
|
||||
|
||||
<ul v-if="showToolbarInteressent" class="dropdown-menu">
|
||||
<li v-for="item in resultInteressentArray" :key="item.status_kurzbz" class="w-100">
|
||||
|
||||
<div v-if="item.children.length > 0" class="btn-group dropend w-100">
|
||||
<a
|
||||
class="dropdown-item dropdown-toggle"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-expanded="false"
|
||||
href="#"
|
||||
>
|
||||
{{ item.status_kurzbz }}
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
<li v-for="child in item.children" :key="child.statusgrund_id">
|
||||
<a class="dropdown-item" @click="executeLink(child.link)">{{ child.beschreibung }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--MultiSelectButton-->
|
||||
<status-dropdown
|
||||
ref="statusDropdown"
|
||||
:showToolbar="showToolbar"
|
||||
:showToolbarStudent="showToolbarStudent"
|
||||
:showToolbarInteressent="showToolbarInteressent"
|
||||
:prestudentIds="prestudentIds"
|
||||
:updateData="updateData"
|
||||
@reload-table="reload"
|
||||
>
|
||||
</status-dropdown>
|
||||
|
||||
<div v-else>
|
||||
<a
|
||||
class="dropdown-item"
|
||||
@click="executeLink(item.link)"
|
||||
>
|
||||
{{ item.status_kurzbz }}
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!--toolbar Student-->
|
||||
<ul v-if="showToolbarStudent" class="dropdown-menu">
|
||||
<li v-for="item in resultStudentArray" :key="item.status_kurzbz" class="w-100">
|
||||
|
||||
<div v-if="item.children.length > 0" class="btn-group dropend w-100">
|
||||
<a
|
||||
class="dropdown-item dropdown-toggle"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-expanded="false"
|
||||
href="#"
|
||||
>
|
||||
{{ item.status_kurzbz }}
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
<li v-for="child in item.children" :key="child.statusgrund_id">
|
||||
<a class="dropdown-item" @click="executeLink(child.link)">{{ child.beschreibung }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
<a
|
||||
class="dropdown-item"
|
||||
@click="executeLink(item.link)"
|
||||
>
|
||||
{{ item.status_kurzbz }}
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>`
|
||||
};
|
||||
@@ -0,0 +1,725 @@
|
||||
import BsModal from "../../../../Bootstrap/Modal.js";
|
||||
import CoreForm from '../../../../Form/Form.js';
|
||||
import FormValidation from '../../../../Form/Validation.js';
|
||||
import FormInput from '../../../../Form/Input.js';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
BsModal,
|
||||
CoreForm,
|
||||
FormValidation,
|
||||
FormInput
|
||||
},
|
||||
inject: {
|
||||
$reloadList: {
|
||||
from: '$reloadList',
|
||||
required: true
|
||||
}
|
||||
},
|
||||
props: {
|
||||
showToolbar: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
},
|
||||
showToolbarStudent: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
},
|
||||
showToolbarInteressent: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
},
|
||||
prestudentIds: {
|
||||
type: Array,
|
||||
required: true,
|
||||
default: () => []
|
||||
},
|
||||
updateData: {
|
||||
type: Array,
|
||||
required: true,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
listDataToolbar: [],
|
||||
//TODO(Manu) get from config
|
||||
statiInteressent: ["Bewerber", "Aufgenommener", "Student" , "Wartender", "Abgewiesener"],
|
||||
statiStudent: ["Abbrecher", "Unterbrecher", "Student" , "Diplomand", "Absolvent"],
|
||||
selectedStatus: 'default',
|
||||
actionButton: {},
|
||||
actionStatusText: {},
|
||||
actionSem: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
toolbarInteressent() {
|
||||
return this.listDataToolbar.filter(item => this.statiInteressent.includes(item.status_kurzbz));
|
||||
},
|
||||
toolbarStudent() {
|
||||
return this.listDataToolbar.filter(item => this.statiStudent.includes(item.status_kurzbz));
|
||||
},
|
||||
sortedGruende() {
|
||||
return this.listDataToolbar.reduce((result,current) => {
|
||||
if (!result[current.status_kurzbz])
|
||||
result[current.status_kurzbz] = [];
|
||||
result[current.status_kurzbz].push(current);
|
||||
return result;
|
||||
}, {});
|
||||
},
|
||||
resultInteressentArray() {
|
||||
const result = [];
|
||||
this.statiInteressent.forEach(status => {
|
||||
const defaultObject = {
|
||||
status_kurzbz: status,
|
||||
statusgrund_id: null,
|
||||
link: `changeStatusTo${status}`,
|
||||
children: []
|
||||
};
|
||||
|
||||
if (status === "Student") {
|
||||
defaultObject.link = 'changeInteressentToStudent';
|
||||
|
||||
}
|
||||
result.push(defaultObject);
|
||||
if(this.sortedGruende[status]) {
|
||||
this.sortedGruende[status].forEach(item => {
|
||||
const itemObject = {
|
||||
status_kurzbz: item.status_kurzbz,
|
||||
statusgrund_id: item.statusgrund_id,
|
||||
beschreibung: item.beschreibung,
|
||||
link: `changeStatusTo${item.status_kurzbz}(${item.statusgrund_id})`,
|
||||
};
|
||||
|
||||
if (item.status_kurzbz === "Student") {
|
||||
itemObject.link = `changeInteressentTo${item.status_kurzbz}(${item.statusgrund_id})`;
|
||||
}
|
||||
defaultObject.children.push(itemObject);
|
||||
});
|
||||
//push one item object if student is in the array
|
||||
const hasStudentChild = defaultObject.children.some(child => child.status_kurzbz === "Student");
|
||||
|
||||
if (hasStudentChild) {
|
||||
defaultObject.children.push({
|
||||
status_kurzbz: 'Student',
|
||||
statusgrund_id: null,
|
||||
beschreibung: 'Student',
|
||||
link: 'changeInteressentToStudent'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return result;
|
||||
},
|
||||
resultStudentArray() {
|
||||
const result = [];
|
||||
this.statiStudent.forEach(status => {
|
||||
const defaultObject = {
|
||||
status_kurzbz: status,
|
||||
statusgrund_id: null,
|
||||
link: `changeStatusTo${status}`,
|
||||
dropEntry: null,
|
||||
children: []
|
||||
};
|
||||
result.push(defaultObject);
|
||||
if(this.sortedGruende[status]) {
|
||||
this.sortedGruende[status].forEach(item => {
|
||||
const itemObject = {
|
||||
status_kurzbz: item.status_kurzbz,
|
||||
statusgrund_id: item.statusgrund_id,
|
||||
beschreibung: item.beschreibung,
|
||||
link: `changeStatusTo${item.status_kurzbz}(${item.statusgrund_id})`,
|
||||
dropEntry: `[${item.beschreibung}]`,
|
||||
};
|
||||
defaultObject.children.push(itemObject);
|
||||
});
|
||||
}
|
||||
//push one item object if student is in the array
|
||||
const hasStudentChild = defaultObject.children.some(child => child.status_kurzbz === "Student");
|
||||
|
||||
if (hasStudentChild) {
|
||||
defaultObject.children.push({
|
||||
status_kurzbz: 'Student',
|
||||
statusgrund_id: null,
|
||||
beschreibung: 'Student',
|
||||
link: 'changeStatusToStudent'
|
||||
});
|
||||
}
|
||||
});
|
||||
return result;
|
||||
},
|
||||
gruende() {
|
||||
return this.listStatusgruende.filter(grund => grund.status_kurzbz == this.formData.status_kurzbz);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
executeLink(link) {
|
||||
// Split the link string to extract the function name and arguments
|
||||
const match = link.match(/(\w+)\(([^)]*)\)/);
|
||||
const functionName = match ? match[1] : link;
|
||||
const args = match ? match[2].split(',').map(arg => arg.trim()) : [];
|
||||
|
||||
if (typeof this[functionName] === 'function') {
|
||||
this[functionName](...args);
|
||||
} else {
|
||||
console.error(`Method ${functionName} not found`);
|
||||
}
|
||||
},
|
||||
actionConfirmDialogue(data, statusgrund, statusText){
|
||||
this.actionButton = statusgrund;
|
||||
this.actionStatusText = statusText;
|
||||
this.$refs.confirmStatusAction.show();
|
||||
},
|
||||
addStudent(prestudentIds){
|
||||
console.log("function addStudent ");
|
||||
//this.hideModal('confirmStatusAction');
|
||||
let changeData = {};
|
||||
|
||||
//for Feedback Sucess, Error
|
||||
let countSuccess = 0;
|
||||
let countError = 0;
|
||||
|
||||
//if(!prestudentIds)
|
||||
// prestudentIds = [this.modelValue.prestudent_id];
|
||||
|
||||
const promises = prestudentIds.map(prestudentId => {
|
||||
|
||||
changeData = this.newArray.find(item => item.prestudent_id === prestudentId);
|
||||
|
||||
//changeData = this.statusData.status_kurzbz ? this.statusData : this.newArray.find(item => item.prestudent_id === prestudentId);
|
||||
|
||||
return this.$fhcApi.post('api/frontend/v1/stv/status/addStudent/' + prestudentId,
|
||||
changeData
|
||||
).then(response => {
|
||||
countSuccess++;
|
||||
return response;
|
||||
})
|
||||
//.catch(this.$fhcAlert.handleSystemError)
|
||||
.catch(error => {
|
||||
countError++;
|
||||
//For each Prestudent show Error in Alert
|
||||
this.$fhcAlert.handleSystemError(error);
|
||||
});
|
||||
});
|
||||
|
||||
Promise
|
||||
.allSettled(promises)
|
||||
.then(values => {
|
||||
|
||||
this.newStatus = 'Student';
|
||||
|
||||
//Feedback Success als infoalert
|
||||
if (countSuccess > 0) {
|
||||
this.$fhcAlert.alertInfo(this.$p.t('ui', 'successNewStatus', {
|
||||
'countSuccess': countSuccess,
|
||||
'status': this.newStatus,
|
||||
'countError': countError
|
||||
}));
|
||||
}
|
||||
|
||||
if(this.prestudentIds.length == 1){
|
||||
this.reload();
|
||||
this.$reloadList();
|
||||
}
|
||||
else {
|
||||
this.$reloadList();
|
||||
}
|
||||
this.resetModal();
|
||||
});
|
||||
},
|
||||
changeStatusToAbbrecher(statusgrund_id){
|
||||
this.resetChangeModals();
|
||||
let def_date = this.getDefaultDate();
|
||||
let abbruchData =
|
||||
{
|
||||
status_kurzbz: 'Abbrecher',
|
||||
datum: def_date,
|
||||
bestaetigtam: def_date,
|
||||
statusgrund_id: statusgrund_id
|
||||
};
|
||||
this.newArray = this.updateData.map(objekt => ({ ...objekt, ...abbruchData }));
|
||||
|
||||
this.actionConfirmDialogue(this.updateData, 'studenten','Abbrecher');
|
||||
//this.changeStatus(prestudentIds);
|
||||
},
|
||||
changeStatusToUnterbrecher(){
|
||||
this.resetChangeModals();
|
||||
let def_date = this.getDefaultDate();
|
||||
let deltaData =
|
||||
{
|
||||
status_kurzbz: 'Unterbrecher',
|
||||
datum: def_date,
|
||||
bestaetigtam: def_date
|
||||
};
|
||||
|
||||
this.newArray = this.updateData.map(objekt => ({ ...objekt, ...deltaData }));
|
||||
this.actionConfirmDialogue(this.updateData, 'studenten','Unterbrecher');
|
||||
},
|
||||
changeStatusToStudent(statusgrund_id){
|
||||
this.resetChangeModals();
|
||||
let def_date = this.getDefaultDate();
|
||||
//TODO Manu validation if Bewerber already before asking for ausbildungssemester
|
||||
//this.checkIfBewerber();
|
||||
|
||||
this.actionButton = 'student';
|
||||
|
||||
if(statusgrund_id == 19){
|
||||
this.actionStatusText = 'Pre-Abbrecher';
|
||||
}
|
||||
if(statusgrund_id == 15){
|
||||
this.actionStatusText = 'Pre-Wiederholer';
|
||||
}
|
||||
if(statusgrund_id == 16){
|
||||
this.actionStatusText = 'Wiederholer';
|
||||
}
|
||||
if(!statusgrund_id){
|
||||
this.actionStatusText = 'Student';
|
||||
}
|
||||
let deltaData =
|
||||
{
|
||||
status_kurzbz: 'Student',
|
||||
datum: def_date,
|
||||
bestaetigtam: def_date,
|
||||
statusgrund_id: statusgrund_id
|
||||
};
|
||||
this.newArray = this.updateData.map(objekt => ({ ...objekt, ...deltaData}));
|
||||
|
||||
if(statusgrund_id == 16 || !statusgrund_id){
|
||||
this.$refs.askForAusbildungssemester.show();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.actionConfirmDialogue(this.updateData, this.actionButton, this.actionStatusText);
|
||||
}
|
||||
},
|
||||
changeStatusToDiplomand(){
|
||||
let def_date = this.getDefaultDate();
|
||||
let deltaData =
|
||||
{
|
||||
status_kurzbz: 'Diplomand',
|
||||
datum: def_date,
|
||||
bestaetigtam: def_date,
|
||||
};
|
||||
|
||||
this.newArray = this.updateData.map(objekt => ({ ...objekt, ...deltaData}));
|
||||
this.changeStatus(this.prestudentIds);
|
||||
},
|
||||
changeStatusToAbsolvent(){
|
||||
let def_date = this.getDefaultDate();
|
||||
let deltaData =
|
||||
{
|
||||
status_kurzbz: 'Absolvent',
|
||||
datum: def_date,
|
||||
bestaetigtam: def_date,
|
||||
};
|
||||
|
||||
this.newArray = this.updateData.map(objekt => ({ ...objekt, ...deltaData}));
|
||||
this.changeStatus(this.prestudentIds);
|
||||
},
|
||||
changeStatusToBewerber(){
|
||||
this.resetChangeModals();
|
||||
let def_date = this.getDefaultDate();
|
||||
let deltaData =
|
||||
{
|
||||
status_kurzbz: 'Bewerber',
|
||||
datum: def_date,
|
||||
bestaetigtam: def_date,
|
||||
ausbildungssemester: 1
|
||||
};
|
||||
|
||||
this.newArray = this.updateData.map(objekt => ({
|
||||
...objekt,
|
||||
...deltaData}));
|
||||
this.changeStatus(this.prestudentIds);
|
||||
},
|
||||
changeStatusToAufgenommener(){
|
||||
this.resetChangeModals();
|
||||
let def_date = this.getDefaultDate();
|
||||
let deltaData =
|
||||
{
|
||||
status_kurzbz: 'Aufgenommener',
|
||||
datum: def_date,
|
||||
bestaetigtam: def_date
|
||||
};
|
||||
|
||||
this.newArray = this.updateData.map(objekt => ({
|
||||
...objekt,
|
||||
...deltaData,
|
||||
}));
|
||||
|
||||
this.actionConfirmDialogue(this.updateData, 'aufgenommener','Aufgenommenen');
|
||||
|
||||
},
|
||||
changeInteressentToStudent(statusgrund_id){
|
||||
this.resetChangeModals();
|
||||
//TODO(Manu) test statusgrund_id
|
||||
console.log("in function changeInteressentToStudent mit statusgrund_id", statusgrund_id);
|
||||
let def_date = this.getDefaultDate();
|
||||
let deltaData =
|
||||
{
|
||||
status_kurzbz: 'Student',
|
||||
datum: def_date,
|
||||
bestaetigtam: def_date,
|
||||
statusgrund_id: statusgrund_id
|
||||
};
|
||||
|
||||
this.newArray = this.updateData.map(objekt => ({
|
||||
...objekt,
|
||||
...deltaData,
|
||||
}));
|
||||
|
||||
this.addStudent(this.prestudentIds);
|
||||
|
||||
},
|
||||
changeStatusToAbgewiesener(statusgrund_id){
|
||||
this.resetChangeModals();
|
||||
let def_date = this.getDefaultDate();
|
||||
let deltaData =
|
||||
{
|
||||
status_kurzbz: 'Abgewiesener',
|
||||
datum: def_date,
|
||||
bestaetigtam: def_date,
|
||||
statusgrund_id: statusgrund_id
|
||||
};
|
||||
|
||||
this.newArray = this.updateData.map(objekt => ({
|
||||
...objekt,
|
||||
...deltaData,
|
||||
}));
|
||||
|
||||
this.actionConfirmDialogue(this.updateData, 'abgewiesener','Abgewiesenen');
|
||||
},
|
||||
changeStatusToWartender(){
|
||||
this.resetChangeModals();
|
||||
let def_date = this.getDefaultDate();
|
||||
let deltaData =
|
||||
{
|
||||
status_kurzbz: 'Wartender',
|
||||
datum: def_date,
|
||||
bestaetigtam: def_date
|
||||
};
|
||||
this.newArray = this.updateData.map(objekt => ({
|
||||
...objekt,
|
||||
...deltaData,
|
||||
}));
|
||||
|
||||
this.actionConfirmDialogue(this.updateData, 'wartender','Wartenden');
|
||||
},
|
||||
changeStatus(prestudentIds){
|
||||
console.log("function changeStatus ");
|
||||
this.resetChangeModals();
|
||||
//Array.isArray(prestudentIds) ? this.modelValue.prestudent_id : [prestudentIds];
|
||||
let changeData = {};
|
||||
|
||||
//for Feedback Sucess, Error
|
||||
let countSuccess = 0;
|
||||
let countError = 0;
|
||||
|
||||
// Check if ausbildungssemester is already in this.newArray
|
||||
const existingEntry = this.newArray.find(
|
||||
(entry) => entry.ausbildungssemester === this.actionSem
|
||||
);
|
||||
|
||||
// If the entry doesn't exist, add a new object with ausbildungssemester
|
||||
if (!existingEntry) {
|
||||
this.newArray.push({ ausbildungssemester: this.actionSem });
|
||||
}
|
||||
|
||||
console.log("ausbildungssem: " + this.actionSem);
|
||||
|
||||
const promises = prestudentIds.map(prestudentId => {
|
||||
|
||||
changeData = this.newArray.find(item => item.prestudent_id === prestudentId);
|
||||
|
||||
return this.$fhcApi.post('api/frontend/v1/stv/status/changeStatus/' + prestudentId,
|
||||
changeData
|
||||
).then(response => {
|
||||
countSuccess++;
|
||||
return response;
|
||||
})
|
||||
//.catch(this.$fhcAlert.handleSystemError)
|
||||
.catch(error => {
|
||||
countError++;
|
||||
//For each Prestudent show Error in Alert
|
||||
this.$fhcAlert.handleSystemError(error);
|
||||
});
|
||||
});
|
||||
|
||||
Promise
|
||||
.allSettled(promises)
|
||||
.then(values => {
|
||||
/* if (this.abbruchData.length < 1) {
|
||||
}
|
||||
else{*/
|
||||
if(this.newArray.length > 0) {
|
||||
this.newStatus = this.newArray[0].status_kurzbz;
|
||||
}
|
||||
else {
|
||||
this.newStatus = this.statusData.status_kurzbz;
|
||||
}
|
||||
// }
|
||||
|
||||
//Feedback Success als infoalert
|
||||
if (countSuccess > 0) {
|
||||
this.$fhcAlert.alertInfo(this.$p.t('ui', 'successNewStatus', {
|
||||
'countSuccess': countSuccess,
|
||||
'status': this.newStatus,
|
||||
'countError': countError
|
||||
}));
|
||||
}
|
||||
|
||||
//TODO(Manu) bei status Interessent, Bewerber, aufgenommener, reload nicht working
|
||||
|
||||
if(this.prestudentIds.length == 1){
|
||||
this.reload();
|
||||
|
||||
//necessary to see new status in List
|
||||
this.$reloadList();
|
||||
//to change ToolbarInteressent to ToolbarStudent
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
this.$reloadList();
|
||||
}
|
||||
this.resetModal();
|
||||
});
|
||||
},
|
||||
checkIfErsterStudent(prestudent_id){
|
||||
return this.$fhcApi
|
||||
.get('api/frontend/v1/stv/status/isErsterStudent/' + prestudent_id)
|
||||
.then(
|
||||
result => {
|
||||
this.isErsterStudent = result.data.retval == 0 ? 1 : 0;
|
||||
return result;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
/*checkIfBewerber(prestudentIds){
|
||||
|
||||
if(!prestudentIds)
|
||||
prestudentIds = [this.modelValue.prestudent_id];
|
||||
|
||||
const promises = prestudentIds.map(prestudentId => {
|
||||
|
||||
return this.$fhcApi.post('api/frontend/v1/stv/status/hasStatusBewerber/' + prestudentId,
|
||||
).then(response => {
|
||||
countSuccess++;
|
||||
return response;
|
||||
})
|
||||
//.catch(this.$fhcAlert.handleSystemError)
|
||||
.catch(error => {
|
||||
countError++;
|
||||
//For each Prestudent show Error in Alert
|
||||
this.$fhcAlert.handleSystemError(error);
|
||||
});
|
||||
});
|
||||
|
||||
Promise
|
||||
.allSettled(promises)
|
||||
.then(values => {
|
||||
|
||||
//Feedback Success als infoalert
|
||||
if (countSuccess > 0) {
|
||||
this.$fhcAlert.alertInfo(this.$p.t('ui', 'successNewStatus', {
|
||||
'countSuccess': countSuccess,
|
||||
'status': this.newStatus,
|
||||
'countError': countError
|
||||
}));
|
||||
}
|
||||
|
||||
if (this.modelValue.prestudent_id) {
|
||||
this.reload();
|
||||
//TODO(manu) reload Detailtab after Abbrecher to see current status activ, verband and gruppe
|
||||
}
|
||||
else {
|
||||
this.$reloadList();
|
||||
}
|
||||
|
||||
/!*return this.$fhcApi
|
||||
.get('api/frontend/v1/stv/status/hasStatusBewerber/' + prestudent_id)
|
||||
.then(
|
||||
result => {
|
||||
this.isBewerber = result.data;
|
||||
console.log(result);
|
||||
return result;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);*!/
|
||||
//}
|
||||
},*/
|
||||
getDefaultDate() {
|
||||
const today = new Date();
|
||||
return today;
|
||||
},
|
||||
hideModal(modalRef){
|
||||
this.$refs[modalRef].hide();
|
||||
this.statusNew = true;
|
||||
},
|
||||
reload() {
|
||||
this.$emit('reload-table');
|
||||
},
|
||||
reloadList() {
|
||||
this.$emit('reload-list');
|
||||
},
|
||||
resetChangeModals(){
|
||||
this.hideModal('confirmStatusAction');
|
||||
this.hideModal('askForAusbildungssemester');
|
||||
},
|
||||
resetModal() {
|
||||
this.statusData = {};
|
||||
this.statusId = {};
|
||||
this.actionButton = {};
|
||||
this.actionStatusText = {};
|
||||
this.actionSem = null;
|
||||
},
|
||||
saveNewAusbildungssemester(){
|
||||
this.newArray = this.newArray.map(objekt => ({ ...objekt, ausbildungssemester: this.actionSem}));
|
||||
console.log("ausbildungssem" + this.actionSem);
|
||||
this.changeStatus(this.prestudentIds);
|
||||
},
|
||||
|
||||
},
|
||||
created() {
|
||||
this.$fhcApi
|
||||
.get('api/frontend/v1/stv/status/getStatusarray/')
|
||||
.then(result => result.data)
|
||||
.then(result => {
|
||||
this.listDataToolbar = result;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
//TODO(manu) check if necessary
|
||||
this.$fhcApi
|
||||
.get('api/frontend/v1/stv/status/getStatusgruende/')
|
||||
.then(result => result.data)
|
||||
.then(result => {
|
||||
this.listStatusgruende = result;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
template: `
|
||||
<div class="stv-status-dropdown">
|
||||
|
||||
<!--Modal: ConfirmStatusAction-->
|
||||
<BsModal ref="confirmStatusAction">
|
||||
<template #title>{{$p.t('lehre', 'status_edit')}}</template>
|
||||
<template #default>
|
||||
<div v-if="prestudentIds.length == 1">
|
||||
<p>Diese Person wirklich zum {{actionStatusText}} machen?</p>
|
||||
</div>
|
||||
<div v-else>
|
||||
<p>Diese {{prestudentIds.length}} Personen wirklich zum {{actionStatusText}} machen?</p>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<template #footer>
|
||||
<!--Action changeStatus-->
|
||||
<div>
|
||||
<button ref="Close" type="button" class="btn btn-primary" @click="changeStatus(prestudentIds)">OK</button>
|
||||
</div>
|
||||
</template>
|
||||
</BsModal>
|
||||
|
||||
<!--Modal: askForAusbildungssemester-->
|
||||
<BsModal ref="askForAusbildungssemester">
|
||||
<template #title>{{$p.t('lehre', 'status_edit')}}</template>
|
||||
<template #default>
|
||||
<div v-if="prestudentIds.length == 1">
|
||||
<p>
|
||||
{{$p.t('lehre', 'modal_askAusbildungssem', { status: actionStatusText })}}</p>
|
||||
</div>
|
||||
<div v-else>
|
||||
<p>
|
||||
{{$p.t('lehre', 'modal_askAusbildungssemPlural', { count: prestudentIds.length,
|
||||
status: actionStatusText
|
||||
})}}</p>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="studiensemester" class="form-label col-sm-4">{{$p.t('lehre', 'studiensemester')}}</label>
|
||||
<div class="col-sm-6">
|
||||
<form-input
|
||||
type="text"
|
||||
name="studiensemester"
|
||||
v-model="actionSem"
|
||||
maxlength="2"
|
||||
>
|
||||
</form-input>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #footer>
|
||||
<div>
|
||||
<button ref="Close" type="button" class="btn btn-primary" @click="saveNewAusbildungssemester()">OK</button>
|
||||
</div>
|
||||
</template>
|
||||
</BsModal>
|
||||
|
||||
<!-- Dropdown -->
|
||||
<div v-if="showToolbar" class="btn-group">
|
||||
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false">
|
||||
{{$p.t('lehre', 'btn_statusAendern')}}
|
||||
</button>
|
||||
|
||||
<ul v-if="showToolbarInteressent" class="dropdown-menu">
|
||||
<li v-for="item in resultInteressentArray" :key="item.status_kurzbz" class="w-100">
|
||||
|
||||
<div v-if="item.children.length > 0" class="btn-group dropend w-100">
|
||||
<a
|
||||
class="dropdown-item dropdown-toggle"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-expanded="false"
|
||||
href="#"
|
||||
>
|
||||
{{ item.status_kurzbz }}
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
<li v-for="child in item.children" :key="child.statusgrund_id">
|
||||
<a class="dropdown-item" @click="executeLink(child.link)">{{ child.beschreibung }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
<a
|
||||
class="dropdown-item"
|
||||
@click="executeLink(item.link)"
|
||||
>
|
||||
{{ item.status_kurzbz }}
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!--toolbar Student-->
|
||||
<ul v-if="showToolbarStudent" class="dropdown-menu">
|
||||
<li v-for="item in resultStudentArray" :key="item.status_kurzbz" class="w-100">
|
||||
|
||||
<div v-if="item.children.length > 0" class="btn-group dropend w-100">
|
||||
<a
|
||||
class="dropdown-item dropdown-toggle"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-expanded="false"
|
||||
href="#"
|
||||
>
|
||||
{{ item.status_kurzbz }}
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
<li v-for="child in item.children" :key="child.statusgrund_id">
|
||||
<a class="dropdown-item" @click="executeLink(child.link)">{{ child.beschreibung }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
<a
|
||||
class="dropdown-item"
|
||||
@click="executeLink(item.link)"
|
||||
>
|
||||
{{ item.status_kurzbz }}
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div> `
|
||||
};
|
||||
Reference in New Issue
Block a user