fix current simple search with modified searchbar, let action always emit actionexecuted event on click to close search in combination with vue router

This commit is contained in:
Harald Bamberger
2025-08-04 13:42:51 +02:00
parent 648dca3eba
commit e727c03a42
3 changed files with 19 additions and 5 deletions
+7
View File
@@ -115,6 +115,7 @@ class SearchBarLib
$sql = '
SELECT
\'employee\' AS renderer,
\''.$type.'\' AS type,
b.uid AS uid,
p.person_id AS person_id,
@@ -205,6 +206,7 @@ EOSC;
$employees = $dbModel->execReadOnlyQuery('
SELECT
\'employee\' AS renderer,
\''.$type.'\' AS type,
b.uid AS uid,
p.person_id AS person_id,
@@ -268,6 +270,7 @@ EOSC;
$ous = $dbModel->execReadOnlyQuery('
SELECT
\'' . $type . '\' AS renderer,
\''.$type.'\' AS type,
o.oe_kurzbz AS oe_kurzbz,
\'[\' || ot.bezeichnung || \'] \' || o.bezeichnung AS name,
@@ -365,6 +368,7 @@ EOSC;
$gesperrtes_foto = base64_encode(file_get_contents(DOC_ROOT.'skin/images/profilbild_dummy.jpg'));
$students = $dbModel->execReadOnlyQuery('
SELECT
\'' . $type . '\' AS renderer,
\''.$type.'\' AS type,
s.student_uid AS uid,
CONCAT(s.student_uid,\'@'.DOMAIN.'\') AS email,
@@ -413,6 +417,7 @@ EOSC;
$students = $dbModel->execReadOnlyQuery('
SELECT
\'student\' AS renderer,
\''.$type.'\' AS type,
s.student_uid AS uid,
s.matrikelnr,
@@ -458,6 +463,7 @@ EOSC;
$prestudent = $dbModel->execReadOnlyQuery('
SELECT
\'' . $type . '\' AS renderer,
\''.$type.'\' AS type,
ps.prestudent_id,
ps.studiengang_kz,
@@ -517,6 +523,7 @@ EOSC;
$rooms = $dbModel->execReadOnlyQuery('
SELECT
\'room\' AS renderer,
\''.$type.'\' AS type,
COALESCE(ort.ort_kurzbz, \'N/A\') as ort_kurzbz,
COALESCE(ort.gebteil, \'N/A\') as building,
@@ -16,9 +16,8 @@ export default {
},
methods: {
actionFunc() {
if (this.action.type !== 'function')
return;
this.action.action(this.res);
if (this.action.type === 'function')
this.action.action(this.res);
this.$emit('actionexecuted');
}
},
+10 -2
View File
@@ -77,6 +77,7 @@ export default {
<form
ref="searchform"
class="d-flex me-3"
:class="searchoptions.cssclass"
action="javascript:void(0);"
@focusin="searchfocusin"
@focusout="searchfocusout"
@@ -136,7 +137,7 @@ export default {
:is="res.renderer"
:mode="searchmode"
:res="res"
:actions="searchoptions.actions[dash2camelCase(res.renderer)]"
:actions="getActions(res)"
@actionexecuted="hideresult"
></component>
<div v-else class="searchbar-result text-danger fw-bold">{{ $p.t('search/error_unknown_type', res) }}</div>
@@ -418,6 +419,13 @@ export default {
isValidRenderer(renderer) {
const camelCaseRenderer = this.dash2camelCase(renderer);
return Object.keys(this.$.components).includes(camelCaseRenderer);
}
},
getActions(res) {
let actions = this.searchoptions.actions[this.dash2camelCase(res.renderer)];
if (actions) {
return actions;
}
return this.searchoptions.actions[res.type];
}
}
};