diff --git a/application/config/routes.php b/application/config/routes.php index 8024f449a..7df2d7d33 100644 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -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'; diff --git a/application/controllers/Cis/Zeitsperren.php b/application/controllers/Cis/Zeitsperren.php new file mode 100644 index 000000000..f443f8a6d --- /dev/null +++ b/application/controllers/Cis/Zeitsperren.php @@ -0,0 +1,31 @@ + ['basis/cis:r'] + ]); + + } + + // ----------------------------------------------------------------------------------------------------------------- + // Public methods + + /** + * @return void + */ + public function index() + { + $this->load->view('CisRouterView/CisRouterView.php', ['route' => 'Zeitsperren']); + } +} diff --git a/application/controllers/api/frontend/v1/MaZeitsperren.php b/application/controllers/api/frontend/v1/MaZeitsperren.php index 796adc40c..8c7abae1c 100644 --- a/application/controllers/api/frontend/v1/MaZeitsperren.php +++ b/application/controllers/api/frontend/v1/MaZeitsperren.php @@ -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); + } + } diff --git a/application/models/ressource/Zeitsperre_model.php b/application/models/ressource/Zeitsperre_model.php index 4ecd1bda8..0a1510619 100644 --- a/application/models/ressource/Zeitsperre_model.php +++ b/application/models/ressource/Zeitsperre_model.php @@ -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 "; diff --git a/application/views/CisRouterView/CisRouterView.php b/application/views/CisRouterView/CisRouterView.php index c51ca40c3..54165209f 100644 --- a/application/views/CisRouterView/CisRouterView.php +++ b/application/views/CisRouterView/CisRouterView.php @@ -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', diff --git a/public/js/api/factory/zeitsperren.js b/public/js/api/factory/zeitsperren.js index 5fc8b9c20..325bcc0c5 100644 --- a/public/js/api/factory/zeitsperren.js +++ b/public/js/api/factory/zeitsperren.js @@ -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, + }; + } } \ No newline at end of file diff --git a/public/js/apps/Cis/Cis.js b/public/js/apps/Cis/Cis.js index e801f172e..1d857af6b 100644 --- a/public/js/apps/Cis/Cis.js +++ b/public/js/apps/Cis/Cis.js @@ -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 - }, ] }) diff --git a/public/js/components/Cis/Profil/MitarbeiterViewProfil.js b/public/js/components/Cis/Profil/MitarbeiterViewProfil.js index 07a21fcca..60a26c0c3 100644 --- a/public/js/components/Cis/Profil/MitarbeiterViewProfil.js +++ b/public/js/components/Cis/Profil/MitarbeiterViewProfil.js @@ -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*/ `
@@ -279,6 +283,16 @@ export default {
+ +
+
+ +
+
diff --git a/public/js/components/Cis/ZeitsperrenMitarbeiter/Details/ZeitsperrenMitarbeiteruid.js b/public/js/components/Cis/ZeitsperrenMitarbeiter/Details/ZeitsperrenMitarbeiteruid.js new file mode 100644 index 000000000..971e15f54 --- /dev/null +++ b/public/js/components/Cis/ZeitsperrenMitarbeiter/Details/ZeitsperrenMitarbeiteruid.js @@ -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: ` +
+ + {{title}} + +
+ `, +} \ No newline at end of file diff --git a/public/js/components/Cis/ZeitsperrenMitarbeiter/Details/listsZeitsperren.js b/public/js/components/Cis/ZeitsperrenMitarbeiter/Details/listsZeitsperren.js index f6270aff4..72981c672 100644 --- a/public/js/components/Cis/ZeitsperrenMitarbeiter/Details/listsZeitsperren.js +++ b/public/js/components/Cis/ZeitsperrenMitarbeiter/Details/listsZeitsperren.js @@ -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: `
@@ -324,6 +351,7 @@ export default { {{$p.t('zeitsperren/title_byOe')}} {{$p.t('zeitsperren/title_lectStg')}} {{$p.t('zeitsperren/title_ass')}} + {{$p.t('zeitsperren/zeitsperrenVon')}} {{fullName}} {{ mondayBeforeToday.toLocaleDateString('de-AT') }} - {{endInterval}}
diff --git a/public/js/components/Cis/ZeitsperrenMitarbeiter/ZeitsperrenMa.js b/public/js/components/Cis/ZeitsperrenMitarbeiter/ZeitsperrenMa.js index 29561cf9e..85de8781a 100644 --- a/public/js/components/Cis/ZeitsperrenMitarbeiter/ZeitsperrenMa.js +++ b/public/js/components/Cis/ZeitsperrenMitarbeiter/ZeitsperrenMa.js @@ -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: `
-
-
- + +
-
+ + + + + + +
`, } \ No newline at end of file diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 192d1df47..c03b43636 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -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 );