mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-10-12 06:54:04 +00:00
add routes for types all, fix, lector, oe, stg and ass
remove component from vertragsverwaltung refactor component Zeitsperrenmitarbeiter_uid phrase view change table back from dark mode add validations for params
This commit is contained in:
@@ -78,6 +78,10 @@ class MaZeitsperren extends FHCAPI_Controller
|
||||
|
||||
public function getAllZeitsperrenOes($days, $oe)
|
||||
{
|
||||
if(!$oe)
|
||||
{
|
||||
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'OE Kurzbezeichnung']), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
$von = date('Y-m-d');
|
||||
$bis = date('Y-m-d', strtotime("+{$days} days"));
|
||||
$result = $this->ZeitsperreModel->getMitarbeiterWithZeitsperren($von, $bis, false, false, $oe, false);
|
||||
@@ -89,6 +93,15 @@ class MaZeitsperren extends FHCAPI_Controller
|
||||
|
||||
public function loadZeitsperrenLectorStg($days, $stg)
|
||||
{
|
||||
if(!$stg)
|
||||
{
|
||||
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Studiengangskennzahl']), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
if(!is_numeric($stg))
|
||||
{
|
||||
return $this->terminateWithError($this->p->t('ui', 'error_paramNoNumber', ['param'=> 'Studiengangskennzahl']), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
$von = date('Y-m-d');
|
||||
$bis = date('Y-m-d', strtotime("+{$days} days"));
|
||||
$result = $this->ZeitsperreModel->getMitarbeiterWithZeitsperren($von, $bis, false, true, false, false, $stg);
|
||||
@@ -125,6 +138,10 @@ class MaZeitsperren extends FHCAPI_Controller
|
||||
|
||||
public function loadZeitsperrenMa($days, $uid)
|
||||
{
|
||||
if ($uid === null || $uid === '')
|
||||
{
|
||||
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Mitarbeiter UID']), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
$result = $this->ZeitsperreModel->getZeitsperrenForNextDays($days, $uid);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
@@ -134,6 +151,10 @@ class MaZeitsperren extends FHCAPI_Controller
|
||||
|
||||
public function getDetailsMa($uid)
|
||||
{
|
||||
if ($uid === null || $uid === '')
|
||||
{
|
||||
$this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Mitarbeiter UID']), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
$this->load->model('ressource/Person_model', 'PersonModel');
|
||||
$result = $this->PersonModel->getFullName($uid);
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ const router = VueRouter.createRouter({
|
||||
props: {dashboard: 'CIS'},
|
||||
},
|
||||
{
|
||||
path: `/Cis/Zeitsperren/:type?/:maUid?/:days?`,
|
||||
path: '/Cis/Zeitsperren/:type(all|fix|lector|ma|oe|stg|ass)?/:id?/:days?',
|
||||
name: 'ZeitsperrenMa',
|
||||
component: ZeitsperrenMa,
|
||||
props: route => {
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ export default {
|
||||
name: 'ZeitsperrenMa',
|
||||
params: {
|
||||
type: 'ma',
|
||||
maUid: maUid,
|
||||
id: maUid,
|
||||
days: days
|
||||
}
|
||||
});
|
||||
|
||||
@@ -23,7 +23,7 @@ export default {
|
||||
'lector',
|
||||
'oe',
|
||||
'ass',
|
||||
'lecStg',
|
||||
'stg',
|
||||
'ma'
|
||||
].includes(value)
|
||||
}
|
||||
@@ -31,9 +31,9 @@ export default {
|
||||
tage: {
|
||||
type: String
|
||||
},
|
||||
maUid: {
|
||||
id: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
@@ -49,7 +49,10 @@ export default {
|
||||
selectedStg: null,
|
||||
studiengang_kz: null,
|
||||
showTable: true,
|
||||
fullName: null
|
||||
fullName: null,
|
||||
maUid: null,
|
||||
validStgs: [],
|
||||
validOes: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -75,6 +78,14 @@ export default {
|
||||
})
|
||||
},
|
||||
loadZeitsperrenOE(days, oe){
|
||||
this.$router.push({
|
||||
name: 'ZeitsperrenMa',
|
||||
params: {
|
||||
type: this.$route.params.type,
|
||||
id: oe,
|
||||
days: days
|
||||
}
|
||||
});
|
||||
this.$api
|
||||
.call(ApiMaTimelocks.loadAllZeitsperrenOE(days, oe))
|
||||
.then(result => {
|
||||
@@ -89,6 +100,14 @@ export default {
|
||||
})
|
||||
},
|
||||
loadZeitsperrenStg(days, stg){
|
||||
this.$router.push({
|
||||
name: 'ZeitsperrenMa',
|
||||
params: {
|
||||
type: this.$route.params.type,
|
||||
id: stg,
|
||||
days: days
|
||||
}
|
||||
});
|
||||
this.$api
|
||||
.call(ApiMaTimelocks.loadZeitsperrenLectorStg(days, stg))
|
||||
.then(result => {
|
||||
@@ -128,47 +147,85 @@ export default {
|
||||
createArrayMa(type){
|
||||
this.showTable = true;
|
||||
if(type == "fix") {
|
||||
if(this.id && this.isZifferString(this.id))
|
||||
this.interval = Number(this.id) < 100 ? Number(this.id) : this.interval;
|
||||
|
||||
this.loadZeitsperrenFixeMa(this.interval);
|
||||
}
|
||||
else if(type == "lector") {
|
||||
if(this.id && this.isZifferString(this.id))
|
||||
this.interval = Number(this.id) < 100 ? Number(this.id) : this.interval;
|
||||
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);
|
||||
this.loadOes().then(() => {
|
||||
if(this.id && this.validOes.includes(this.id)) {
|
||||
const countDays = this.tage ? Number(this.tage) : this.interval;
|
||||
|
||||
this.oe_temp = this.listOes.filter(
|
||||
item => item.oe_kurzbz === this.id
|
||||
);
|
||||
this.selectedOe = this.oe_temp[0];
|
||||
|
||||
this.loadZeitsperrenOE(
|
||||
countDays,
|
||||
this.selectedOe.oe_kurzbz
|
||||
);
|
||||
} else {
|
||||
if(this.id)
|
||||
this.interval = Number(this.id) < 100
|
||||
? Number(this.id)
|
||||
: this.interval;
|
||||
|
||||
this.showTable = false;
|
||||
this.selectedOe = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
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 == "stg") {
|
||||
this.loadStgs().then(() => {
|
||||
if(this.id && this.validStgs.includes(Number(this.id)))
|
||||
{
|
||||
const countDays= this.tage ? Number(this.tage) : this.interval;
|
||||
this.stg_temp = this.listStg.filter(
|
||||
item => item.studiengang_kz === Number(this.id)
|
||||
);
|
||||
this.selectedStg = this.stg_temp[0];
|
||||
this.loadZeitsperrenStg(countDays, this.id)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(this.id && this.isZifferString(this.id))
|
||||
this.interval = Number(this.id) < 100 ? Number(this.id) : this.interval;
|
||||
this.showTable = false;
|
||||
this.selectedStg = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
else if(type == "all") {
|
||||
if(this.id && this.isZifferString(this.id))
|
||||
this.interval = Number(this.id) < 100 ? Number(this.id) : this.interval;
|
||||
this.loadAllActiveZeitsperren(this.interval);
|
||||
}
|
||||
else if(type == "ass") {
|
||||
if(this.id && this.isZifferString(this.id))
|
||||
this.interval = Number(this.id) < 100 ? Number(this.id) : this.interval;
|
||||
this.loadZeitsperrenAss(this.interval);
|
||||
}
|
||||
else if(type == "ma") {
|
||||
if(!this.id)
|
||||
this.$fhcAlert.alertError(this.$p.t('ui', 'error_missingId', {id: "mitarbeiteruid"}));
|
||||
const countDays= this.tage ? this.tage : this.interval;
|
||||
this.loadZeitsperrenMa(countDays, this.maUid);
|
||||
this.loadDetailsMa(this.maUid);
|
||||
this.loadZeitsperrenMa(countDays, this.id);
|
||||
this.loadDetailsMa(this.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.$fhcAlert.alertError(this.$p.t('ui', 'error_fieldNotFound', {field: "Typ Zeitsperre"}));
|
||||
//route back if no type found
|
||||
this.$router.push({
|
||||
name: 'ZeitsperrenMa',
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
isBlocked(mitarbeiter, tag) {
|
||||
if (!mitarbeiter?.sperren) {
|
||||
@@ -213,11 +270,50 @@ export default {
|
||||
);
|
||||
},
|
||||
loadDetailsMa(uid){
|
||||
if(!uid)
|
||||
this.$fhcAlert.alertError(this.$p.t('ui', 'error_fieldNotFound', {field: "UID Mitarbeiter"}));
|
||||
|
||||
this.$api
|
||||
.call(ApiMaTimelocks.getDetailsMa(uid))
|
||||
.then(result => {
|
||||
this.fullName = result.data;
|
||||
})
|
||||
},
|
||||
isZifferString(wert) {
|
||||
//to check if the wert of the route param is a ziffer or a real String
|
||||
return typeof wert === 'string' && wert.trim() !== '' && !isNaN(wert);
|
||||
},
|
||||
async loadOes() {
|
||||
try {
|
||||
const result = await this.$api.call(ApiMaTimelocks.getAllOes());
|
||||
this.listOes = result.data.filter(item => item.aktiv);
|
||||
this.validOes = this.listOes.map(item => item.oe_kurzbz);
|
||||
} catch (e) {
|
||||
this.$fhcAlert.handleSystemError(e);
|
||||
}
|
||||
return this.validOes;
|
||||
},
|
||||
async loadStgs() {
|
||||
try {
|
||||
const result = await this.$api.call(ApiMaTimelocks.getAllStg());
|
||||
this.listStg = result.data;
|
||||
this.validStgs = this.listStg.map(item => item.studiengang_kz);
|
||||
} catch (e) {
|
||||
this.$fhcAlert.handleSystemError(e);
|
||||
}
|
||||
return this.validOes;
|
||||
},
|
||||
checkRoute(){
|
||||
if (this.type === 'ma' && !this.id) {
|
||||
//const errorString = this.$p.t('ui', 'successSave');
|
||||
const errorString = "Keine ID für Mitarbeiter übergeben";
|
||||
return errorString;
|
||||
}
|
||||
if (this.type === 'stg' && !this.isZifferString(this.id)) {
|
||||
//const errorString = this.$p.t('ui', 'successSave');
|
||||
const errorString = "Studiengangskennzahl darf nur aus Zahlen bestehen";
|
||||
return errorString;
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -290,7 +386,7 @@ export default {
|
||||
else if(this.type == "ass") {
|
||||
this.loadZeitsperrenAss(newVal);
|
||||
}
|
||||
else if(this.type == "lecStg") {
|
||||
else if(this.type == "stg") {
|
||||
if(this.selectedStg )
|
||||
this.loadZeitsperrenStg(newVal, this.studiengang_kz);
|
||||
}
|
||||
@@ -336,11 +432,26 @@ export default {
|
||||
},
|
||||
},
|
||||
created(){
|
||||
const error = this.checkRoute();
|
||||
if (error) {
|
||||
console.log(error);
|
||||
this.$fhcAlert.alertError(error);
|
||||
return;
|
||||
}
|
||||
|
||||
this.createArrayMa(this.type);
|
||||
if(this.tage)
|
||||
if(this.tage && Number(this.tage) < 100) {
|
||||
this.createDays(Number(this.tage));
|
||||
this.interval = Number(this.tage);
|
||||
}
|
||||
else
|
||||
this.createDays(this.interval);
|
||||
|
||||
if (this.type === 'oe') {
|
||||
this.oe_kurzbz = this.id
|
||||
} else if (this.type === 'stg'){
|
||||
this.studiengang_kz = this.id;
|
||||
}
|
||||
},
|
||||
template: `
|
||||
<div class="w-100 h-100">
|
||||
@@ -349,7 +460,7 @@ export default {
|
||||
<span v-if="type=='fix'">{{$p.t('zeitsperren/title_fix')}}</span>
|
||||
<span v-if="type=='lector'">{{$p.t('zeitsperren/title_fixLecturers')}}</span>
|
||||
<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=='stg'">{{$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}}
|
||||
@@ -393,8 +504,8 @@ export default {
|
||||
</form-input>
|
||||
</form-form>
|
||||
</div>
|
||||
<label v-if="type=='lecStg'">{{$p.t('zeitsperren/lektor_innen')}}</label>
|
||||
<div v-if="type=='lecStg'" class="flex-grow-1">
|
||||
<label v-if="type=='stg'">{{$p.t('zeitsperren/lektor_innen')}}</label>
|
||||
<div v-if="type=='stg'" class="flex-grow-1">
|
||||
<form-form class="g-3" ref="oeSelectForm">
|
||||
<form-input
|
||||
container-class="w-50"
|
||||
@@ -423,7 +534,7 @@ export default {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table v-if="showTable" class="table table-dark table-striped table-bordered">
|
||||
<table v-if="showTable" class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"> UID </th>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import listsZeitsperren from './Details/listsZeitsperren.js';
|
||||
import MitarbeiterZeitsperren from './Details/ZeitsperrenMitarbeiteruid.js';
|
||||
export const DEFAULT_INTERVAL_DAYS = 14;
|
||||
|
||||
export default {
|
||||
name: 'ZeitsperrenMa',
|
||||
@@ -40,7 +41,7 @@ export default {
|
||||
class: 'btn-secondary'
|
||||
},
|
||||
{
|
||||
key: 'lecStg',
|
||||
key: 'stg',
|
||||
title: 'zeitsperren/btn_lect_stg',
|
||||
class: 'btn-secondary'
|
||||
}
|
||||
@@ -51,13 +52,20 @@ export default {
|
||||
show(view) {
|
||||
this.activeView = this.activeView === view ? null : view;
|
||||
},
|
||||
route(view) {
|
||||
this.activeView = this.activeView === view ? null : view;
|
||||
this.$router.push({
|
||||
name: 'ZeitsperrenMa',
|
||||
params: {
|
||||
type: this.activeView,
|
||||
days: DEFAULT_INTERVAL_DAYS
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
//TODO(only show main page if there is no prop
|
||||
template: `
|
||||
<div class="base-zeitsperren w-100 h-100">
|
||||
|
||||
<template v-if="!propsViewData.maUid && !propsViewData.type">
|
||||
|
||||
<div class="row g-1">
|
||||
<div
|
||||
class="col"
|
||||
@@ -67,28 +75,19 @@ export default {
|
||||
<button
|
||||
class="btn w-100"
|
||||
:class="button.class"
|
||||
@click="show(button.key)"
|
||||
@click="route(button.key)"
|
||||
>
|
||||
{{ $p.t(button.title) }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<lists-zeitsperren
|
||||
v-if="activeView"
|
||||
ref="listTimeLocks"
|
||||
:type="activeView"
|
||||
/>
|
||||
|
||||
</template>
|
||||
<template v-else>
|
||||
|
||||
<lists-zeitsperren
|
||||
<lists-zeitsperren
|
||||
:type="propsViewData.type"
|
||||
:maUid="propsViewData.maUid"
|
||||
:id="propsViewData.id"
|
||||
:tage="propsViewData.days"
|
||||
/>
|
||||
</template>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -4,8 +4,6 @@ import FhcHeader from "../DetailHeader/DetailHeader.js";
|
||||
import VertraegeMitarbeiter from "./Vertraege.js";
|
||||
import VerticalSplit from "../verticalsplit/verticalsplit.js";
|
||||
import ApiCoreVertraege from '../../api/factory/vertraege/vertraege.js';
|
||||
import ZeitsperrenProv from '../Cis/ZeitsperrenMitarbeiter/ZeitsperrenMa.js';
|
||||
|
||||
|
||||
export default {
|
||||
name: 'Vertragsverwaltung',
|
||||
@@ -14,8 +12,7 @@ export default {
|
||||
VerticalSplit,
|
||||
MitarbeiterHeader,
|
||||
FhcHeader,
|
||||
VertraegeMitarbeiter,
|
||||
ZeitsperrenProv
|
||||
VertraegeMitarbeiter
|
||||
},
|
||||
props: {
|
||||
config: Object,
|
||||
@@ -52,9 +49,6 @@ export default {
|
||||
},
|
||||
template: `
|
||||
<!-- Navigation component -->
|
||||
|
||||
<zeitsperren-prov/>
|
||||
|
||||
<core-navigation-cmpt/>
|
||||
|
||||
<div id="content">
|
||||
|
||||
@@ -60681,6 +60681,26 @@ I have been informed that I am under no obligation to consent to the transmissio
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'ui',
|
||||
'phrase' => 'error_paramNoNumber',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Parameter {param} muss eine Zahl sein',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'Parameter {param} has to be a number',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
// PHRASES ZEITSPERREN END
|
||||
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user