From b7a1add2f3c161820724dcf74e0b2d53195235ed Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Fri, 7 Jul 2023 02:12:14 +0200 Subject: [PATCH] bismeldestichtage gui: removed filters, now just simple tabulator --- .../components/filters/Bismeldestichtag.php | 17 --------- .../controllers/codex/Bismeldestichtag.php | 14 ++++++++ application/views/codex/bismeldestichtag.php | 9 ++--- public/js/apps/Bismeldestichtag/API.js | 9 +++++ .../apps/Bismeldestichtag/Bismeldestichtag.js | 35 ++++++++++++++----- .../apps/Bismeldestichtag/TabulatorSetup.js | 5 ++- system/filtersupdate.php | 19 ---------- 7 files changed, 57 insertions(+), 51 deletions(-) delete mode 100644 application/components/filters/Bismeldestichtag.php diff --git a/application/components/filters/Bismeldestichtag.php b/application/components/filters/Bismeldestichtag.php deleted file mode 100644 index d7900a9b1..000000000 --- a/application/components/filters/Bismeldestichtag.php +++ /dev/null @@ -1,17 +0,0 @@ - 'core', - 'datasetName' => 'bismeldestichtag', - 'query' => ' - SELECT - bmt.meldestichtag_id AS "Id", - bmt.meldestichtag AS "Meldestichtag", - bmt.studiensemester_kurzbz AS "Studiensemester" - FROM - bis.tbl_bismeldestichtag bmt - ORDER BY - meldestichtag DESC, meldestichtag_id DESC - ', - 'requiredPermissions' => 'admin' - ); - diff --git a/application/controllers/codex/Bismeldestichtag.php b/application/controllers/codex/Bismeldestichtag.php index ca175e1fc..4956ea71e 100644 --- a/application/controllers/codex/Bismeldestichtag.php +++ b/application/controllers/codex/Bismeldestichtag.php @@ -16,6 +16,7 @@ class Bismeldestichtag extends Auth_Controller array( 'index' => 'admin:r', 'getStudiensemester' => 'admin:r', + 'getBismeldestichtage' => 'admin:r', 'addBismeldestichtag' => 'admin:rw', 'deleteBismeldestichtag' => 'admin:rw' ) @@ -75,6 +76,19 @@ class Bismeldestichtag extends Auth_Controller ); } + public function getBismeldestichtage() + { + $this->BismeldestichtagModel->addSelect('meldestichtag, studiensemester_kurzbz'); + $this->BismeldestichtagModel->addOrder('meldestichtag', 'DESC'); + $this->BismeldestichtagModel->addOrder('meldestichtag_id', 'DESC'); + $this->outputJson($this->BismeldestichtagModel->load()); + + //~ if (hasData($bismeldestichtagRes)) + //~ $this->outputJsonSuccess(getData($bismeldestichtagRes)); + //~ else + //~ $this->outputJsonSuccess(array()); + } + public function addBismeldestichtag() { // get request data diff --git a/application/views/codex/bismeldestichtag.php b/application/views/codex/bismeldestichtag.php index 47e891648..ba225e19a 100644 --- a/application/views/codex/bismeldestichtag.php +++ b/application/views/codex/bismeldestichtag.php @@ -17,9 +17,9 @@
- + - + + :table-only="true">
diff --git a/public/js/apps/Bismeldestichtag/API.js b/public/js/apps/Bismeldestichtag/API.js index b6b2a0105..2b6457ea3 100644 --- a/public/js/apps/Bismeldestichtag/API.js +++ b/public/js/apps/Bismeldestichtag/API.js @@ -36,6 +36,15 @@ export const BismeldestichtagAPIs = { } ); }, + getBismeldestichtage: function() { + return CoreRESTClient.get( + 'codex/Bismeldestichtag/getBismeldestichtage', + null, + { + timeout: CORE_BISMELDESTICHTAG_CMPT_TIMEOUT + } + ); + }, addBismeldestichtag: function(wsParams) { return CoreRESTClient.post( 'codex/Bismeldestichtag/addBismeldestichtag', diff --git a/public/js/apps/Bismeldestichtag/Bismeldestichtag.js b/public/js/apps/Bismeldestichtag/Bismeldestichtag.js index edc665f2d..4c7c7374c 100644 --- a/public/js/apps/Bismeldestichtag/Bismeldestichtag.js +++ b/public/js/apps/Bismeldestichtag/Bismeldestichtag.js @@ -27,7 +27,6 @@ import {BismeldestichtagAPIs} from './API.js'; const bismeldestichtagApp = Vue.createApp({ data: function() { return { - appSideMenuEntries: {}, bismeldestichtagTabulatorOptions: BismeldestichtagTabulatorOptions, bismeldestichtagTabulatorEventHandlers: BismeldestichtagTabulatorEventHandlers, meldestichtag: null, // date of Meldestichtag @@ -49,9 +48,6 @@ const bismeldestichtagApp = Vue.createApp({ this.handlerStudiensemester(); }, methods: { - newSideMenuEntryHandler: function(payload) { - this.appSideMenuEntries = payload; - }, /** * Define Studiensemester call and method to be executed after the call */ @@ -62,6 +58,16 @@ const bismeldestichtagApp = Vue.createApp({ this.fetchCmptDataFetchedStudiensemester ); }, + /** + * Define Studiensemester call and method to be executed after the call + */ + handlerBismeldestichtage: function() { + this.startFetchCmpt( + BismeldestichtagAPIs.getBismeldestichtage, + null, + this.fetchCmptDataFetchedBismeldestichtage + ); + }, /** * Define add Bismeldestichtag call and method to be executed after the call */ @@ -98,6 +104,21 @@ const bismeldestichtagApp = Vue.createApp({ let semRes = CoreRESTClient.getData(data); this.semList = semRes.semList; this.currSem = semRes.currSem; + this.handlerBismeldestichtage(); + } + else + alert("No response data"); + }, + /** + * Called after Bismeldestichtage response is received + */ + fetchCmptDataFetchedBismeldestichtage: function(data) { + console.log(data); + if (CoreRESTClient.isError(data)) alert(CoreRESTClient.getError(data)); + if (CoreRESTClient.hasData(data)) + { + let meldestichtage = CoreRESTClient.getData(data); + this.$refs.bismeldestichtageTable.tabulator.setData(meldestichtage); } else alert("No response data"); @@ -110,8 +131,7 @@ const bismeldestichtagApp = Vue.createApp({ alert(CoreRESTClient.getError(data)); else if (CoreRESTClient.hasData(data)) { - window.location.reload(); - alert("Successfully added Bismeldestichtag"); + this.handlerBismeldestichtage(); } else alert("No response data"); @@ -124,8 +144,7 @@ const bismeldestichtagApp = Vue.createApp({ alert(CoreRESTClient.getError(data)); else if (CoreRESTClient.hasData(data)) { - window.location.reload(); - alert("Successfully deletted Bismeldestichtag"); + this.handlerBismeldestichtage(); } else alert("No response data"); diff --git a/public/js/apps/Bismeldestichtag/TabulatorSetup.js b/public/js/apps/Bismeldestichtag/TabulatorSetup.js index 05e1a593a..d1cc39bcc 100644 --- a/public/js/apps/Bismeldestichtag/TabulatorSetup.js +++ b/public/js/apps/Bismeldestichtag/TabulatorSetup.js @@ -23,12 +23,11 @@ export const BismeldestichtagTabulatorOptions = { minHeight: 50, layout: 'fitColumns', columns: [ - {title: 'ID', field: 'Id', headerFilter: true}, - {title: 'Meldestichtag',field: 'Meldestichtag', headerFilter: true, formatter: function(cell){ + {title: 'Meldestichtag',field: 'meldestichtag', headerFilter: true, formatter: function(cell){ return cell.getValue().replace(/(.*)-(.*)-(.*)/, '$3.$2.$1'); } }, - {title: 'Studiensemester', field: 'Studiensemester', headerFilter: true} + {title: 'Studiensemester', field: 'studiensemester_kurzbz', headerFilter: true} ] }; diff --git a/system/filtersupdate.php b/system/filtersupdate.php index d71d8ea33..241e44f2f 100644 --- a/system/filtersupdate.php +++ b/system/filtersupdate.php @@ -1256,25 +1256,6 @@ $filters = array( } ', 'oe_kurzbz' => null, - ), - array( - 'app' => 'core', - 'dataset_name' => 'bismeldestichtag', - 'filter_kurzbz' => 'bismeldestichtag', - 'description' => '{Bismeldestichtage verwalten}', - 'sort' => 1, - 'default_filter' => true, - 'filter' => ' - { - "name": "bismeldestichtag", - "columns": [ - {"name": "Meldestichtag"}, - {"name": "Studiensemester"} - ], - "filters": [] - } - ', - 'oe_kurzbz' => null, ) );