rebuild tags for whole studiengang / selection

refactor backend for multiaction rebuildTags
add phrases
refactor haederFilter
This commit is contained in:
ma0068
2026-07-22 14:11:07 +02:00
parent 1ae02d8ed8
commit a8dd995195
5 changed files with 278 additions and 8 deletions
+16 -5
View File
@@ -344,16 +344,27 @@ class Tag_Controller extends FHCAPI_Controller
public function rebuildTagsForTypeId()
{
$id = $this->input->post('id');
$ids = $this->input->post('ids');
$typeId = $this->input->post('typeId');
$semester = $this->input->post('sem');
$result = $this->taglib->rebuildTagsForTypeId($typeId, $id, $semester);
$idsSuccess = [];
$idsError = [];
$outputResult = [];
if (isError($result))
return error ('Error occurred during updateAutomatedTags');
foreach ($ids as $id)
{
$result = $this->taglib->rebuildTagsForTypeId($typeId, $id, $semester);
$this->terminateWithSuccess($result);
if (isError($result))
$idsError[] = $id;
else
$idsSuccess[] = $id;
$outputResult[] = $result;
}
$this->terminateWithSuccess([$outputResult, $idsSuccess, $idsError]);
}
private function _setAuthUID()
@@ -315,8 +315,10 @@ export default {
this.reload();
},
rebuildPrestudentTags(){
const id = [this.headerData[0].prestudent_id];
const params = {
id : this.headerData[0].prestudent_id,
ids: id,
typeId: 'prestudent_id',
sem: this.currentSemester
};
@@ -4,6 +4,7 @@ import CoreTag from '../../Tag/Tag.js';
import { tagHeaderFilter } from "../../../tabulator/filters/extendedHeaderFilter.js";
import { addTagInTable, deleteTagInTable, updateTagInTable } from "../../../../js/helpers/TagHelper.js";
import { tagFormatter } from "../../../../js/tabulator/formatter/tags.js";
import ModalLoading from "./List/ModalLoading.js";
import ApiTag from "../../../api/factory/stv/tag.js";
import ListFilter from './List/Filter.js';
@@ -18,7 +19,8 @@ export default {
CoreFilterCmpt,
ListNew,
CoreTag,
ListFilter
ListFilter,
ModalLoading
},
directives: {
draggable
@@ -246,7 +248,9 @@ export default {
oldScrollUrl: '',
oldScrollLeft: 0,
oldScrollTop: 0,
allPrestudents: []
allPrestudents: [],
rebuildData: [],
isLoading: false
}
},
computed: {
@@ -646,11 +650,55 @@ export default {
this.oldScrollUrl = this.$refs.table.tabulator.getAjaxUrl();
}
},
rebuild(selected){
this.isLoading = true;
let prestudentIds = [];
this.showModal();
if(!selected.length)
prestudentIds = this.$refs.table.tabulator
.getData()
.map(row => row.prestudent_id);
else
prestudentIds = selected.map(item => item.prestudent_id);
const params = {
ids: prestudentIds,
typeId: 'prestudent_id',
sem: this.studiensemesterKurzbz
};
return this.$api
.call(ApiTag.rebuildTagsforTypeId(params))
.then(result => {
this.rebuildData = result.data;
this.isLoading = false;
console.log("Rebuild manually triggered");
if(this.rebuildData[1].length > 0)
{
this.$fhcAlert.alertSuccess(this.$p.t('tag', 'alertSuccessRebuild', { count: this.rebuildData[1].length }));
}
if(this.rebuildData[2].length > 0)
{
this.$fhcAlert.alertError(this.$p.t('tag', 'alertErrorRebuild') + this.rebuildData[2].toString());
}
})
.catch(this.$fhcAlert.handleSystemError);
},
showModal(){
this.$refs.modalLocked.open();
},
},
// TODO(chris): focusin, focusout, keydown and tabindex should be in the filter component
// TODO(chris): filter component column chooser has no accessibilty features
template: `
<div class="stv-list h-100 pt-3">
<modal-loading
ref="modalLocked"
:isLoading="isLoading"
:message="$p.t('tag','messageModalWait')"
>
</modal-loading>
<div
class="tabulator-container d-flex flex-column h-100"
:class="{'has-filter': filter.length}"
@@ -709,6 +757,23 @@ export default {
zuordnung_typ="prestudent_id"
></core-tag>
<button
v-if="!selected.length"
class="btn btn-outline btn-light mb-1"
@click="rebuild(selected)"
:title="$p.t('tag','rebuild_tags') + ' Stg ' + currentSemester"
>
<i class="fa-solid fa-refresh pe-1"></i> STG
</button>
<button
v-else
class="btn btn-outline btn-light mb-1"
@click="rebuild(selected)"
:title="$p.t('tag','rebuild_tags') + ' ' + $p.t('ui','selection') + currentSemester"
>
<i class="fa-solid fa-refresh pe-1"></i> {{selected.length}}
</button>
<template v-if="filter.length || headerFilterActive">
<div class="d-flex justify-content-center align-items-center gap-2 ps-4 position-absolute start-50 translate-middle-x">
<p class="text-danger mb-0">
@@ -0,0 +1,69 @@
import BsModal from "../../../Bootstrap/Modal.js";
import FormForm from "../../../Form/Form.js";
export default {
name: "modalLoading",
components: {
BsModal,
FormForm
},
props: {
isLoading: {
type: Boolean,
required: true
},
message: {
type: String,
required: true
}
},
data(){
return{}
},
methods:{
open(){
this.$refs.modalLoading.show();
},
closeModal(){
this.$refs.modalLoading.hide();
}
},
template: `
<bs-modal
ref="modalLoading"
noCloseBtn
backdrop='static'
:keyboard='false'
dialog-class="modal-dialog-scrollable"
>
<template #title>
Loading
</template>
<form-form
ref="formModal"
>
<div class="mt-3">
<div v-if="isLoading">
{{message}}
</div>
<div v-else>
{{$p.t('ui', 'fenster_schliessen')}}
</div>
</div>
</form-form>
<template #footer>
<div class="d-grid gap-2 d-md-flex justify-content-md-end">
<button
class="btn btn-primary"
:disabled="isLoading"
@click="closeModal()">
{{$p.t('ui', 'schliessen')}}
</button>
</div>
</template>
</bs-modal>
`,
}
+123
View File
@@ -43059,6 +43059,7 @@ array(
array(
'sprache' => 'English',
'text' => 'ATTENTION! This exam grade was not included in the certificate because the certificate grade was changed after the exam date',
/** @lang text */
'description' => '',
'insertvon' => 'system'
)
@@ -60978,6 +60979,128 @@ I have been informed that I am under no obligation to consent to the transmissio
)
)
),
//Start Finetuning StudVW
array(
'app' => 'core',
'category' => 'ui',
'phrase' => 'fenster_schliessen',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Sie können nun das Fenster schließen',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'This window can be closed now',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'tag',
'phrase' => 'rebuild_tags',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Neuberechnen Tags',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Rebuild Tags',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'ui',
'phrase' => 'selection',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Auswahl',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'selection',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'tag',
'phrase' => 'messageModalWait',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Bitte warten Sie, bis alle Tags neu berechnet wurden!',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Please wait until all tags have been recalculated!',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'tag',
'phrase' => 'alertSuccessRebuild',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Tags erfolgreich neuberechnet ({count} Prestudent*innnen)',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Tags successfully recalculated ({count} prestudents)',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'tag',
'phrase' => 'alertErrorRebuild',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Fehler bei Neuberechnen Tags, PrestudentId(s): ',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Error during Recalculating tags, PrestudentId(s): ',
'description' => '',
'insertvon' => 'system'
)
)
),
//End Finetuning StudVW
);