diff --git a/application/controllers/api/frontend/v1/stv/Status.php b/application/controllers/api/frontend/v1/stv/Status.php
index c56c8013f..11db9f73d 100644
--- a/application/controllers/api/frontend/v1/stv/Status.php
+++ b/application/controllers/api/frontend/v1/stv/Status.php
@@ -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');
diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js
index 8257c3623..585dd2977 100644
--- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js
+++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js
@@ -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: `
-
-
- {{$p.t('lehre', 'status_edit', modelValue)}}
-
-
-
Diese Person wirklich zum {{actionStatusText}} machen?
-
-
-
Diese {{prestudentIds.length}} Personen wirklich zum {{actionStatusText}} machen?
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{$p.t('lehre', 'status_edit')}}
-
-
-
- {{$p.t('lehre', 'modal_askAusbildungssem', { status: actionStatusText })}}
-
-
-
- {{$p.t('lehre', 'modal_askAusbildungssemPlural', { count: prestudentIds.length,
- status: actionStatusText
- })}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
+
-
-
-
-
-
-
-
-
-
`
};
\ No newline at end of file
diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Status/Dropdown.js b/public/js/components/Stv/Studentenverwaltung/Details/Status/Dropdown.js
new file mode 100644
index 000000000..a6d120b60
--- /dev/null
+++ b/public/js/components/Stv/Studentenverwaltung/Details/Status/Dropdown.js
@@ -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: `
+
+
+
+
+ {{$p.t('lehre', 'status_edit')}}
+
+
+
Diese Person wirklich zum {{actionStatusText}} machen?
+
+
+
Diese {{prestudentIds.length}} Personen wirklich zum {{actionStatusText}} machen?
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{$p.t('lehre', 'status_edit')}}
+
+
+
+ {{$p.t('lehre', 'modal_askAusbildungssem', { status: actionStatusText })}}
+
+
+
+ {{$p.t('lehre', 'modal_askAusbildungssemPlural', { count: prestudentIds.length,
+ status: actionStatusText
+ })}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
`
+};
\ No newline at end of file