mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-10-12 06:54:04 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6fa75b9cb |
@@ -47,14 +47,13 @@ class Lehreinheit extends FHCAPI_Controller
|
||||
|
||||
private function getLehrfaecher($lehreinheit)
|
||||
{
|
||||
$lehrfacher_array = array($lehreinheit->lehrfach_id);
|
||||
$lehrfaecher_array = array($lehreinheit->lehrfach_id);
|
||||
$this->_ci->LehreinheitModel->addSelect('lehrveranstaltung_id_kompatibel');
|
||||
$this->_ci->LehreinheitModel->addJoin('lehre.tbl_lehrveranstaltung_kompatibel', 'lehrveranstaltung_id');
|
||||
$lehrfaecher = $this->_ci->LehreinheitModel->loadWhere(array('lehrveranstaltung_id' => $lehreinheit->lehrveranstaltung_id));
|
||||
|
||||
|
||||
if (hasData($lehrfaecher))
|
||||
$lehrfaecher_array = array_merge($lehrfacher_array, array_column(getData($lehrfaecher), 'lehrveranstaltung_id_kompatibel'));
|
||||
$lehrfaecher_array = array_merge($lehrfaecher_array, array_column(getData($lehrfaecher), 'lehrveranstaltung_id_kompatibel'));
|
||||
|
||||
$lehrfaecher_array[] = $lehreinheit->lehrveranstaltung_id;
|
||||
|
||||
|
||||
@@ -51,6 +51,9 @@ export default {
|
||||
permissionLektorEntfernen: this.permissions['lv-plan/lektorentfernen'],
|
||||
language: Vue.computed(() => this.$p.user_language),
|
||||
isMobile: false,
|
||||
$reloadList: () => {
|
||||
this.$refs.lvTable.reload();
|
||||
},
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
||||
@@ -96,6 +96,8 @@ export default {
|
||||
return {
|
||||
expanded: [],
|
||||
selectedColumnValues: [],
|
||||
selectedRows: [],
|
||||
lastSelectedData: [],
|
||||
tagEndpoint: ApiTag,
|
||||
tabulatorEvents: [
|
||||
{
|
||||
@@ -107,7 +109,7 @@ export default {
|
||||
event: 'dataProcessed',
|
||||
handler: (data) => {
|
||||
this.reexpandRows()
|
||||
this.$emit('update:selected', {})
|
||||
this.reselectRows()
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -319,10 +321,15 @@ export default {
|
||||
this.$refs.table.reloadTable();
|
||||
}
|
||||
},
|
||||
rowSelectionChanged(data) {
|
||||
rowSelectionChanged(data, rows, selected, deselected) {
|
||||
this.selectedRows = this.$refs.table.tabulator.getSelectedRows();
|
||||
this.selectedColumnValues = this.selectedRows.filter(row => row.getData().lehreinheit_id !== undefined && row.getData().lehreinheit_id).map(row => row.getData().lehreinheit_id);
|
||||
|
||||
if (selected.length > 0 || deselected.length > 0)
|
||||
{
|
||||
this.lastSelectedData = this.selectedRows.map(row => row.getData());
|
||||
}
|
||||
|
||||
if (data[0]?.lehreinheit_id !== undefined && this.selectedColumnValues.length === 1)
|
||||
{
|
||||
this.lv_info = false
|
||||
@@ -333,6 +340,39 @@ export default {
|
||||
}
|
||||
this.$emit('update:selected', data);
|
||||
},
|
||||
reselectRows()
|
||||
{
|
||||
if (!Array.isArray(this.lastSelectedData) || !this.lastSelectedData.length)
|
||||
return;
|
||||
|
||||
let rowToSelect = this.allRows.filter(row => {
|
||||
const data = row.getData();
|
||||
|
||||
return this.lastSelectedData.some(selectedRow => {
|
||||
if (selectedRow.lehreinheit_id !== undefined && selectedRow.lehreinheit_id !== null)
|
||||
{
|
||||
return data.lehreinheit_id === selectedRow.lehreinheit_id;
|
||||
}
|
||||
|
||||
if (selectedRow.lehrveranstaltung_id !== undefined && selectedRow.lehrveranstaltung_id !== null)
|
||||
{
|
||||
return data.lehrveranstaltung_id === selectedRow.lehrveranstaltung_id && (data.lehreinheit_id === undefined || data.lehreinheit_id === null);
|
||||
}
|
||||
|
||||
return false;
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
if (rowToSelect.length)
|
||||
{
|
||||
this.$refs.table.tabulator.selectRow(rowToSelect);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.lastSelectedData = [];
|
||||
}
|
||||
},
|
||||
getLVInfos(data)
|
||||
{
|
||||
this.$api.call(ApiLv.getByLV(data.lehrveranstaltung_id))
|
||||
|
||||
@@ -24,7 +24,11 @@ export default {
|
||||
inject: {
|
||||
dropdowns: {
|
||||
from: 'dropdowns'
|
||||
}
|
||||
},
|
||||
$reloadList: {
|
||||
from: '$reloadList',
|
||||
required: true
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
modelValue(newValue)
|
||||
@@ -92,6 +96,10 @@ export default {
|
||||
return this.$refs.form.call(ApiLehreinheit.update(updatedData))
|
||||
.then(result => {
|
||||
this.original = {...this.data};
|
||||
|
||||
if (this.modelValue.lehrveranstaltung_id !== this.changed.lehrveranstaltung_id && this.changed.lehrveranstaltung_id)
|
||||
this.$reloadList();
|
||||
|
||||
this.changed = {};
|
||||
this.$refs.form.setFeedback(true, result.data);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user