- neue funktion loadZeitsperrenforUid

– route für maUid
- Zeitsperren als Cis-App
– link für Zeitsperren maUid in Mitarbeiterprofil
- component ZeitsperrenMitarbeiterUid
- Dropdown oes:show only active Oes
This commit is contained in:
ma0068
2026-08-04 08:00:40 +02:00
parent 1afc4c9a29
commit 0a46bf52dd
12 changed files with 280 additions and 83 deletions
+3
View File
@@ -68,6 +68,9 @@ $route['Cis/OtherLvPlan/.*'] = 'Cis/OtherLvPlan/index/$1';
//Route for LV Plan Stg/Semester/Verband/Gruppe
$route['Cis/StgOrgLvPlan/.*'] = 'Cis/StgOrgLvPlan/index/$1';
//Route for Zeitsperren
$route['Cis/Zeitsperren/.*'] = 'Cis/Zeitsperren/index/$1';
$route['Abgabetool/Assistenz'] = 'Cis/Abgabetool/Assistenz';
$route['Abgabetool/Assistenz/(:any)'] = 'Cis/Abgabetool/Assistenz/$1';
$route['Abgabetool/Mitarbeiter'] = 'Cis/Abgabetool/Mitarbeiter';
@@ -0,0 +1,31 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
*
*/
class Zeitsperren extends Auth_Controller
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct([
'index' => ['basis/cis:r']
]);
}
// -----------------------------------------------------------------------------------------------------------------
// Public methods
/**
* @return void
*/
public function index()
{
$this->load->view('CisRouterView/CisRouterView.php', ['route' => 'Zeitsperren']);
}
}
@@ -14,6 +14,8 @@ class MaZeitsperren extends FHCAPI_Controller
'getZeitsperrenAss' => self::PERM_LOGGED,
'getStgLectors' => self::PERM_LOGGED,
'loadZeitsperrenLectorStg' => self::PERM_LOGGED,
'loadZeitsperrenMa' => self::PERM_LOGGED,
'getDetailsMa' => self::PERM_LOGGED,
]);
// Load Libraries
@@ -121,5 +123,24 @@ class MaZeitsperren extends FHCAPI_Controller
$this->terminateWithSuccess($data);
}
public function loadZeitsperrenMa($days, $uid)
{
$result = $this->ZeitsperreModel->getZeitsperrenForNextDays($days, $uid);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
public function getDetailsMa($uid)
{
$this->load->model('ressource/Person_model', 'PersonModel');
$result = $this->PersonModel->getFullName($uid);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
}
@@ -67,12 +67,16 @@ class Zeitsperre_model extends DB_Model
* @ days: count of the intervall of the next days
* @return array
*/
public function getZeitsperrenForNextDays($days)
public function getZeitsperrenForNextDays($days, $uid=null)
{
$von = date('Y-m-d');
$bis = date('Y-m-d', strtotime("+{$days} days"));
$paramsArray = [$von, $bis, $bis, $von];
if($uid)
$paramsArray[] = $uid;
$qry = "select
nachname,
vorname,
@@ -91,7 +95,12 @@ class Zeitsperre_model extends DB_Model
((? <= bisdatum
and ? >= bisdatum)
or (?>= vondatum
and ? <= vondatum))
and ? <= vondatum))";
if($uid)
$qry .= " and uid = ? ";
$qry .= "
order by nachname
";
@@ -23,7 +23,8 @@ $includesArray = array(
'public/css/components/FormUnderline.css',
'public/css/components/abgabetool/abgabe.css',
'public/css/Cis4/Cms.css',
'public/css/Cis4/Studium.css'
'public/css/Cis4/Studium.css',
'public/css/components/Zeitsperren.css',
),
'customJSs' => array(
'vendor/npm-asset/primevue/accordion/accordion.min.js',
+12
View File
@@ -63,4 +63,16 @@ export default {
url:'api/frontend/v1/MaZeitsperren/loadZeitsperrenLectorStg/' + days + '/' + stg,
};
},
loadZeitsperrenMa(days, uid) {
return {
method: 'get',
url:'api/frontend/v1/MaZeitsperren/loadZeitsperrenMa/' + days + '/' + uid,
};
},
getDetailsMa(uid){
return {
method: 'get',
url:'api/frontend/v1/MaZeitsperren/getDetailsMa/' + uid,
};
}
}
+11 -6
View File
@@ -232,6 +232,17 @@ const router = VueRouter.createRouter({
component: FhcDashboard,
props: {dashboard: 'CIS'},
},
{
path: `/Cis/Zeitsperren/:type?/:maUid?/:days?`,
name: 'ZeitsperrenMa',
component: ZeitsperrenMa,
props: route => {
//console.log('ROUTE PARAMS', route.params);
return {
propsViewData: route.params
};
}
},
{
path: '/:pathMatch(.*)*',
name: 'Fallback',
@@ -246,12 +257,6 @@ const router = VueRouter.createRouter({
};
},
},
{
path: `/Cis/ZeitsperrenMa`,
name: 'ZeitsperrenMa',
component: ZeitsperrenMa,
props: true
},
]
})
@@ -4,6 +4,7 @@ import RoleInformation from "./ProfilComponents/RoleInformation.js";
import ProfilEmails from "./ProfilComponents/ProfilEmails.js";
import ProfilInformation from "./ProfilComponents/ProfilInformation.js";
import QuickLinks from "./ProfilComponents/QuickLinks.js";
import ZeitsperrenUid from "../../Cis/ZeitsperrenMitarbeiter/Details/ZeitsperrenMitarbeiteruid.js";
import { dateFilter } from "../../../tabulator/filters/Dates.js";
@@ -15,6 +16,7 @@ export default {
ProfilEmails,
ProfilInformation,
QuickLinks,
ZeitsperrenUid
},
inject: ["collapseFunction", "language"],
data() {
@@ -210,8 +212,10 @@ export default {
}
return quickLinks;
},
stringTimelocks(){
return `${this.$p.t("zeitsperren", "zeitsperrenVon")} ` + this.data.vorname + " " + this.data.nachname;
}
},
template: /*html*/ `
<div class="container-fluid text-break fhc-form" >
@@ -279,6 +283,16 @@ export default {
<quick-links :title="$p.t('profil/quickLinks')" :links="quickLinks" />
</div>
</div>
<!-- LINKS MITARBEITER -->
<div class="card mb-2">
<div class= "card-body">
<zeitsperren-uid
:maUid="data.username"
:days="14"
:title="stringTimelocks"
></zeitsperren-uid>
</div>
</div>
<!-- MAILVERTEILER -->
<div class="row">
<div class="col">
@@ -0,0 +1,34 @@
export default {
name: "timelocksMitarbeiteruid",
props: {
maUid: {
type: String
},
days: {
type: Number
},
title: {
type: String
}
},
methods: {
link(maUid, days){
this.$router.push({
name: 'ZeitsperrenMa',
params: {
type: 'ma',
maUid: maUid,
days: days
}
});
}
},
template: `
<div>
<a href="#" @click.prevent="link(maUid, days)">
{{title}}
</a>
</div>
`,
}
@@ -23,9 +23,16 @@ export default {
'lector',
'oe',
'ass',
'lecStg'
'lecStg',
'ma'
].includes(value)
}
},
tage: {
type: String
},
maUid: {
type: String
}
},
data(){
@@ -41,7 +48,8 @@ export default {
filteredStg: [],
selectedStg: null,
studiengang_kz: null,
showTable: true
showTable: true,
fullName: null
}
},
methods: {
@@ -87,9 +95,15 @@ export default {
this.arrayMaTimelocks = result.data;
})
},
createDays() {
loadZeitsperrenMa(days, uid){
this.$api
.call(ApiMaTimelocks.loadZeitsperrenMa(days, uid))
.then(result => {
this.arrayMaTimelocks = result.data;
})
},
createDays(countDays) {
const today = new Date();
//get Monday before today
const mondayBeforeToday = new Date(today);
const day = today.getDay();
@@ -97,7 +111,7 @@ export default {
mondayBeforeToday.setDate(today.getDate() - diff);
this.days = Array.from({ length: this.interval+1 }, (_, i) => {
this.days = Array.from({ length: countDays + 1 }, (_, i) => {
const date = new Date(mondayBeforeToday);
date.setDate(mondayBeforeToday.getDate() + i);
@@ -112,44 +126,49 @@ export default {
});
},
createArrayMa(type){
this.showTable = true;
if(type == "fix") {
this.loadZeitsperrenFixeMa(this.interval);
}
else if(type == "lector") {
this.loadZeitsperrenLector(this.interval);
}
else if(type == "oe") {
this.showTable = false;
this.selectedOe = null;
this.$api
.call(ApiMaTimelocks.getAllOes())
.then(result => {
this.listOes = result.data;
this.showTable = true;
if(type == "fix") {
this.loadZeitsperrenFixeMa(this.interval);
}
else if(type == "lector") {
this.loadZeitsperrenLector(this.interval);
}
else if(type == "oe") {
this.showTable = false;
this.selectedOe = null;
this.$api
.call(ApiMaTimelocks.getAllOes())
.then(result => {
this.listOes = result.data.filter(item => item.aktiv);
})
.catch(this.$fhcAlert.handleSystemError);
}
else if(type == "lecStg") {
this.showTable = false;
this.selectedStg = null;
this.$api
.call(ApiMaTimelocks.getAllStg())
.then(result => {
this.listStg = result.data;
})
.catch(this.$fhcAlert.handleSystemError);
}
else if(type == "all") {
this.loadAllActiveZeitsperren(this.interval);
}
else if(type == "ass") {
this.loadZeitsperrenAss(this.interval);
}
else if(type == "ma") {
const countDays= this.tage ? this.tage : this.interval;
this.loadZeitsperrenMa(countDays, this.maUid);
this.loadDetailsMa(this.maUid);
}
else
{
this.$fhcAlert.alertError(this.$p.t('ui', 'error_fieldNotFound', {field: "Typ Zeitsperre"}));
}
})
.catch(this.$fhcAlert.handleSystemError);
}
else if(type == "lecStg") {
this.showTable = false;
this.selectedStg = null;
this.$api
.call(ApiMaTimelocks.getAllStg())
.then(result => {
this.listStg = result.data;
})
.catch(this.$fhcAlert.handleSystemError);
}
else if(type == "all") {
this.loadAllActiveZeitsperren(this.interval);
}
else if(type == "ass") {
this.loadZeitsperrenAss(this.interval);
}
else
{
this.$fhcAlert.alertError(this.$p.t('ui', 'error_fieldNotFound', {field: "Typ Zeitsperre"}));
}
},
isBlocked(mitarbeiter, tag) {
if (!mitarbeiter?.sperren) {
@@ -187,20 +206,18 @@ export default {
);
},
link(uid) {
//link to new profile
return (
FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router +
"/Cis/Profil/View/"+
uid
);
//link to old profile
/* return (
FHC_JS_DATA_STORAGE_OBJECT.app_root +
"cis/private/profile/index.php?uid=" +
uid
);*/
},
loadDetailsMa(uid){
this.$api
.call(ApiMaTimelocks.getDetailsMa(uid))
.then(result => {
this.fullName = result.data;
})
}
},
computed: {
@@ -273,11 +290,18 @@ export default {
else if(this.type == "ass") {
this.loadZeitsperrenAss(newVal);
}
else if(this.type == "lecStg") {
if(this.selectedStg )
this.loadZeitsperrenStg(newVal, this.studiengang_kz);
}
else if(this.type == "ma") {
this.loadZeitsperrenMa(newVal, this.maUid);
}
else
{
this.$fhcAlert.alertError(this.$p.t('ui', 'error_fieldNotFound', {field: "Typ Zeitsperre"}));
}
this.createDays();
this.createDays(newVal);
}
},
deep: true,
@@ -313,7 +337,10 @@ export default {
},
created(){
this.createArrayMa(this.type);
this.createDays();
if(this.tage)
this.createDays(Number(this.tage));
else
this.createDays(this.interval);
},
template: `
<div class="w-100 h-100">
@@ -324,6 +351,7 @@ export default {
<span v-if="type=='oe'">{{$p.t('zeitsperren/title_byOe')}}</span>
<span v-if="type=='lecStg'">{{$p.t('zeitsperren/title_lectStg')}}</span>
<span v-if="type=='ass'">{{$p.t('zeitsperren/title_ass')}}</span>
<span v-if="type=='ma'">{{$p.t('zeitsperren/zeitsperrenVon')}} {{fullName}}</span>
{{ mondayBeforeToday.toLocaleDateString('de-AT') }} - {{endInterval}}
</h4>
<div class="d-flex align-items-center gap-2 mb-3">
@@ -1,9 +1,14 @@
import listsZeitsperren from './Details/listsZeitsperren.js'
import listsZeitsperren from './Details/listsZeitsperren.js';
import MitarbeiterZeitsperren from './Details/ZeitsperrenMitarbeiteruid.js';
export default {
name: 'ZeitsperrenMa',
components: {
listsZeitsperren,
MitarbeiterZeitsperren
},
props: {
propsViewData: Object
},
data(){
return {
@@ -45,33 +50,47 @@ export default {
methods: {
show(view) {
this.activeView = this.activeView === view ? null : view;
}
},
},
//TODO(only show main page if there is no prop
template: `
<div class="base-zeitsperren w-100 h-100">
<div class="row g-1">
<div
class="col"
v-for="button in buttons"
:key="button.key"
>
<button
class="btn w-100"
:class="button.class"
@click="show(button.key)"
<template v-if="!propsViewData.maUid && !propsViewData.type">
<div class="row g-1">
<div
class="col"
v-for="button in buttons"
:key="button.key"
>
{{ $p.t(button.title) }}
</button>
<button
class="btn w-100"
:class="button.class"
@click="show(button.key)"
>
{{ $p.t(button.title) }}
</button>
</div>
</div>
</div>
<lists-zeitsperren
v-if="activeView"
ref="listTimeLocks"
:type="activeView"
/>
</template>
<template v-else>
<lists-zeitsperren
v-if="activeView"
ref="listTimeLocks"
:type="activeView"
/>
</div>
:type="propsViewData.type"
:maUid="propsViewData.maUid"
:tage="propsViewData.days"
/>
</template>
</div>
`,
}
+20
View File
@@ -60661,6 +60661,26 @@ I have been informed that I am under no obligation to consent to the transmissio
)
)
),
array(
'app' => 'core',
'category' => 'zeitsperren',
'phrase' => 'zeitsperrenVon',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Zeitsperren von',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Timelocks from',
'description' => '',
'insertvon' => 'system'
)
)
),
// PHRASES ZEITSPERREN END
);