mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
Merge branch 'feature-25999/C4_cleanup_tablewidget' into feature-25999/C4_cleanup
This commit is contained in:
@@ -36,7 +36,6 @@ if (!isset($menu)) {
|
||||
logo-url="<?= base_url('/public/images/logo-300x160.png'); ?>"
|
||||
avatar-url="<?= site_url('Cis/Pub/bild/person/' . getAuthPersonId()); ?>"
|
||||
logout-url="<?= site_url('Cis/Auth/logout'); ?>"
|
||||
:selectedtypes="selectedtypes"
|
||||
:searchbaroptions="searchbaroptions"
|
||||
:searchfunction="searchfunction"
|
||||
:menu="<?= htmlspecialchars(json_encode(array_values($menu)), ENT_QUOTES, 'UTF-8') ?>"
|
||||
|
||||
+28
-21
@@ -13,12 +13,8 @@ const app = Vue.createApp({
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
selectedtypes:[
|
||||
"mitarbeiter",
|
||||
"raum",
|
||||
"organisationunit"
|
||||
],
|
||||
searchbaroptions: {
|
||||
cssclass: "",
|
||||
types: [
|
||||
"mitarbeiter",
|
||||
"raum",
|
||||
@@ -38,26 +34,41 @@ const app = Vue.createApp({
|
||||
},
|
||||
raum: {
|
||||
defaultaction: {
|
||||
type: "function",
|
||||
type: "link",
|
||||
action: function(data) {
|
||||
alert('raum defaultaction ' + JSON.stringify(data));
|
||||
const link= FHC_JS_DATA_STORAGE_OBJECT.app_root +
|
||||
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
|
||||
'/CisVue/Cms/content/' + data.content_id;
|
||||
return link;
|
||||
}
|
||||
},
|
||||
childactions: [
|
||||
{
|
||||
label: "Raumübersicht",
|
||||
icon: "fas fa-info-circle",
|
||||
type: "link",
|
||||
action: function(data) {
|
||||
return data.infolink;
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "Raumreservierung",
|
||||
label: "LV-Plan",
|
||||
icon: "fas fa-bookmark",
|
||||
type: "link",
|
||||
action: function(data) {
|
||||
return data.booklink;
|
||||
const link = FHC_JS_DATA_STORAGE_OBJECT.app_root +
|
||||
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
|
||||
'/CisVue/Cms/getRoomInformation/' + data.ort_kurzbz;
|
||||
return link;
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "Rauminformation",
|
||||
icon: "fas fa-info-circle",
|
||||
type: "link",
|
||||
renderif: function(data) {
|
||||
if(data.content_id === "N/A"){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
action: function(data) {
|
||||
const link= FHC_JS_DATA_STORAGE_OBJECT.app_root +
|
||||
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
|
||||
'/CisVue/Cms/content/' + data.content_id;
|
||||
return link;
|
||||
}
|
||||
},
|
||||
]
|
||||
@@ -79,10 +90,6 @@ const app = Vue.createApp({
|
||||
searchfunction: function(searchsettings) {
|
||||
return Vue.$fhcapi.Search.search(searchsettings);
|
||||
},
|
||||
updatesearchtypes: function(newValues){
|
||||
this.selectedtypes= newValues;
|
||||
|
||||
},
|
||||
}
|
||||
});
|
||||
app.use(FhcApi);
|
||||
|
||||
@@ -123,7 +123,7 @@ export default {
|
||||
<button id="nav-main-btn" class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#nav-main" aria-controls="nav-main" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<fhc-searchbar @showSettings="toggleCollapsibles" ref="searchbar" id="nav-search" class="fhc-searchbar w-100" :searchoptions="searchbaroptions" :searchfunction="searchfunction" :selectedtypes="selectedtypes"></fhc-searchbar>
|
||||
<fhc-searchbar @showSettings="toggleCollapsibles" ref="searchbar" id="nav-search" class="fhc-searchbar w-100" :searchoptions="searchbaroptions" :searchfunction="searchfunction"></fhc-searchbar>
|
||||
<a id="nav-logo" class="d-none d-lg-block" :href="rootUrl">
|
||||
<img :src="logoUrl" alt="Logo">
|
||||
</a>
|
||||
|
||||
@@ -13,10 +13,15 @@ export default {
|
||||
},
|
||||
emits: [ 'actionexecuted' ],
|
||||
template: `
|
||||
<a :class="this.cssclass" :href="this.getactionhref()"
|
||||
@click="(this.action.type === 'function') ? this.execaction() : null">
|
||||
<slot>Action</slot>
|
||||
</a>
|
||||
<template v-if="this.renderif()">
|
||||
<a :class="this.cssclass" :href="this.getactionhref()"
|
||||
@click="(this.action.type === 'function') ? this.execaction() : null">
|
||||
<slot>Action</slot>
|
||||
</a>
|
||||
</template>
|
||||
<template v-else>
|
||||
<slot>Action</slot>
|
||||
</template>
|
||||
`,
|
||||
methods: {
|
||||
getactionhref: function() {
|
||||
@@ -26,6 +31,13 @@ export default {
|
||||
execaction: function() {
|
||||
this.action.action(this.res);
|
||||
this.$emit('actionexecuted');
|
||||
}
|
||||
},
|
||||
renderif: function() {
|
||||
if(this.action?.renderif === undefined) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.action.renderif(this.res);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -8,12 +8,14 @@ export default {
|
||||
emits: [ 'actionexecuted' ],
|
||||
template: `
|
||||
<ul class="searchbar_actions" v-if="this.actions.length > 0">
|
||||
<li v-for="(action, index) in this.actions" :key="action.label">
|
||||
<template v-for="(action, index) in this.actions" :key="action.label">
|
||||
<li v-if="this.renderif(action)">
|
||||
<action :res="this.res" :action="action" :cssclass="'btn btn-primary btn-sm'" @actionexecuted="$emit('actionexecuted')">
|
||||
<i v-if="this.hasicon(index)" :class="this.geticonclass(index)"></i>
|
||||
<span class="p-2">{{ action.label }}</span>
|
||||
</action>
|
||||
</li>
|
||||
</template>
|
||||
</ul>
|
||||
<div class="mb-3" v-else=""></div>
|
||||
`,
|
||||
@@ -23,6 +25,13 @@ export default {
|
||||
},
|
||||
geticonclass: function(index) {
|
||||
return this.actions[index].icon;
|
||||
}
|
||||
},
|
||||
renderif: function(action) {
|
||||
if(action?.renderif === undefined) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return action.renderif(this.res);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -7,15 +7,6 @@ export default {
|
||||
action: action,
|
||||
actions: actions
|
||||
},
|
||||
created(){
|
||||
//! this should be the default action for a raum
|
||||
this.actions.defaultaction = {
|
||||
type: "link",
|
||||
action: function(data) {
|
||||
return FHC_JS_DATA_STORAGE_OBJECT.app_root+'cms/content.php?content_id='+data.content_id;
|
||||
}
|
||||
};
|
||||
},
|
||||
emits: [ 'actionexecuted' ],
|
||||
template: /*html*/`
|
||||
<div class="searchbar_result searchbar_raum">
|
||||
|
||||
@@ -6,7 +6,7 @@ import student from "./student.js";
|
||||
import prestudent from "./prestudent.js";
|
||||
|
||||
export default {
|
||||
props: [ "searchoptions", "searchfunction","selectedtypes" ],
|
||||
props: [ "searchoptions", "searchfunction" ],
|
||||
emits: ['showSettings'],
|
||||
data: function() {
|
||||
return {
|
||||
@@ -33,7 +33,7 @@ export default {
|
||||
prestudent: prestudent
|
||||
},
|
||||
template: /*html*/`
|
||||
<form ref="searchform" class="d-flex me-3" action="javascript:void(0);"
|
||||
<form ref="searchform" class="d-flex me-3" :class="searchoptions.cssclass" action="javascript:void(0);"
|
||||
@focusin="this.searchfocusin" @focusout="this.searchfocusout">
|
||||
|
||||
<div class="h-100 input-group me-2 bg-white">
|
||||
@@ -55,9 +55,9 @@ export default {
|
||||
<person v-if="res.type === 'person'" :res="res" :actions="this.searchoptions.actions.person" @actionexecuted="this.hideresult"></person>
|
||||
<student v-else-if="res.type === 'student'" :res="res" :actions="this.searchoptions.actions.student" @actionexecuted="this.hideresult"></student>
|
||||
<prestudent v-else-if="res.type === 'prestudent'" :res="res" :actions="this.searchoptions.actions.prestudent" @actionexecuted="this.hideresult"></prestudent>
|
||||
<employee v-else-if="res.type === 'mitarbeiter'" :res="res" :actions="this.searchoptions.actions.employee" @actionexecuted="this.hideresult"></employee>
|
||||
<employee v-else-if="res.type === 'mitarbeiter' || res.type === 'mitarbeiter_ohne_zuordnung'" :res="res" :actions="this.searchoptions.actions.employee" @actionexecuted="this.hideresult"></employee>
|
||||
<organisationunit v-else-if="res.type === 'organisationunit'" :res="res" :actions="this.searchoptions.actions.organisationunit" @actionexecuted="this.hideresult"></organisationunit>
|
||||
<raum v-else-if="res.type === 'raum'" :res="res" :actions="getActionsForRoom(res)" @actionexecuted="this.hideresult"></raum>
|
||||
<raum v-else-if="res.type === 'raum'" :res="res" :actions="this.searchoptions.actions.raum" @actionexecuted="this.hideresult"></raum>
|
||||
<div v-else="">Unbekannter Ergebnistyp: '{{ res.type }}'.</div>
|
||||
</template>
|
||||
</div>
|
||||
@@ -78,7 +78,7 @@ export default {
|
||||
</form>
|
||||
`,
|
||||
watch:{
|
||||
'searchsettings.types'(newValue){
|
||||
'searchsettings.types': function (newValue){
|
||||
this.search();
|
||||
},
|
||||
},
|
||||
@@ -92,36 +92,10 @@ export default {
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
getActionsForRoom: function(res){
|
||||
res.booklink= FHC_JS_DATA_STORAGE_OBJECT.app_root +
|
||||
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
|
||||
`/CisVue/Cms/getRoomInformation/${res.ort_kurzbz}`;
|
||||
|
||||
if(res.content_id !=="N/A"){
|
||||
res.infolink= FHC_JS_DATA_STORAGE_OBJECT.app_root +
|
||||
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
|
||||
`/CisVue/Cms/content/${res.content_id}`;
|
||||
}
|
||||
|
||||
let child = this.searchoptions.actions.raum.childactions.filter((child)=>{
|
||||
if(child.label =="Rauminformation" && res.content_id =="N/A"){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
let computedActions = {
|
||||
childactions:child,
|
||||
defaultaction:this.searchoptions.actions.raum.defaultaction
|
||||
}
|
||||
return computedActions;
|
||||
|
||||
|
||||
},
|
||||
updateSearchOptions: function() {
|
||||
this.searchsettings.types = [];
|
||||
for( const idx in this.selectedtypes ) {
|
||||
this.searchsettings.types.push(this.selectedtypes[idx]);
|
||||
for( const idx in this.searchoptions.types ) {
|
||||
this.searchsettings.types.push(this.searchoptions.types[idx]);
|
||||
}
|
||||
},
|
||||
calcSearchResultExtent: function() {
|
||||
@@ -135,7 +109,7 @@ export default {
|
||||
if( this.searchtimer !== null ) {
|
||||
clearTimeout(this.searchtimer);
|
||||
}
|
||||
if( this.searchsettings.searchstr.length >= 3 ) {
|
||||
if( this.searchsettings.searchstr.length >= 2 ) {
|
||||
this.calcSearchResultExtent();
|
||||
this.searchtimer = setTimeout(
|
||||
this.callsearchapi,
|
||||
@@ -145,11 +119,16 @@ export default {
|
||||
this.showresult = false;
|
||||
}
|
||||
},
|
||||
callsearchapi: function() {
|
||||
callsearchapi: function() {
|
||||
this.error = null;
|
||||
this.searchresult.splice(0,this.searchresult.length);
|
||||
this.searchresult.splice(0, this.searchresult.length);
|
||||
this.searching = true;
|
||||
this.showsearchresult();
|
||||
this.showsearchresult();
|
||||
if(this.searchsettings.types.length === 0) {
|
||||
this.error = 'Kein Ergebnistyp ausgewählt. Bitte mindestens einen Ergebnistyp auswählen.';
|
||||
this.searching = false;
|
||||
return;
|
||||
}
|
||||
this.searchfunction(this.searchsettings)
|
||||
.then(response=>{
|
||||
if( response.data?.error === 1 ) {
|
||||
@@ -177,7 +156,7 @@ export default {
|
||||
window.removeEventListener('resize', this.calcSearchResultExtent);
|
||||
},
|
||||
showsearchresult: function() {
|
||||
if( this.searchsettings.searchstr.length >= 3 ) {
|
||||
if( this.searchsettings.searchstr.length >= 2 ) {
|
||||
this.showresult = true;
|
||||
window.addEventListener('resize', this.calcSearchResultExtent);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user