From 13f71502e64a9b523bd85d2016f1d6c6b0c2373c Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Wed, 23 Aug 2023 10:28:55 +0200 Subject: [PATCH 001/464] 1st draft --- .../controllers/Studentenverwaltung.php | 19 ++++ .../components/Studentenverwaltung.php | 60 +++++++++++++ application/views/Studentenverwaltung.php | 53 +++++++++++ public/css/Studentenverwaltung.css | 60 +++++++++++++ public/js/apps/Studentenverwaltung.js | 88 +++++++++++++++++++ .../components/Studienverwaltung/Details.js | 9 ++ .../js/components/Studienverwaltung/List.js | 69 +++++++++++++++ .../components/Studienverwaltung/Verband.js | 68 ++++++++++++++ 8 files changed, 426 insertions(+) create mode 100644 application/controllers/Studentenverwaltung.php create mode 100644 application/controllers/components/Studentenverwaltung.php create mode 100644 application/views/Studentenverwaltung.php create mode 100644 public/css/Studentenverwaltung.css create mode 100644 public/js/apps/Studentenverwaltung.js create mode 100644 public/js/components/Studienverwaltung/Details.js create mode 100644 public/js/components/Studienverwaltung/List.js create mode 100644 public/js/components/Studienverwaltung/Verband.js diff --git a/application/controllers/Studentenverwaltung.php b/application/controllers/Studentenverwaltung.php new file mode 100644 index 000000000..dded0ffdd --- /dev/null +++ b/application/controllers/Studentenverwaltung.php @@ -0,0 +1,19 @@ +load->view('Studentenverwaltung'); + } +} diff --git a/application/controllers/components/Studentenverwaltung.php b/application/controllers/components/Studentenverwaltung.php new file mode 100644 index 000000000..d03c7e350 --- /dev/null +++ b/application/controllers/components/Studentenverwaltung.php @@ -0,0 +1,60 @@ +load->model('organisation/Studiengang_model', 'StudiengangModel'); + $result = $this->StudiengangModel->loadWhere(['aktiv' => true]); + if (isError($result)) + return $this->outputJson($result); + if (!hasData($result)) + return $this->outputJsonSuccess([]); + $list = getData($result); + $list[] = [ + 'name' => 'International', + 'children' => [ + [ + 'name' => 'Incoming', + 'leaf' => true + ], + [ + 'name' => 'Outgoing', + 'leaf' => true + ], + [ + 'name' => 'Gemeinsame Studien', + 'leaf' => true + ] + ] + ]; + $this->outputJsonSuccess($list); + } + + /** + * @param integer $studiengang_kz + * @return void + */ + public function getStudiengang($studiengang_kz) + { + // TODO(chris): load stgSemester + prestudent + $this->outputJson([ + [ + 'key' => 2, + 'name' => 'PreStudent' + ] + ]); + } +} diff --git a/application/views/Studentenverwaltung.php b/application/views/Studentenverwaltung.php new file mode 100644 index 000000000..20a89f8e8 --- /dev/null +++ b/application/views/Studentenverwaltung.php @@ -0,0 +1,53 @@ + 'Studentenverwaltung', + 'axios027' => true, + 'bootstrap5' => true, + 'fontawesome6' => true, + 'vue3' => true, + 'primevue3' => true, + 'filtercomponent' => true, + 'tabulator5' => true, + 'phrases' => [], + 'customCSSs' => [ + 'public/css/Studentenverwaltung.css' + ], + 'customJSModules' => [ + 'public/js/apps/Studentenverwaltung.js' + ] + ); + + $this->load->view('templates/FHC-Header', $includesArray); +?> + +
+ + +
+
+ +
+ + + + +
+
+
+
+ +load->view('templates/FHC-Footer', $includesArray); ?> + diff --git a/public/css/Studentenverwaltung.css b/public/css/Studentenverwaltung.css new file mode 100644 index 000000000..ccc5b0694 --- /dev/null +++ b/public/css/Studentenverwaltung.css @@ -0,0 +1,60 @@ +@import './components/searchbar.css'; +@import './components/verticalsplit.css'; + +.searchbar { + margin-right: 0!important; +} +.searchbar > .input-group { + margin-right: 0!important; +} +.searchbar > .input-group > * { + border-radius: 0!important; +} + +#main { + display: flex; + flex-direction: column; + height: 100vh; +} +#main > header { + flex: 0 0 auto; +} +#main > div { + flex: 1 1 auto; +} + +@media (min-width: 768px) { + #sidebarMenu { + visibility: visible!important; + transform: none; + position: inherit; + z-index: 1; + } +} + + +@media (max-width: 769px) { + .stv-verband { + max-height: calc(100% - 3rem); + overflow: auto; + } +} +.stv-verband .p-treetable-tbody > tr > td { + display: flex; + padding-top: .25rem!important; + padding-bottom: .25rem!important; +} +.stv-verband .p-treetable-tbody > tr > td > button { + flex: 0 0 auto; +} +.stv-verband .p-treetable-tbody > tr > td > span { + flex: 1 1 auto; +} + +.stv-list { + display: flex; + flex-direction: column; +} +.stv-list > #filterTableDataset { + flex: 1 1 auto; +} \ No newline at end of file diff --git a/public/js/apps/Studentenverwaltung.js b/public/js/apps/Studentenverwaltung.js new file mode 100644 index 000000000..bdec5d033 --- /dev/null +++ b/public/js/apps/Studentenverwaltung.js @@ -0,0 +1,88 @@ +/** + * Copyright (C) 2022 fhcomplete.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import FhcSearchbar from "../components/searchbar/searchbar.js"; +import StvVerband from "../components/Studienverwaltung/Verband.js"; +import StvList from "../components/Studienverwaltung/List.js"; +import StvStudent from "../components/Studienverwaltung/Student.js"; +import VerticalSplit from "../components/verticalsplit/verticalsplit.js"; +import fhcapifactory from "./api/fhcapifactory.js"; + +Vue.$fhcapi = fhcapifactory; + +const app = Vue.createApp({ + components: { + FhcSearchbar, + StvVerband, + StvList, + StvStudent, + VerticalSplit + }, + data() { + return { + selected: [], + searchbaroptions: { + types: [ + "person", + "student", + "prestudent" + ], + actions: { + person: { + defaultaction: { + type: "link", + action: function(data) { + return data.profil; + } + }, + childactions: [ + { + "label": "testchildaction1", + "icon": "fas fa-check-circle", + "type": "function", + "action": function(data) { + alert('person testchildaction 01 ' + JSON.stringify(data)); + } + }, + { + "label": "testchildaction2", + "icon": "fas fa-file-csv", + "type": "function", + "action": function(data) { + alert('person testchildaction 02 ' + JSON.stringify(data)); + } + } + ] + } + } + }, + } + }, + computed: { + lastSelected() { + return this.selected[this.selected.length - 1]; + } + }, + methods: { + searchfunction(searchsettings) { + return Vue.$fhcapi.Search.search(searchsettings); + } + } +}); + +app.use(primevue.config.default).mount('#main'); + diff --git a/public/js/components/Studienverwaltung/Details.js b/public/js/components/Studienverwaltung/Details.js new file mode 100644 index 000000000..f119b34e4 --- /dev/null +++ b/public/js/components/Studienverwaltung/Details.js @@ -0,0 +1,9 @@ +export default { + props: { + student: Object + }, + template: ` +
+ {{student}} +
` +}; \ No newline at end of file diff --git a/public/js/components/Studienverwaltung/List.js b/public/js/components/Studienverwaltung/List.js new file mode 100644 index 000000000..9a32914b7 --- /dev/null +++ b/public/js/components/Studienverwaltung/List.js @@ -0,0 +1,69 @@ +import {CoreFilterCmpt} from "../filter/Filter.js"; + +export default { + components: { + CoreFilterCmpt + }, + props: { + selected: Array + }, + emits: [ + 'update:selected' + ], + data() { + return { + tabulatorOptions: { + columns:[ //Define Table Columns + {title:"Name", field:"name", width:150}, + {title:"Age", field:"age", hozAlign:"left", formatter:"progress"}, + {title:"Favourite Color", field:"col"}, + {title:"Date Of Birth", field:"dob", sorter:"date", hozAlign:"center"}, + ], + data: [ + {id:1, name:"Oli Bob", age:"12", col:"red", dob:""}, + {id:2, name:"Mary May", age:"1", col:"blue", dob:"14/05/1982"}, + {id:3, name:"Christine Lobowski", age:"42", col:"green", dob:"22/05/1982"}, + {id:4, name:"Brendon Philips", age:"125", col:"orange", dob:"01/08/1980"}, + {id:5, name:"Margret Marmajuke", age:"16", col:"yellow", dob:"31/01/1999"}, + {id:6, name:"Oli Bob", age:"12", col:"red", dob:""}, + {id:7, name:"Mary May", age:"1", col:"blue", dob:"14/05/1982"}, + {id:8, name:"Christine Lobowski", age:"42", col:"green", dob:"22/05/1982"}, + {id:9, name:"Brendon Philips", age:"125", col:"orange", dob:"01/08/1980"} + ], + + height: 'auto', + selectable: true + }, + tabulatorEvents: [ + { + event: 'rowSelectionChanged', + handler: this.rowSelectionChanged + } + ] + } + }, + methods: { + actionNewPrestudent() { + console.log('actionNewPrestudent'); + }, + rowSelectionChanged(data) { + this.$emit('update:selected', data); + } + }, + mounted() { + }, + template: ` +
+ + +
` +}; \ No newline at end of file diff --git a/public/js/components/Studienverwaltung/Verband.js b/public/js/components/Studienverwaltung/Verband.js new file mode 100644 index 000000000..e7abbbcd4 --- /dev/null +++ b/public/js/components/Studienverwaltung/Verband.js @@ -0,0 +1,68 @@ +import {CoreRESTClient} from '../../RESTClient.js'; + +export default { + components: { + TreeTable: primevue.treetable, + TreeColumn: primevue.column + }, + data() { + return { + loading: true, + nodes: [] + } + }, + methods: { + onExpandTreeNode(node) { + if (!node.children) { + let url = ''; + if (node.data.studiengang_kz) { + url = "getStudiengang/" + node.data.studiengang_kz; + } + + if (url) { + this.loading = true; + CoreRESTClient + .get("components/Studentenverwaltung/" + url) + .then(result => { + const subNodes = result.data.map(this.mapResultToTreeData); + node.children = subNodes; + this.loading = false; + }); + } + } + }, + mapResultToTreeData(el) { + const cp = { + data: el + }; + if (el.studiengang_kz !== undefined) { + // TODO(chris): scrolling doesn't work + cp.key = el.studiengang_kz; + cp.data.name = el.bezeichnung; + cp.leaf = false; + } + if (el.children) + cp.children = el.children.map(this.mapResultToTreeData); + else + cp.leaf = el.leaf || false; + return cp; + } + }, + mounted() { + CoreRESTClient + .get("components/Studentenverwaltung") + .then(result => result.data) + .then(result => { + if(CoreRESTClient.isError(result)) { + console.error(CoreRESTClient.getError(result)); + } else if (CoreRESTClient.hasData(result)) { + this.nodes = CoreRESTClient.getData(result).map(this.mapResultToTreeData); + } + this.loading = false; + }); + }, + template: ` + + + ` +}; \ No newline at end of file From 1009f73109a9280dda22b988d41296599100b6c1 Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Thu, 31 Aug 2023 08:26:16 +0200 Subject: [PATCH 002/464] improvements --- .../components/Studentenverwaltung.php | 91 ++++++++++++++++++- application/views/Studentenverwaltung.php | 4 +- public/js/apps/Studentenverwaltung.js | 7 +- .../js/components/Studienverwaltung/List.js | 32 +++---- .../components/Studienverwaltung/Verband.js | 13 ++- 5 files changed, 123 insertions(+), 24 deletions(-) diff --git a/application/controllers/components/Studentenverwaltung.php b/application/controllers/components/Studentenverwaltung.php index d03c7e350..63fb7118c 100644 --- a/application/controllers/components/Studentenverwaltung.php +++ b/application/controllers/components/Studentenverwaltung.php @@ -17,7 +17,22 @@ class Studentenverwaltung extends FHC_Controller { // TODO(chris): load stgs (this is just for testing) $this->load->model('organisation/Studiengang_model', 'StudiengangModel'); - $result = $this->StudiengangModel->loadWhere(['aktiv' => true]); + + $this->StudiengangModel->addJoin('public.tbl_lehrverband v', 'studiengang_kz'); + + $this->StudiengangModel->addDistinct(); + $this->StudiengangModel->addSelect('v.studiengang_kz'); + $this->StudiengangModel->addSelect('tbl_studiengang.bezeichnung'); + $this->StudiengangModel->addSelect('kurzbzlang'); + $this->StudiengangModel->addSelect('erhalter_kz'); + $this->StudiengangModel->addSelect('typ'); + $this->StudiengangModel->addSelect('kurzbz'); + + $this->StudiengangModel->addOrder('erhalter_kz'); + $this->StudiengangModel->addOrder('typ'); + $this->StudiengangModel->addOrder('kurzbz'); + + $result = $this->StudiengangModel->loadWhere(['v.aktiv' => true]); if (isError($result)) return $this->outputJson($result); if (!hasData($result)) @@ -57,4 +72,78 @@ class Studentenverwaltung extends FHC_Controller ] ]); } + + /** + * @param integer $studiengang_kz + * @return void + */ + public function getStudents($studiengang_kz = null) + { + // TODO(chris): stdSem? + $stdSem='SS2023'; + + // TODO(chris): load students filtered by the params + $this->load->model('crm/Prestudent_model', 'PrestudentModel'); + + $this->PrestudentModel->addJoin('public.tbl_person p', 'person_id'); + $this->PrestudentModel->addJoin('public.tbl_student s', 'prestudent_id'); + $this->PrestudentModel->addJoin('public.tbl_benutzer b', 's.student_uid=b.uid'); + $this->PrestudentModel->addJoin('public.tbl_studentlehrverband v', 'v.student_uid=s.student_uid AND v.studiensemester_kurzbz=' . $this->PrestudentModel->escape($stdSem)); + + $this->PrestudentModel->addSelect('p.person_id'); + $this->PrestudentModel->addSelect('s.prestudent_id'); + $this->PrestudentModel->addSelect('b.uid'); + $this->PrestudentModel->addSelect('titelpre'); + $this->PrestudentModel->addSelect('titelpost'); + $this->PrestudentModel->addSelect('vorname'); + $this->PrestudentModel->addSelect('wahlname'); + $this->PrestudentModel->addSelect('vornamen'); + $this->PrestudentModel->addSelect('geschlecht'); + $this->PrestudentModel->addSelect('nachname'); + $this->PrestudentModel->addSelect('gebdatum'); + $this->PrestudentModel->addSelect('tbl_prestudent.anmerkung'); + $this->PrestudentModel->addSelect('ersatzkennzeichen'); + $this->PrestudentModel->addSelect('svnr'); + $this->PrestudentModel->addSelect('s.matrikelnr'); + $this->PrestudentModel->addSelect('p.anmerkung AS anmerkungen'); + $this->PrestudentModel->addSelect('v.semester'); + $this->PrestudentModel->addSelect('v.verband'); + $this->PrestudentModel->addSelect('v.gruppe'); + $this->PrestudentModel->addSelect('tbl_prestudent.studiengang_kz'); + $this->PrestudentModel->addSelect('aufmerksamdurch_kurzbz'); + $this->PrestudentModel->addSelect('mentor'); + $this->PrestudentModel->addSelect('b.aktiv AS bnaktiv'); + $this->PrestudentModel->addSelect("(SELECT kontakt FROM public.tbl_kontakt WHERE kontakttyp='email' AND person_id=p.person_id AND zustellung LIMIT 1) AS email_privat", false); + $this->PrestudentModel->addSelect("(SELECT rt_gesamtpunkte AS punkte FROM public.tbl_prestudent WHERE prestudent_id=s.prestudent_id) AS punkte", false); + $this->PrestudentModel->addSelect('tbl_prestudent.dual'); + $this->PrestudentModel->addSelect('tbl_prestudent.reihungstest_id'); + $this->PrestudentModel->addSelect('tbl_prestudent.anmeldungreihungstest'); + $this->PrestudentModel->addSelect('p.matr_nr'); + $this->PrestudentModel->addSelect('tbl_prestudent.gsstudientyp_kurzbz'); + $this->PrestudentModel->addSelect('tbl_prestudent.aufnahmegruppe_kurzbz'); + $this->PrestudentModel->addSelect('tbl_prestudent.priorisierung'); + $this->PrestudentModel->addSelect('p.zugangscode'); + $this->PrestudentModel->addSelect('p.bpk'); + + $this->PrestudentModel->addOrder('nachname'); + $this->PrestudentModel->addOrder('vorname'); + + // TODO(chris): do we need that? do we want that? + if ($studiengang_kz === null) + $this->PrestudentModel->addLimit(1000); + + if ($studiengang_kz !== null) + $result = $this->PrestudentModel->loadWhere([ + 'tbl_prestudent.studiengang_kz' => $studiengang_kz + ]); + else + $result = $this->PrestudentModel->load(); + + if (isError($result)) { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + $this->outputJson(getError($result)); + } else { + $this->outputJson(getData($result)); + } + } } diff --git a/application/views/Studentenverwaltung.php b/application/views/Studentenverwaltung.php index 20a89f8e8..96cf0974d 100644 --- a/application/views/Studentenverwaltung.php +++ b/application/views/Studentenverwaltung.php @@ -33,12 +33,12 @@
- +
- +
+
+ v-model:anhang="formData.anhang" + > + + + +
+ parent: {{anhang}} | {{formData.anhang.name}} +
` }; \ No newline at end of file From d38ed229bfaf89b973b80e1539d180048417053f Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Thu, 21 Dec 2023 14:01:25 +0100 Subject: [PATCH 068/464] Korrekturen Bugs --- public/js/components/Stv/Studentenverwaltung/Details.js | 2 +- public/js/components/Stv/Studentenverwaltung/List/New.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/public/js/components/Stv/Studentenverwaltung/Details.js b/public/js/components/Stv/Studentenverwaltung/Details.js index 3f723fdab..69182db29 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details.js +++ b/public/js/components/Stv/Studentenverwaltung/Details.js @@ -24,7 +24,7 @@ export default {
profilbild
-

{{students[0].titlepre}} {{students[0].vorname}} {{students[0].nachname}} {{students[0].titlepost}} +

{{students[0].titlepre}} {{students[0].vorname}} {{students[0].nachname}} {{students[0].titlepost}}

diff --git a/public/js/components/Stv/Studentenverwaltung/List/New.js b/public/js/components/Stv/Studentenverwaltung/List/New.js index d62f92dd3..37f25a823 100644 --- a/public/js/components/Stv/Studentenverwaltung/List/New.js +++ b/public/js/components/Stv/Studentenverwaltung/List/New.js @@ -280,7 +280,7 @@ export default { - + ` +} \ No newline at end of file diff --git a/public/js/components/Form/Upload/SingleFile.js b/public/js/components/Form/Upload/SingleFile.js deleted file mode 100644 index 74c60fcb8..000000000 --- a/public/js/components/Form/Upload/SingleFile.js +++ /dev/null @@ -1,36 +0,0 @@ -export default { - data() { - return { - file: null, - }; - }, - methods: { - handleFileChange(event) { - this.file = event.target.files[0]; - }, - uploadFile() { - if (this.file) { - // You can perform your file upload logic here - console.log('Uploading file:', this.file); - // Reset the file input - this.$refs.fileInput.value = ''; - this.file = null; - } else { - console.error('No file selected'); - } - }, - }, -}; -template: ` -
-

File Upload

-
- - -
-
-

Selected File: {{file.name}}

-
-
-` \ No newline at end of file diff --git a/public/js/components/Notiz/Notiz.js b/public/js/components/Notiz/Notiz.js index d61483a0c..64430294f 100644 --- a/public/js/components/Notiz/Notiz.js +++ b/public/js/components/Notiz/Notiz.js @@ -1,11 +1,10 @@ import VueDatePicker from '../vueDatepicker.js.php'; -//import SingleFile from '../Form/Upload/SingleFile.js'; +import File from '../Form/Upload/File.js'; export default { components: { VueDatePicker, - //BsModal - //SingleFile + File }, props: [ 'typeId', @@ -22,6 +21,11 @@ export default { 'showDocument', 'anhang' ], + data(){ + return { + multiupload: true + } + }, computed: { intTitel: { get() { @@ -103,26 +107,45 @@ export default { } },*/ methods: { - handleFileChange(event) { - //single - this.intAnhang = event.target.files[0]; - - //multiple not working - //this.intAnhang = event.target.files; +/* handleFileChange(event) { + this.intAnhang = event.target.files; + },*/ + reset() { + this.$refs.form.reset(); + //this.$emit('update:anhang', dt.files); }, +/* deleteFile(id){ + //console.log("Delete file with id " + id ); + + //console.log(this.intAnhang[id]); + + const dt = new DataTransfer(); + const files = this.$refs.upload.files; + + for (let i = 0; i < files.length; i++) { + const file = files[i]; + if (id !== i) + dt.items.add(file); // here you exclude the file. thus removing it. + } + + this.$refs.upload.files = dt.files; // Assign the updates list + this.$emit('update:anhang', dt.files); + }*/ }, + template: `
- -component: {{intTitel}} {{intVon}} || {{intAnhang.name}} {{intAnhang}} {{typeId}} -
+
- {{action}} + {{action}} +
+ [{{this.typeId}}] +
-
+
@@ -143,29 +166,30 @@ component: {{intTitel}} {{intVon}} || {{intAnhang.name}} {{intAnhang}} {{typeId}
- - + +
+ +
-
+ -
-

Selected File: {{ intAnhang.name }}

- -
+ + + -
    -
  • - +
  • +
-
+
--> + +
+
@@ -175,7 +199,7 @@ component: {{intTitel}} {{intVon}} || {{intAnhang.name}} {{intAnhang}} {{typeId}
- + {{uid}}
diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js index 29efb8078..ee203efc6 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js @@ -30,8 +30,8 @@ export default { {title: "Text", field: "text", width: 350}, {title: "VerfasserIn", field: "verfasser_uid"}, {title: "BearbeiterIn", field: "bearbeiter_uid", visible: false}, - {title: "Start", field: "start"}, - {title: "Ende", field: "ende"}, + {title: "Start", field: "start", visible: false}, + {title: "Ende", field: "ende", visible: false}, /* {title: "Dokumente", field: "dms_id"},*/ {title: "Dokumente", field: "countdoc"}, {title: "Erledigt", field: "erledigt"}, @@ -71,7 +71,7 @@ export default { bearbeiter: null, anhang: [] }, - showErweitert: true, + showErweitert: false, showDocument: true, } @@ -104,7 +104,8 @@ export default { }); }, actionNewNotiz(){ - this.formData.typeId = 'person'; + this.resetFormData(); +/* this.formData.typeId = 'person'; this.formData.titel = ''; this.formData.action = 'Neue Notiz2'; this.formData.text = null; @@ -114,14 +115,24 @@ export default { this.formData.erledigt = false; this.formData.verfasser = null; this.formData.bearbeiter = null; - this.formData.anhang = []; + this.formData.anhang = [];*/ }, addNewNotiz(notizData) { /* console.log("here: anhang noch empty"); console.log(this.formData);*/ + const formData = new FormData(); - Object.entries(this.formData).forEach(([k, v]) => formData.append(k, v)); + //working with single files + // Object.entries(this.formData).forEach(([k, v]) => formData.append(k, v)); + + //multiple files + //console.log(this.formData.anhang); + Object.entries(this.formData).forEach(([k, v]) => { + if(k!= 'anhang') + formData.append(k, v); + }); + Object.entries(this.formData.anhang).forEach(([k, v]) => formData.append(k, v)); /* for( var i = 0; i < this.formData.anhang.length; i++ ){ let file = this.formData.anhang[i]; @@ -129,8 +140,8 @@ export default { formData.append('files[' + i + ']', file); }*/ - console.log("after append"); - console.log(formData); +/* console.log("after append"); + console.log(this.formData);*/ CoreRESTClient.post('components/stv/Notiz/addNewNotiz/' + this.modelValue.person_id, formData, { Headers: { "Content-Type": "multipart/form-data" } } @@ -152,9 +163,6 @@ export default { window.scrollTo(0, 0); }); }, - attachFile(){ - console.log("ATTACH FILE"); - }, deleteNotiz(notiz_id){ CoreRESTClient.post('components/stv/Notiz/deleteNotiz/' + notiz_id) .then(response => { @@ -208,16 +216,21 @@ export default { this.$refs.table.reloadTable(); }, resetFormData(){ - this.formData.titel = null; - this.formData.text = null; - this.formData.von = null; - this.formData.bis = null; - this.formData.document = null; - this.formData.erledigt = false; - this.formData.verfasser = null; - this.formData.bearbeiter = null; - this.formData.anhang = []; - //this.formData.anhang = {}; + this.$refs.form.reset(); + //sicherstellen, dass über props nur leere felder übergeben werden + this.formData = { + typeId: 'person', + titel: null, + action: 'Neue Notiz', + text: null, + von: null, + bis: null, + document: null, + erledigt: false, + verfasser: null, + bearbeiter: null, + anhang: [] + }; }, updateNotiz(notiz_id){ CoreRESTClient.post('components/stv/Notiz/updateNotiz/' + notiz_id, @@ -274,6 +287,7 @@ export default {

- parent: {{formData.anhang}} {{formData.typeId}} | {{formData.anhang.name}} +
` From a3f9e19bd68ff893573c4d4354c54a3bbb606c71 Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Tue, 9 Jan 2024 13:22:37 +0100 Subject: [PATCH 088/464] =?UTF-8?q?Noten=20manuell=20=C3=A4ndern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/components/stv/Noten.php | 127 +++++++++++++++++- .../education/Lehrveranstaltung_model.php | 7 + .../models/organisation/Studienplan_model.php | 13 ++ .../Details/Noten/Zeugnis.js | 17 ++- .../Details/Noten/Zeugnis/Actions.js | 54 ++++++++ 5 files changed, 216 insertions(+), 2 deletions(-) create mode 100644 public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis/Actions.js diff --git a/application/controllers/components/stv/Noten.php b/application/controllers/components/stv/Noten.php index 6ba5863c5..dfde2892b 100644 --- a/application/controllers/components/stv/Noten.php +++ b/application/controllers/components/stv/Noten.php @@ -7,13 +7,29 @@ class Noten extends Auth_Controller public function __construct() { parent::__construct([ - 'getZeugnis' => 'student/noten:r' + 'get' => 'student/noten:r', + 'getZeugnis' => 'student/noten:r', + 'update' => ['admin:w', 'assistenz:w'] ]); // Load Libraries $this->load->library('VariableLib', ['uid' => getAuthUID()]); } + public function get() + { + $this->load->model('codex/Note_model', 'NoteModel'); + + $result = $this->NoteModel->addOrder('note'); + + $result = $this->NoteModel->load(); + if (isError($result)) { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + } + + return $this->outputJson($result); + } + public function getZeugnis($prestudent_id) { $this->load->model('crm/Student_model', 'StudentModel'); @@ -40,4 +56,113 @@ class Noten extends Auth_Controller return $this->outputJson($result); } + + public function update() + { + $this->load->model('crm/Student_model', 'StudentModel'); + $this->load->model('organisation/Studienplan_model', 'StudienplanModel'); + $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); + $this->load->model('education/Zeugnisnote_model', 'ZeugnisnoteModel'); + + $this->load->library('form_validation'); + + $_POST = json_decode(utf8_encode($this->input->raw_input_stream), true); + + if (empty($_POST) || !is_array(current($_POST))) { + $result = $this->hasPermissionUpdate($this->input->post('lehrveranstaltung_id'), $this->input->post('student_uid')); + if (isError($result)) { + $this->output->set_status_header(REST_Controller::HTTP_FORBIDDEN); + return $this->outputJson($result); + } + + $this->form_validation->set_rules('lehrveranstaltung_id', 'Lehrverantaltung ID', 'required|numeric'); + $this->form_validation->set_rules('student_uid', 'Student UID', 'required'); + $this->form_validation->set_rules('studiensemester_kurzbz', 'Studiensemester Kurzbezeichnung', 'required'); + $this->form_validation->set_rules('note', 'Note', 'required|numeric'); + $post = [$_POST]; + } else { + foreach ($_POST as $i => $data) { + $lvid = isset($data['lehrveranstaltung_id']) ? $data['lehrveranstaltung_id'] : null; + $uid = isset($data['student_uid']) ? $data['student_uid'] : null; + $result = $this->hasPermissionUpdate($lvid, $uid); + if (isError($result)) { + $this->output->set_status_header(REST_Controller::HTTP_FORBIDDEN); + return $this->outputJson($result); + } + + $this->form_validation->set_rules($i . '[lehrveranstaltung_id]', '#' . $i . ' Lehrverantaltung ID', 'required|numeric'); + $this->form_validation->set_rules($i . '[student_uid]', '#' . $i . ' Student UID', 'required'); + $this->form_validation->set_rules($i . '[studiensemester_kurzbz]', '#' . $i . ' Studiensemester Kurzbezeichnung', 'required'); + $this->form_validation->set_rules($i . '[note]', '#' . $i . ' Note', 'required|numeric'); + } + $post = $_POST; + } + if ($this->form_validation->run() == false) { + $this->output->set_status_header(REST_Controller::HTTP_BAD_REQUEST); + return $this->outputJsonError($this->form_validation->error_array()); + } + + $final_result = success(); + $this->ZeugnisnoteModel->db->trans_start(); + + foreach ($post as $i => $data) { + $note = $data['note']; + unset($data['note']); + $result = $this->ZeugnisnoteModel->update($data, [ + 'note' => $note, + 'benotungsdatum' => date('c'), + 'updateamum' => date('c'), + 'updatevon' => getAuthUID() + ]); + if (isError($result)) { + $final_result = $result; + break; + } + } + + $this->ZeugnisnoteModel->db->trans_complete(); + + if (isError($final_result)) { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + } + + $this->outputJson($final_result); + } + + protected function hasPermissionUpdate($lehrveranstaltung_id, $student_uid) + { + // TODO(chris): error phrases! + if ($lehrveranstaltung_id === null || $student_uid === null) + return success(); + $result = $this->StudentModel->load([$student_uid]); + if (isError($result)) + return $result; + if (!hasData($result)) + return error('Fehler beim Ermitteln des Studenten'); + $student = current(getData($result)); + + if ($this->permissionlib->isBerechtigt('admin', 'suid', $student->studiengang_kz)) + return success(); + if ($this->permissionlib->isBerechtigt('assistenz', 'suid', $student->studiengang_kz)) + return success(); + + $result = $this->StudienplanModel->getAllOesForLv($lehrveranstaltung_id); + if (isError($result)) + return $result; + $oes = getData($result) ?: []; + $result = $this->LehrveranstaltungModel->getStg($lehrveranstaltung_id); + if (isError($result)) + return $result; + if (hasData($result)) + $oes[] = current(getData($result)); + + foreach ($oes as $oe) { + if ($this->permissionlib->isBerechtigt('admin', 'suid', $oe->oe_kurzbz)) + return success(); + if ($this->permissionlib->isBerechtigt('assistenz', 'suid', $oe->oe_kurzbz)) + return success(); + } + + return error('Forbidden'); + } } diff --git a/application/models/education/Lehrveranstaltung_model.php b/application/models/education/Lehrveranstaltung_model.php index 1f1b90131..cefd147b9 100644 --- a/application/models/education/Lehrveranstaltung_model.php +++ b/application/models/education/Lehrveranstaltung_model.php @@ -493,4 +493,11 @@ class Lehrveranstaltung_model extends DB_Model return $this->execQuery($qry, array($student_uid)); } + + public function getStg($lehrveranstaltung_id) + { + $this->addSelect('stg.*'); + $this->addJoin('public.tbl_studiengang stg', 'studiengang_kz'); + return $this->load($lehrveranstaltung_id); + } } diff --git a/application/models/organisation/Studienplan_model.php b/application/models/organisation/Studienplan_model.php index 66ec06ba8..b68f74bd8 100644 --- a/application/models/organisation/Studienplan_model.php +++ b/application/models/organisation/Studienplan_model.php @@ -90,4 +90,17 @@ class Studienplan_model extends DB_Model 'tbl_studienplan_lehrveranstaltung.semester' => $semester )); } + + public function getAllOesForLv($lehrveranstaltung_id) + { + $this->addDistinct('oe_kurzbz'); + + $this->addJoin('lehre.tbl_studienplan_lehrveranstaltung lv', 'studienplan_id'); + $this->addJoin('lehre.tbl_studienordnung', 'studienordnung_id'); + $this->addJoin('public.tbl_studiengang', 'studiengang_kz'); + + return $this->loadWhere([ + 'lv.lehrveranstaltung_id' => $lehrveranstaltung_id + ]); + } } diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis.js b/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis.js index 8dcc52d96..95875f868 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis.js @@ -1,9 +1,11 @@ import {CoreFilterCmpt} from "../../../../filter/Filter.js"; import {CoreRESTClient} from '../../../../../RESTClient.js'; +import ZeugnisActions from './Zeugnis/Actions.js'; export default { components: { - CoreFilterCmpt + CoreFilterCmpt, + ZeugnisActions }, props: { student: Object @@ -51,10 +53,20 @@ export default { ], layout: 'fitDataStretch', height: '100%', + selectable: true, + selectableRangeMode: 'click', persistence: true }; } }, + methods: { + setGrades(selected) { + CoreRESTClient + .post('components/stv/Noten/update', selected) + .then(this.$refs.table.reloadTable) + .catch(this.$fhcAlert.handleFormValidation); + } + }, template: `
Kein Student
@@ -67,6 +79,9 @@ export default { :side-menu="false" reload > +
` }; \ No newline at end of file diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis/Actions.js b/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis/Actions.js new file mode 100644 index 000000000..7e8e2cbe5 --- /dev/null +++ b/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis/Actions.js @@ -0,0 +1,54 @@ +import {CoreRESTClient} from '../../../../../../RESTClient.js'; + +export default { + emits: [ + 'setGrades' + ], + props: { + selected: Array + }, + data() { + return { + grades: [] + }; + }, + computed: { + current: { + get() { + if (!this.selected.length) + return ''; + if (this.selected.length == 1) + return this.selected[0].note; + const grades = Object.keys(this.selected.reduce((a,c) => { + a[c.note] = true; + return a; + }, {})); + if (grades.length == 1) + return grades[0]; + return ''; + }, + set(note) { + this.$emit('setGrades', this.selected.map(zeugnis => { + const { lehrveranstaltung_id, uid: student_uid, studiensemester_kurzbz } = zeugnis; + return { lehrveranstaltung_id, student_uid, studiensemester_kurzbz, note }; + })); + } + } + }, + created() { + CoreRESTClient + .get('components/stv/Noten/get') + .then(result => result.data) + .then(result => { + this.grades = result.retval; + }) + .catch(this.$fhcAlert.handleSystemError); + }, + template: ` +
+ +
` +}; \ No newline at end of file From 284351a0242bd7240fc5760ac4094e847cfea043 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Tue, 9 Jan 2024 16:39:38 +0100 Subject: [PATCH 089/464] bugfix format date vuedatepicker --- .../controllers/components/stv/Notiz.php | 54 ++----------- public/js/components/Notiz/Notiz.js | 78 +++++++------------ .../Studentenverwaltung/Details/Notizen.js | 49 ++++++++---- 3 files changed, 69 insertions(+), 112 deletions(-) diff --git a/application/controllers/components/stv/Notiz.php b/application/controllers/components/stv/Notiz.php index 73c06ba86..f9145bdcc 100644 --- a/application/controllers/components/stv/Notiz.php +++ b/application/controllers/components/stv/Notiz.php @@ -77,8 +77,6 @@ class Notiz extends FHC_Controller $dms_id = []; foreach ($_FILES as $k => $file) { -/* var_dump($file["name"]); - var_dump($file);*/ $dms = array( 'kategorie_kurzbz' => 'notiz', 'version' => 0, @@ -92,7 +90,6 @@ class Notiz extends FHC_Controller if (isSuccess($result)) { - //TODO(Manu) change to array $dms_id[] = $result->retval['dms_id']; } /* else { @@ -117,49 +114,12 @@ class Notiz extends FHC_Controller $erledigt = $_POST['erledigt']; $type = $_POST['typeId']; - /* $start = isset($_POST['bis']) ? ($_POST['bis'] : null; - $ende = isset($_POST['bis']) ? $_POST['bis'] : null;*/ + //get rid of null value error + $start = $this->input->post(date('von')); + $ende = $this->input->post(date('bis')); - - if(isset($_POST['von'])) - { -/* $date = $_POST['von']; - $date = DateTime::createFromFormat('F-d-Y h:i A',$date); - var_dump($date); - $timestamp = strtotime($_POST['von']); - $start = date('Y-m-d', $timestamp);*/ - -/* $dateString = $_POST['von']; - $myDateTime = DateTime::createFromFormat('Y-m-d', $dateString); - $start= $myDateTime->format('Y-m-d');*/ - - //Todo(manu) check input format datepicker.. auch ohne null!!! - $start = '2023-01-01'; - } - else - $start = null; - - - if(isset($_POST['bis'])) - { - //Todo(manu) check input format datepicker -/* $ende = strtotime($_POST['bis']); - $ende = new DateTime($ende); - $ende = $ende->format('Y-m-d');*/ - - $ende = '2023-01-01'; - } - else - $ende = null; - - - //Todo(manu) multiple files - // mit id_type $result = $this->NotizModel->addNotizForType($type, $id, $titel, $text, $uid, $dms_id, $start, $ende, $erledigt, $verfasser_uid, $bearbeiter_uid); - //vorher - //$result = $this->NotizModel->addNotizForPersonWithDoc($id, $titel, $text, $erledigt, $verfasser_uid, $start, $ende, $dms_id); - if (isError($result)) { $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); @@ -172,7 +132,7 @@ class Notiz extends FHC_Controller { $uid = getAuthUID(); $this->load->library('form_validation'); - $_POST = json_decode($this->input->raw_input_stream, true); + //$_POST = json_decode($this->input->raw_input_stream, true); $this->form_validation->set_rules('titel', 'titel', 'required'); $this->form_validation->set_rules('text', 'Text', 'required'); @@ -195,9 +155,11 @@ class Notiz extends FHC_Controller $text = isset($_POST['text']) ? $_POST['text'] : null; $verfasser_uid = isset($_POST['verfasser_uid']) ? $_POST['verfasser_uid'] : null; $bearbeiter_uid = $uid; - $start = isset($_POST['von']) ? new DateTime($_POST['von']) : null; - $ende = isset($_POST['bis']) ? new DateTime($_POST['bis']) : null; $erledigt = $_POST['erledigt']; + $start = $this->input->post(date('von')); + $ende = $this->input->post(date('bis')); + + $result = $this->NotizModel->update( [ diff --git a/public/js/components/Notiz/Notiz.js b/public/js/components/Notiz/Notiz.js index 64430294f..38b1ca22c 100644 --- a/public/js/components/Notiz/Notiz.js +++ b/public/js/components/Notiz/Notiz.js @@ -48,7 +48,8 @@ export default { return this.von; }, set(value) { - this.$emit('update:von', value); + const tempVon = new Date(value).toISOString().split('T')[0]; + this.$emit('update:von', tempVon); } }, intBis: { @@ -56,7 +57,8 @@ export default { return this.bis; }, set(value) { - this.$emit('update:bis', value); + const tempBis = new Date(value).toISOString().split('T')[0]; + this.$emit('update:bis', tempBis); } }, intDocument: { @@ -101,36 +103,11 @@ export default { } } }, -/* mounted(){ - showZuordnung(){ - this.idTyp = 'Person'; - } - },*/ methods: { -/* handleFileChange(event) { - this.intAnhang = event.target.files; - },*/ reset() { this.$refs.form.reset(); //this.$emit('update:anhang', dt.files); }, -/* deleteFile(id){ - //console.log("Delete file with id " + id ); - - //console.log(this.intAnhang[id]); - - const dt = new DataTransfer(); - const files = this.$refs.upload.files; - - for (let i = 0; i < files.length; i++) { - const file = files[i]; - if (id !== i) - dt.items.add(file); // here you exclude the file. thus removing it. - } - - this.$refs.upload.files = dt.files; // Assign the updates list - this.$emit('update:anhang', dt.files); - }*/ }, template: ` @@ -143,9 +120,7 @@ export default { [{{this.typeId}}]
- +
@@ -170,24 +145,7 @@ export default {
- - - +
@@ -196,7 +154,8 @@ export default {
-
+ +
- +
- +
@@ -233,6 +206,7 @@ export default { +
` } diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js index ee203efc6..b6bb9e3ec 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js @@ -28,7 +28,7 @@ export default { columns: [ {title: "Titel", field: "titel"}, {title: "Text", field: "text", width: 350}, - {title: "VerfasserIn", field: "verfasser_uid"}, + {title: "VerfasserIn", field: "verfasser_uid", visible: false}, {title: "BearbeiterIn", field: "bearbeiter_uid", visible: false}, {title: "Start", field: "start", visible: false}, {title: "Ende", field: "ende", visible: false}, @@ -71,7 +71,7 @@ export default { bearbeiter: null, anhang: [] }, - showErweitert: false, + showErweitert: true, showDocument: true, } @@ -105,7 +105,7 @@ export default { }, actionNewNotiz(){ this.resetFormData(); -/* this.formData.typeId = 'person'; + this.formData.typeId = 'person'; this.formData.titel = ''; this.formData.action = 'Neue Notiz2'; this.formData.text = null; @@ -115,7 +115,7 @@ export default { this.formData.erledigt = false; this.formData.verfasser = null; this.formData.bearbeiter = null; - this.formData.anhang = [];*/ + this.formData.anhang = []; }, addNewNotiz(notizData) { /* console.log("here: anhang noch empty"); @@ -134,14 +134,6 @@ export default { }); Object.entries(this.formData.anhang).forEach(([k, v]) => formData.append(k, v)); -/* for( var i = 0; i < this.formData.anhang.length; i++ ){ - let file = this.formData.anhang[i]; - - formData.append('files[' + i + ']', file); - }*/ - -/* console.log("after append"); - console.log(this.formData);*/ CoreRESTClient.post('components/stv/Notiz/addNewNotiz/' + this.modelValue.person_id, formData, { Headers: { "Content-Type": "multipart/form-data" } } @@ -232,7 +224,7 @@ export default { anhang: [] }; }, - updateNotiz(notiz_id){ +/* updateNotiz(notiz_id){ CoreRESTClient.post('components/stv/Notiz/updateNotiz/' + notiz_id, this.formData ).then(response => { @@ -254,6 +246,35 @@ export default { window.scrollTo(0, 0); //this.reload(); }); + },*/ + updateNotiz(notiz_id){ + const formData = new FormData(); + Object.entries(this.formData).forEach(([k, v]) => { + if(k!= 'anhang') + formData.append(k, v); + }); + Object.entries(this.formData.anhang).forEach(([k, v]) => formData.append(k, v)); + + CoreRESTClient.post('components/stv/Notiz/updateNotiz/' + notiz_id, + formData, + { Headers: { "Content-Type": "multipart/form-data" } } + ).then(response => { + if (!response.data.error) { + this.$fhcAlert.alertSuccess('Update von neuer Notiz erfolgreich'); + this.resetFormData(); + this.reload(); + } else { + const errorData = response.data.retval; + Object.entries(errorData).forEach(entry => { + const [key, value] = entry; + this.$fhcAlert.alertError(value); + }); + } + }).catch(error => { + this.$fhcAlert.alertError('Fehler bei Updateroutine aufgetreten'); + }).finally(() => { + window.scrollTo(0, 0); + }); }, }, template: ` @@ -305,7 +326,7 @@ export default { - +
From 751c1fd31ea4c6e1efbe885458b491217d587ebb Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Wed, 10 Jan 2024 14:51:28 +0100 Subject: [PATCH 090/464] Profile Image: Slash removed from path --- public/js/components/Stv/Studentenverwaltung/Details.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/components/Stv/Studentenverwaltung/Details.js b/public/js/components/Stv/Studentenverwaltung/Details.js index 74e54cfe8..d502adc5e 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details.js +++ b/public/js/components/Stv/Studentenverwaltung/Details.js @@ -28,7 +28,7 @@ export default {
- profilbild + profilbild

{{students[0].titlepre}} {{students[0].vorname}} {{students[0].nachname}} {{students[0].titlepost}}

From db6e1add8a1233283e7c8fe913e3ee1fa13f0671 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 11 Jan 2024 07:37:46 +0100 Subject: [PATCH 091/464] refactoring Fkt addNewNotiz --- .../controllers/components/stv/Notiz.php | 70 +++++++++++++++---- application/models/person/Notiz_model.php | 25 ++----- public/js/components/Form/Upload/File.js | 1 + public/js/components/Notiz/Notiz.js | 7 +- .../Studentenverwaltung/Details/Notizen.js | 11 ++- 5 files changed, 75 insertions(+), 39 deletions(-) diff --git a/application/controllers/components/stv/Notiz.php b/application/controllers/components/stv/Notiz.php index f9145bdcc..cdb15d9d3 100644 --- a/application/controllers/components/stv/Notiz.php +++ b/application/controllers/components/stv/Notiz.php @@ -61,20 +61,24 @@ class Notiz extends FHC_Controller public function addNewNotiz($id) { - $this->load->library('form_validation'); + $this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel'); + //$this->load->library('form_validation'); //$_POST = json_decode($this->input->raw_input_stream, true); //TODO(Manu) Validation - $this->form_validation->set_rules('titel', 'titel', 'required'); - $this->form_validation->set_rules('text', 'Text', 'required'); +/* $this->form_validation->set_rules('titel', 'titel', 'required'); + $this->form_validation->set_rules('text', 'Text', 'required');*/ //TODO(Manu) form validation - schon für type hier?, + + //Speichern der Files $this->load->library('DmsLib'); $uid = getAuthUID(); //multiple files - $dms_id = []; + $dms_id_arr = []; + $notiz_id = null; foreach ($_FILES as $k => $file) { $dms = array( @@ -90,7 +94,7 @@ class Notiz extends FHC_Controller if (isSuccess($result)) { - $dms_id[] = $result->retval['dms_id']; + $dms_id_arr[] = $result->retval['dms_id']; } /* else { $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); @@ -104,27 +108,67 @@ class Notiz extends FHC_Controller } + //Speichern der Notiz mit Notizzuordnung $this->load->model('person/Notiz_model', 'NotizModel'); $uid = getAuthUID(); - $titel = isset($_POST['titel']) ? $_POST['titel'] : null; - $text = isset($_POST['text']) ? $_POST['text'] : null; - $bearbeiter_uid = isset($_POST['bearbeiter_uid']) ? $_POST['bearbeiter_uid'] : null; $verfasser_uid = isset($_POST['verfasser_uid']) ? $_POST['verfasser_uid'] : $uid; - $erledigt = $_POST['erledigt']; - $type = $_POST['typeId']; + $titel = $this->input->post('titel'); + $text = $this->input->post('text'); + $bearbeiter_uid = $this->input->post('bearbeiter_uid'); + $erledigt = $this->input->post('erledigt'); + $type = $this->input->post('typeId'); //get rid of null value error $start = $this->input->post(date('von')); $ende = $this->input->post(date('bis')); - $result = $this->NotizModel->addNotizForType($type, $id, $titel, $text, $uid, $dms_id, $start, $ende, $erledigt, $verfasser_uid, $bearbeiter_uid); - + $result = $this->NotizModel->addNotizForType($type, $id, $titel, $text, $uid, $start, $ende, $erledigt, $verfasser_uid, $bearbeiter_uid); if (isError($result)) { $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - return $this->outputJson($result); + return $this->outputJson(getError($result)); } + $notiz_id = $result->retval; + + //Zuordnung speichern +/* $result = $this->NotizzuordnungModel->insert(array('notiz_id' => $notiz_id, $type=> $id)); + if (isError($result)) + { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + return $this->outputJson(getError($result)); + }*/ + + + //Eintrag in Notizdokument speichern + if($dms_id_arr) + { + // Loads model Notizdokument_model + $this->load->model('person/Notizdokument_model', 'NotizdokumentModel'); + //Todo(manu) change for multiple files + foreach($dms_id_arr as $dms_id) + { + $result = $this->NotizdokumentModel->insert(array('notiz_id' => $notiz_id, 'dms_id' => $dms_id)); + if (isError($result)) + { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + return $this->outputJson(getError($result)); + } + } + + } + + + + + //$result = $this->NotizModel->addNotizForType($type, $id, $titel, $text, $uid, $dms_id, $start, $ende, $erledigt, $verfasser_uid, $bearbeiter_uid); +/* + $result = $this->NotizModel->addNotizForPerson($id, $titel, $text, $erledigt, $verfasser_uid); + if (isError($result)) + { + //$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + return $this->outputJson($result); + }*/ return $this->outputJsonSuccess(true); } diff --git a/application/models/person/Notiz_model.php b/application/models/person/Notiz_model.php index 3a4888f38..17cf9a140 100644 --- a/application/models/person/Notiz_model.php +++ b/application/models/person/Notiz_model.php @@ -140,7 +140,7 @@ class Notiz_model extends DB_Model * @param id for Dokumentzuordnung (person_id, prestudent_id, uid, projekt_id...) * @param titel, text, start, ende, erledigt, verfasser_uid, bearbeiter_uid, insertvon Parameter for notiz */ - public function addNotizForType($type, $id, $titel, $text, $insertvon, $dms_id=null, $start=null, $ende=null, $erledigt=false, $verfasser_uid=null, $bearbeiter_uid=null) + public function addNotizForType($type, $id, $titel, $text, $insertvon, $start=null, $ende=null, $erledigt=false, $verfasser_uid=null, $bearbeiter_uid=null) { // Loads model Notizzuordnung_model $this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel'); @@ -153,30 +153,13 @@ class Notiz_model extends DB_Model if (isSuccess($result)) { - //cases für alle types - $notiz_id = $result->retval; - if($dms_id) + if (isSuccess($result)) { - // Loads model Notizdokument_model - $this->load->model('person/Notizdokument_model', 'NotizdokumentModel'); - //Todo(manu) change for multiple files - foreach ($dms_id as $file) - { - $result = $this->NotizdokumentModel->insert(array('notiz_id' => $notiz_id, 'dms_id' => $file)); - } - - //single File - //$result = $this->NotizdokumentModel->insert(array('notiz_id' => $notiz_id, 'dms_id' => $dms_id)); + $notiz_id = $result->retval; + $result = $this->NotizzuordnungModel->insert(array('notiz_id' => $notiz_id, $type => $id)); } - - if ($type == 'person') - $result = $this->NotizzuordnungModel->insert(array('notiz_id' => $notiz_id, 'person_id' => $id)); - elseif ($type == 'prestudent') - $result = $this->NotizzuordnungModel->insert(array('notiz_id' => $notiz_id, 'prestudent_id' => $id)); - else - $result = error($result->msg, "Type nicht vorhanden"); } // Transaction complete! diff --git a/public/js/components/Form/Upload/File.js b/public/js/components/Form/Upload/File.js index 0394afd42..c84996e8d 100644 --- a/public/js/components/Form/Upload/File.js +++ b/public/js/components/Form/Upload/File.js @@ -32,6 +32,7 @@ export default { } }, template: ` + FILES: {{dateien}} diff --git a/public/js/components/Notiz/Notiz.js b/public/js/components/Notiz/Notiz.js index 38b1ca22c..ccbfaa548 100644 --- a/public/js/components/Notiz/Notiz.js +++ b/public/js/components/Notiz/Notiz.js @@ -98,7 +98,7 @@ export default { return this.anhang; }, set(value) { - console.log(value); + //console.log(value); this.$emit('update:anhang', value); } } @@ -106,12 +106,15 @@ export default { methods: { reset() { this.$refs.form.reset(); - //this.$emit('update:anhang', dt.files); + this.intAnhang = null; + this.$emit('update:anhang', []); }, }, template: `
+{{this.intAnhang}} + {{anhang.name}} {{index}}
diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js index b6bb9e3ec..678e3abe1 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js @@ -59,7 +59,7 @@ export default { tabulatorEvents: [], notizen: [], formData: { - typeId: 'person', + typeId: 'person_id', titel: null, action: 'Neue Notiz', text: null, @@ -105,7 +105,7 @@ export default { }, actionNewNotiz(){ this.resetFormData(); - this.formData.typeId = 'person'; + this.formData.typeId = 'person_id'; this.formData.titel = ''; this.formData.action = 'Neue Notiz2'; this.formData.text = null; @@ -134,6 +134,9 @@ export default { }); Object.entries(this.formData.anhang).forEach(([k, v]) => formData.append(k, v)); + console.log(this.formData); + console.log(formData); + CoreRESTClient.post('components/stv/Notiz/addNewNotiz/' + this.modelValue.person_id, formData, { Headers: { "Content-Type": "multipart/form-data" } } @@ -211,7 +214,7 @@ export default { this.$refs.form.reset(); //sicherstellen, dass über props nur leere felder übergeben werden this.formData = { - typeId: 'person', + typeId: 'person_id', titel: null, action: 'Neue Notiz', text: null, @@ -330,6 +333,8 @@ export default {
+ Parent: {{formData.title}} {{formData.anhang}} || {{formData.anhang.name}} + {{anhang.name}} {{index}}
ref: {{formData.ref}}
From ef6634a38e38af2d719947c0ff05730aba492c2f Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 11 Jan 2024 09:56:59 +0100 Subject: [PATCH 092/464] bugfix FileUpload Component --- public/js/components/Form/Upload/File.js | 8 +--- public/js/components/Notiz/Notiz.js | 48 +++++++++---------- .../Studentenverwaltung/Details/Notizen.js | 4 +- 3 files changed, 28 insertions(+), 32 deletions(-) diff --git a/public/js/components/Form/Upload/File.js b/public/js/components/Form/Upload/File.js index c84996e8d..b62cdd788 100644 --- a/public/js/components/Form/Upload/File.js +++ b/public/js/components/Form/Upload/File.js @@ -32,12 +32,8 @@ export default { } }, template: ` - FILES: {{dateien}} - - - - - + + diff --git a/public/js/components/Notiz/Notiz.js b/public/js/components/Notiz/Notiz.js index ccbfaa548..941820405 100644 --- a/public/js/components/Notiz/Notiz.js +++ b/public/js/components/Notiz/Notiz.js @@ -107,37 +107,37 @@ export default { reset() { this.$refs.form.reset(); this.intAnhang = null; - this.$emit('update:anhang', []); + //this.$emit('update:anhang', []); }, }, template: ` -
-{{this.intAnhang}} +
+ {{anhang.name}} {{index}}
- -
-
- {{action}} -
- [{{this.typeId}}] -
-
- -
- -
- -
-
- -
- -
- + +
+
+ {{action}} +
+ [{{this.typeId}}] +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
-
diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js index 678e3abe1..5d618592b 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js @@ -333,8 +333,8 @@ export default {
- Parent: {{formData.title}} {{formData.anhang}} || {{formData.anhang.name}} - {{anhang.name}} {{index}}
ref: {{formData.ref}} +
From 4526c10d304fc134a3ef6408661a57b2f10d47a5 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 11 Jan 2024 12:56:36 +0100 Subject: [PATCH 093/464] temp --- .../controllers/components/stv/Notiz.php | 66 +++++++++++++++++-- application/models/person/Notiz_model.php | 4 ++ .../Studentenverwaltung/Details/Notizen.js | 5 +- 3 files changed, 66 insertions(+), 9 deletions(-) diff --git a/application/controllers/components/stv/Notiz.php b/application/controllers/components/stv/Notiz.php index cdb15d9d3..28dcb33ef 100644 --- a/application/controllers/components/stv/Notiz.php +++ b/application/controllers/components/stv/Notiz.php @@ -48,7 +48,6 @@ class Notiz extends FHC_Controller $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); $this->outputJson($result); } - elseif (!hasData($result)) { $this->outputJson($result); //success mit Wert null // $this->outputJson(getData($result) ?: []); @@ -158,9 +157,6 @@ class Notiz extends FHC_Controller } - - - //$result = $this->NotizModel->addNotizForType($type, $id, $titel, $text, $uid, $dms_id, $start, $ende, $erledigt, $verfasser_uid, $bearbeiter_uid); /* $result = $this->NotizModel->addNotizForPerson($id, $titel, $text, $erledigt, $verfasser_uid); @@ -172,7 +168,7 @@ class Notiz extends FHC_Controller return $this->outputJsonSuccess(true); } - public function updateNotiz($notiz_id) + public function updateNotizOldVersion($notiz_id) { $uid = getAuthUID(); $this->load->library('form_validation'); @@ -205,6 +201,63 @@ class Notiz extends FHC_Controller + $result = $this->NotizModel->update( + [ + 'notiz_id' => $notiz_id + ], + [ + 'titel' => $titel, + 'updatevon' => $uid, + 'updateamum' => date('c'), + 'text' => $text, + 'verfasser_uid' => $verfasser_uid, + 'bearbeiter_uid' => $bearbeiter_uid, + 'start' => $start, + 'ende' => $ende, + 'erledigt' => $erledigt + ] + ); + + if (isError($result)) + { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + return $this->outputJson(getError($result)); + } + return $this->outputJsonSuccess(true); + } + + public function updateNotiz($notiz_id) + { + $uid = getAuthUID(); + $this->load->library('form_validation'); + //$_POST = json_decode($this->input->raw_input_stream, true); + /* $this->form_validation->set_rules('titel', 'titel', 'required'); + $this->form_validation->set_rules('text', 'Text', 'required'); + + if ($this->form_validation->run() == false) + { + return $this->outputJsonError($this->form_validation->error_array()); + }*/ + + $this->load->model('person/Notiz_model', 'NotizModel'); + + if(!$notiz_id) + { + return $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + } + + $uid = getAuthUID(); + $titel = $this->input->post('titel'); + $text = $this->input->post('text'); + $verfasser_uid = isset($_POST['verfasser_uid']) ? $_POST['verfasser_uid'] : null; + $bearbeiter_uid = $uid; + $erledigt = $this->input->post('erledigt'); + $type = $this->input->post('typeId'); + $start = $this->input->post(date('von')); + $ende = $this->input->post(date('bis')); + + + $result = $this->NotizModel->update( [ 'notiz_id' => $notiz_id @@ -298,8 +351,7 @@ class Notiz extends FHC_Controller { $this->load->model('person/Notiz_model', 'NotizModel'); - //TODO(manu) check, ob mehr Dateien bzw. -versionen - //warum nur ein Eintrag??? + $this->NotizModel->addSelect('campus.tbl_dms_version.*'); $this->NotizModel->addJoin('public.tbl_notiz_dokument','ON (public.tbl_notiz_dokument.notiz_id = public.tbl_notiz.notiz_id)'); diff --git a/application/models/person/Notiz_model.php b/application/models/person/Notiz_model.php index 17cf9a140..7e7ffbe32 100644 --- a/application/models/person/Notiz_model.php +++ b/application/models/person/Notiz_model.php @@ -180,6 +180,8 @@ class Notiz_model extends DB_Model return $result; } + + /** * Add a Notiz for a given person with DMS_id */ @@ -244,6 +246,7 @@ class Notiz_model extends DB_Model * @param $person_id */ //Todo(Manu) rewrite in CI-Style + //Todo(Manu) auf andere types erweitern public function getNotizWithDocEntries($id) { $type = 'writeFunction'; @@ -267,6 +270,7 @@ class Notiz_model extends DB_Model notiz_id, z.notizzuordnung_id "; + return $this->execQuery($qry, array($id)); } diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js index 5d618592b..0dd0c9ce0 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js @@ -52,7 +52,7 @@ export default { ], layout: 'fitDataFill', layoutColumnsOnNewData: false, - height: '150', + height: '200', selectable: true, index: 'notiz_id' }, @@ -96,6 +96,7 @@ export default { this.formData.erledigt = this.notizen.erledigt; this.formData.verfasser = this.notizen.verfasser_uid; this.formData.bearbeiter = this.notizen.bearbeiter_uid; + this.formData.anhang = this.notizen.anhang; if(this.notizen.dms_id){ console.log("loadEntries"); this.loadDocEntries(this.notizen.notiz_id); @@ -107,7 +108,7 @@ export default { this.resetFormData(); this.formData.typeId = 'person_id'; this.formData.titel = ''; - this.formData.action = 'Neue Notiz2'; + this.formData.action = 'Neue Notiz'; this.formData.text = null; this.formData.von = null; this.formData.bis = null; From 8d8c25bd6e9b2937ff4acda2e5092cea77545658 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Mon, 15 Jan 2024 09:39:46 +0100 Subject: [PATCH 094/464] =?UTF-8?q?Autocomplete=20Feld=20Mitarbeiter=20f?= =?UTF-8?q?=C3=BCr=20Bearbeiterlogik?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/components/stv/Notiz.php | 142 ++++++++++-------- .../models/ressource/Mitarbeiter_model.php | 22 +++ public/js/components/Form/Upload/File.js | 2 +- public/js/components/Notiz/Notiz.js | 43 ++++-- .../Studentenverwaltung/Details/Notizen.js | 120 ++++++++------- 5 files changed, 197 insertions(+), 132 deletions(-) diff --git a/application/controllers/components/stv/Notiz.php b/application/controllers/components/stv/Notiz.php index 28dcb33ef..507e9ed07 100644 --- a/application/controllers/components/stv/Notiz.php +++ b/application/controllers/components/stv/Notiz.php @@ -48,6 +48,7 @@ class Notiz extends FHC_Controller $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); $this->outputJson($result); } + elseif (!hasData($result)) { $this->outputJson($result); //success mit Wert null // $this->outputJson(getData($result) ?: []); @@ -60,7 +61,10 @@ class Notiz extends FHC_Controller public function addNewNotiz($id) { - $this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel'); + $this->load->model('person/Notiz_model', 'NotizModel'); + + $this->load->library('DmsLib'); + //$this->load->library('form_validation'); //$_POST = json_decode($this->input->raw_input_stream, true); @@ -69,52 +73,14 @@ class Notiz extends FHC_Controller /* $this->form_validation->set_rules('titel', 'titel', 'required'); $this->form_validation->set_rules('text', 'Text', 'required');*/ - //TODO(Manu) form validation - schon für type hier?, - - //Speichern der Files - $this->load->library('DmsLib'); - $uid = getAuthUID(); - - //multiple files - $dms_id_arr = []; - $notiz_id = null; - foreach ($_FILES as $k => $file) - { - $dms = array( - 'kategorie_kurzbz' => 'notiz', - 'version' => 0, - 'name' => $file["name"], - 'mimetype' => $file["type"], - 'insertamum' => date('c'), - 'insertvon' => $uid - ); - - $result = $this->dmslib->upload($dms, $k, array('pdf')); - - if (isSuccess($result)) - { - $dms_id_arr[] = $result->retval['dms_id']; - } -/* else { - $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - - //TODO(manu) error handling - //feedback, dass ein File nicht erfolgreich gespeichert werden konnte - //$this->outputJson($result); - //$this->outputJsonError(['filetype nicht erlaubt' => getError($result)]); - }*/ - - - } - - //Speichern der Notiz mit Notizzuordnung - $this->load->model('person/Notiz_model', 'NotizModel'); + //TODO(Manu) form validation - schon für type hier? + //Speichern der Notiz und Notizzuordnung $uid = getAuthUID(); $verfasser_uid = isset($_POST['verfasser_uid']) ? $_POST['verfasser_uid'] : $uid; $titel = $this->input->post('titel'); $text = $this->input->post('text'); - $bearbeiter_uid = $this->input->post('bearbeiter_uid'); + $bearbeiter_uid = $this->input->post('bearbeiter'); $erledigt = $this->input->post('erledigt'); $type = $this->input->post('typeId'); @@ -130,21 +96,33 @@ class Notiz extends FHC_Controller } $notiz_id = $result->retval; - //Zuordnung speichern -/* $result = $this->NotizzuordnungModel->insert(array('notiz_id' => $notiz_id, $type=> $id)); - if (isError($result)) + //Speichern der Files + $dms_id_arr = []; + foreach ($_FILES as $k => $file) { - $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - return $this->outputJson(getError($result)); - }*/ + $dms = array( + 'kategorie_kurzbz' => 'notiz', + 'version' => 0, + 'name' => $file["name"], + 'mimetype' => $file["type"], + 'insertamum' => date('c'), + 'insertvon' => $uid + ); + $result = $this->dmslib->upload($dms, $k, array('pdf')); + if (isError($result)) + { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + return $this->outputJson(getError($result)); + } + $dms_id_arr[] = $result->retval['dms_id']; + } //Eintrag in Notizdokument speichern if($dms_id_arr) { // Loads model Notizdokument_model $this->load->model('person/Notizdokument_model', 'NotizdokumentModel'); - //Todo(manu) change for multiple files foreach($dms_id_arr as $dms_id) { $result = $this->NotizdokumentModel->insert(array('notiz_id' => $notiz_id, 'dms_id' => $dms_id)); @@ -154,17 +132,8 @@ class Notiz extends FHC_Controller return $this->outputJson(getError($result)); } } - } - //$result = $this->NotizModel->addNotizForType($type, $id, $titel, $text, $uid, $dms_id, $start, $ende, $erledigt, $verfasser_uid, $bearbeiter_uid); -/* - $result = $this->NotizModel->addNotizForPerson($id, $titel, $text, $erledigt, $verfasser_uid); - if (isError($result)) - { - //$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - return $this->outputJson($result); - }*/ return $this->outputJsonSuccess(true); } @@ -228,8 +197,15 @@ class Notiz extends FHC_Controller public function updateNotiz($notiz_id) { - $uid = getAuthUID(); + var_dump("in function updateNotiz " . $notiz_id); + //Loads Libraries $this->load->library('form_validation'); + $this->load->library('DmsLib'); + + // Loads models + $this->load->model('person/Notiz_model', 'NotizModel'); + $this->load->model('person/Notizdokument_model', 'NotizdokumentModel'); + //$_POST = json_decode($this->input->raw_input_stream, true); /* $this->form_validation->set_rules('titel', 'titel', 'required'); $this->form_validation->set_rules('text', 'Text', 'required'); @@ -239,25 +215,22 @@ class Notiz extends FHC_Controller return $this->outputJsonError($this->form_validation->error_array()); }*/ - $this->load->model('person/Notiz_model', 'NotizModel'); - if(!$notiz_id) { return $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); } + //update Notiz $uid = getAuthUID(); $titel = $this->input->post('titel'); $text = $this->input->post('text'); $verfasser_uid = isset($_POST['verfasser_uid']) ? $_POST['verfasser_uid'] : null; - $bearbeiter_uid = $uid; + $bearbeiter_uid = isset($_POST['bearbeiter']) ? $_POST['bearbeiter'] : $uid; $erledigt = $this->input->post('erledigt'); $type = $this->input->post('typeId'); $start = $this->input->post(date('von')); $ende = $this->input->post(date('bis')); - - $result = $this->NotizModel->update( [ 'notiz_id' => $notiz_id @@ -274,12 +247,40 @@ class Notiz extends FHC_Controller 'erledigt' => $erledigt ] ); - if (isError($result)) { $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); return $this->outputJson(getError($result)); } + + //neue Files speichern + //Todo(manu) check, welche files neu sind.. + foreach ($_FILES as $k => $file) + { + $dms = array( + 'kategorie_kurzbz' => 'notiz', + 'version' => 0, + 'name' => $file["name"], + 'mimetype' => $file["type"], + 'insertamum' => date('c'), + 'insertvon' => $uid + ); + + $result = $this->dmslib->upload($dms, $k, array('pdf')); + if (isError($result)) + { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + return $this->outputJson(getError($result)); + } + $dms_id = $result->retval['dms_id']; + + $result = $this->NotizdokumentModel->insert(array('notiz_id' => $notiz_id, 'dms_id' => $dms_id)); + if (isError($result)) + { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + return $this->outputJson(getError($result)); + } + } return $this->outputJsonSuccess(true); } @@ -374,4 +375,15 @@ class Notiz extends FHC_Controller } } + public function getMitarbeiter($searchString) + { + $this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel'); + + $result = $this->MitarbeiterModel->searchMitarbeiter($searchString); + if (isError($result)) { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + } + $this->outputJson($result); + } + } \ No newline at end of file diff --git a/application/models/ressource/Mitarbeiter_model.php b/application/models/ressource/Mitarbeiter_model.php index 90c30927f..1e3fde502 100644 --- a/application/models/ressource/Mitarbeiter_model.php +++ b/application/models/ressource/Mitarbeiter_model.php @@ -202,4 +202,26 @@ class Mitarbeiter_model extends DB_Model } return success($kurzbz); } + + public function searchMitarbeiter($filter) + { + $filter = strtoLower($filter); + $qry = " + SELECT + ma.mitarbeiter_uid, CONCAT(p.nachname, ' ', p.vorname, ' (', ma.mitarbeiter_uid , ')') as mitarbeiter + FROM + public.tbl_mitarbeiter ma + JOIN + public.tbl_benutzer b on (ma.mitarbeiter_uid = b.uid) + JOIN + public.tbl_person p on (p.person_id = b.person_id) + WHERE + lower (p.nachname) LIKE '%". $this->db->escape_like_str($filter)."%' + OR + lower (p.vorname) LIKE '%". $this->db->escape_like_str($filter)."%' + OR + (ma.mitarbeiter_uid) LIKE '%". $this->db->escape_like_str($filter)."%'"; + + return $this->execQuery($qry); + } } diff --git a/public/js/components/Form/Upload/File.js b/public/js/components/Form/Upload/File.js index b62cdd788..6881c8e67 100644 --- a/public/js/components/Form/Upload/File.js +++ b/public/js/components/Form/Upload/File.js @@ -39,7 +39,7 @@ export default {
  • - +
diff --git a/public/js/components/Notiz/Notiz.js b/public/js/components/Notiz/Notiz.js index 941820405..660404f7c 100644 --- a/public/js/components/Notiz/Notiz.js +++ b/public/js/components/Notiz/Notiz.js @@ -1,10 +1,13 @@ import VueDatePicker from '../vueDatepicker.js.php'; +import PvAutoComplete from "../../../../index.ci.php/public/js/components/primevue/autocomplete/autocomplete.esm.min.js"; import File from '../Form/Upload/File.js'; +import {CoreRESTClient} from "../../RESTClient"; export default { components: { VueDatePicker, - File + File, + PvAutoComplete }, props: [ 'typeId', @@ -12,7 +15,7 @@ export default { 'text', 'von', 'bis', - 'action', + 'statusNew', 'document', 'erledigt', 'verfasser', @@ -23,7 +26,10 @@ export default { ], data(){ return { - multiupload: true + multiupload: true, + mitarbeiter: [], + filteredMitarbeiter: [], + filteredFirmen: [] } }, computed: { @@ -90,7 +96,12 @@ export default { return this.bearbeiter; }, set(value) { - this.$emit('update:bearbeiter', value); + if(value) + { + this.$emit('update:bearbeiter', value.mitarbeiter_uid); + } + else + this.$emit('update:bearbeiter', value); } }, intAnhang: { @@ -109,11 +120,19 @@ export default { this.intAnhang = null; //this.$emit('update:anhang', []); }, + + search(event) { + return CoreRESTClient + .get('components/stv/Notiz/getMitarbeiter/' + event.query) + .then(result => { + //console.log(result); + this.filteredMitarbeiter = CoreRESTClient.getData(result.data); + }); + }, }, template: `
- {{anhang.name}} {{index}}
@@ -156,9 +175,9 @@ export default {
- + -
-
--> - + +
+
@@ -203,7 +224,7 @@ export default {
- +
diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js index 0dd0c9ce0..ba82b2628 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js @@ -15,7 +15,7 @@ export default { CoreRESTClient, CoreFilterCmpt, Notiz, - BsModal, + BsModal }, props: { modelValue: Object @@ -32,7 +32,7 @@ export default { {title: "BearbeiterIn", field: "bearbeiter_uid", visible: false}, {title: "Start", field: "start", visible: false}, {title: "Ende", field: "ende", visible: false}, -/* {title: "Dokumente", field: "dms_id"},*/ + /* {title: "Dokumente", field: "dms_id"},*/ {title: "Dokumente", field: "countdoc"}, {title: "Erledigt", field: "erledigt"}, {title: "Notiz_id", field: "notiz_id", visible: false}, @@ -58,10 +58,11 @@ export default { }, tabulatorEvents: [], notizen: [], + filteredMitarbeiter: [], formData: { typeId: 'person_id', titel: null, - action: 'Neue Notiz', + statusNew: true, text: null, von: null, bis: null, @@ -73,7 +74,6 @@ export default { }, showErweitert: true, showDocument: true, - } }, methods:{ @@ -88,7 +88,7 @@ export default { this.loadNotiz(notiz_id).then(() => { if(this.notizen.notiz_id) { this.formData.titel = this.notizen.titel; - this.formData.action = 'Notiz bearbeiten'; + this.formData.statusNew = false; this.formData.text = this.notizen.text; this.formData.von = this.notizen.start; this.formData.bis = this.notizen.ende; @@ -96,19 +96,22 @@ export default { this.formData.erledigt = this.notizen.erledigt; this.formData.verfasser = this.notizen.verfasser_uid; this.formData.bearbeiter = this.notizen.bearbeiter_uid; - this.formData.anhang = this.notizen.anhang; - if(this.notizen.dms_id){ - console.log("loadEntries"); - this.loadDocEntries(this.notizen.notiz_id); - } } - }); + }) + .then(() => { + if(this.notizen.dms_id){ + console.log("loadEntries with " + this.notizen.notiz_id); + this.loadDocEntries(this.notizen.notiz_id); + //console.log(this.formData.anhang); + } + }) + ; }, actionNewNotiz(){ this.resetFormData(); this.formData.typeId = 'person_id'; this.formData.titel = ''; - this.formData.action = 'Neue Notiz'; + this.formData.statusNew = false; this.formData.text = null; this.formData.von = null; this.formData.bis = null; @@ -119,13 +122,13 @@ export default { this.formData.anhang = []; }, addNewNotiz(notizData) { -/* console.log("here: anhang noch empty"); - console.log(this.formData);*/ + /* console.log("here: anhang noch empty"); + console.log(this.formData);*/ const formData = new FormData(); //working with single files - // Object.entries(this.formData).forEach(([k, v]) => formData.append(k, v)); + // Object.entries(this.formData).forEach(([k, v]) => formData.append(k, v)); //multiple files //console.log(this.formData.anhang); @@ -134,9 +137,9 @@ export default { formData.append(k, v); }); Object.entries(this.formData.anhang).forEach(([k, v]) => formData.append(k, v)); - +/* console.log(this.formData); - console.log(formData); + console.log(formData);*/ CoreRESTClient.post('components/stv/Notiz/addNewNotiz/' + this.modelValue.person_id, formData, @@ -179,9 +182,11 @@ export default { return CoreRESTClient.get('components/stv/Notiz/loadDokumente/' + notiz_id) .then( result => { - console.log(result.data); - if(result.data.retval) + //console.log(result.data); + if(result.data.retval) { this.formData.anhang = result.data.retval; + console.log(this.formData.anhang); + } else { this.formData.anhang = {}; @@ -197,7 +202,7 @@ export default { result => { if(result.data.retval) { this.notizen = result.data.retval; - + console.log(this.notizen); } else { @@ -216,55 +221,59 @@ export default { //sicherstellen, dass über props nur leere felder übergeben werden this.formData = { typeId: 'person_id', - titel: null, - action: 'Neue Notiz', - text: null, - von: null, - bis: null, - document: null, - erledigt: false, - verfasser: null, - bearbeiter: null, - anhang: [] + titel: null, + statusNew: true, + text: null, + von: null, + bis: null, + document: null, + erledigt: false, + verfasser: null, + bearbeiter: null, + anhang: [] }; }, -/* updateNotiz(notiz_id){ - CoreRESTClient.post('components/stv/Notiz/updateNotiz/' + notiz_id, - this.formData - ).then(response => { - if (!response.data.error) { - this.$fhcAlert.alertSuccess('Update erfolgreich'); - this.resetFormData(); - this.reload(); - } else { - const errorData = response.data.retval; - Object.entries(errorData).forEach(entry => { - const [key, value] = entry; - this.$fhcAlert.alertError(value); + /* updateNotiz(notiz_id){ + CoreRESTClient.post('components/stv/Notiz/updateNotiz/' + notiz_id, + this.formData + ).then(response => { + if (!response.data.error) { + this.$fhcAlert.alertSuccess('Update erfolgreich'); + this.resetFormData(); + this.reload(); + } else { + const errorData = response.data.retval; + Object.entries(errorData).forEach(entry => { + const [key, value] = entry; + this.$fhcAlert.alertError(value); + }); + } + }).catch(error => { + this.statusMsg = 'Error in Catch'; + this.$fhcAlert.alertError('Fehler bei Updateroutine aufgetreten'); + }).finally(() => { + window.scrollTo(0, 0); + //this.reload(); }); - } - }).catch(error => { - this.statusMsg = 'Error in Catch'; - this.$fhcAlert.alertError('Fehler bei Updateroutine aufgetreten'); - }).finally(() => { - window.scrollTo(0, 0); - //this.reload(); - }); - },*/ + },*/ updateNotiz(notiz_id){ const formData = new FormData(); + + Object.entries(this.formData).forEach(([k, v]) => { if(k!= 'anhang') formData.append(k, v); }); Object.entries(this.formData.anhang).forEach(([k, v]) => formData.append(k, v)); + console.log(this.formData); + //warum geht das nicht analog? wie kann titel = null sein? CoreRESTClient.post('components/stv/Notiz/updateNotiz/' + notiz_id, formData, { Headers: { "Content-Type": "multipart/form-data" } } ).then(response => { if (!response.data.error) { - this.$fhcAlert.alertSuccess('Update von neuer Notiz erfolgreich'); + this.$fhcAlert.alertSuccess('Update von Notiz erfolgreich'); this.resetFormData(); this.reload(); } else { @@ -318,7 +327,7 @@ export default { v-model:typeId="formData.typeId" v-model:titel="formData.titel" v-model:text="formData.text" - v-model:action="formData.action" + v-model:statusNew="formData.statusNew" v-model:von="formData.von" v-model:bis="formData.bis" v-model:document="formData.document" @@ -329,11 +338,12 @@ export default { > - +
+ parent: {{formData.bearbeiter}} From 61616fbaefacd0abece97545bc0838eb44659f99 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Mon, 15 Jan 2024 13:56:17 +0100 Subject: [PATCH 095/464] Update AppendForm mit JSON.stringify, Update Form, authUid --- .../controllers/components/stv/Notiz.php | 52 ++++++++++-- public/js/components/Notiz/Notiz.js | 40 ++++----- .../Studentenverwaltung/Details/Notizen.js | 82 ++++++------------- 3 files changed, 89 insertions(+), 85 deletions(-) diff --git a/application/controllers/components/stv/Notiz.php b/application/controllers/components/stv/Notiz.php index 507e9ed07..494b1fdbf 100644 --- a/application/controllers/components/stv/Notiz.php +++ b/application/controllers/components/stv/Notiz.php @@ -19,6 +19,24 @@ class Notiz extends FHC_Controller ]); } + public function getUid() + { + // Load Libraries + $this->load->library('AuthLib'); + $this->load->library('VariableLib', ['uid' => getAuthUID()]); + $result = getAuthUid(); + $this->outputJsonError($result); + + // $this->outputJson(getData($result)); + +/* if (isError($result)) { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + $this->outputJson(getError($result)); + } else { + $this->outputJson($result); + }*/ + } + public function getNotizen($person_id) { $this->load->model('person/Notiz_model', 'NotizModel'); @@ -74,19 +92,26 @@ class Notiz extends FHC_Controller $this->form_validation->set_rules('text', 'Text', 'required');*/ //TODO(Manu) form validation - schon für type hier? - //Speichern der Notiz und Notizzuordnung $uid = getAuthUID(); - $verfasser_uid = isset($_POST['verfasser_uid']) ? $_POST['verfasser_uid'] : $uid; + + if (isset($_POST['data'])) + { + $data = json_decode($_POST['data']); + unset($_POST['data']); + foreach ($data as $k => $v) { + $_POST[$k] = $v; + } + } + $titel = $this->input->post('titel'); $text = $this->input->post('text'); - $bearbeiter_uid = $this->input->post('bearbeiter'); $erledigt = $this->input->post('erledigt'); + $verfasser_uid = isset($_POST['verfasser_uid']) ? $_POST['verfasser_uid'] : $uid; + $bearbeiter_uid = isset($_POST['bearbeiter']) ? $_POST['bearbeiter'] : null; $type = $this->input->post('typeId'); - - //get rid of null value error - $start = $this->input->post(date('von')); - $ende = $this->input->post(date('bis')); + $start = $this->input->post('von'); + $ende = $this->input->post('bis'); $result = $this->NotizModel->addNotizForType($type, $id, $titel, $text, $uid, $start, $ende, $erledigt, $verfasser_uid, $bearbeiter_uid); if (isError($result)) @@ -215,6 +240,15 @@ class Notiz extends FHC_Controller return $this->outputJsonError($this->form_validation->error_array()); }*/ + if (isset($_POST['data'])) + { + $data = json_decode($_POST['data']); + unset($_POST['data']); + foreach ($data as $k => $v) { + $_POST[$k] = $v; + } + } + if(!$notiz_id) { return $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); @@ -228,8 +262,8 @@ class Notiz extends FHC_Controller $bearbeiter_uid = isset($_POST['bearbeiter']) ? $_POST['bearbeiter'] : $uid; $erledigt = $this->input->post('erledigt'); $type = $this->input->post('typeId'); - $start = $this->input->post(date('von')); - $ende = $this->input->post(date('bis')); + $start = $this->input->post('von'); + $ende = $this->input->post('bis'); $result = $this->NotizModel->update( [ diff --git a/public/js/components/Notiz/Notiz.js b/public/js/components/Notiz/Notiz.js index 660404f7c..46b6a6992 100644 --- a/public/js/components/Notiz/Notiz.js +++ b/public/js/components/Notiz/Notiz.js @@ -88,7 +88,8 @@ export default { return this.verfasser; }, set(value) { - this.$emit('update:verfasser', value); + //this.$emit('update:verfasser', value); + this.$emit('update:verfasser', value.mitarbeiter_uid); } }, intBearbeiter: { @@ -179,24 +180,12 @@ export default {
-
- - {{uid}} -
-
- -
- -
- - +
+
-
- -
- -
+ +
+
+
+ +
+ +
+
- + -
+
+ +
+ +
- +
diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js index ba82b2628..f88ce0627 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js @@ -7,7 +7,7 @@ var editIcon = function (cell, formatterParams) { return ""; }; var deleteIcon = function (cell, formatterParams){ - return ""; + return ""; }; export default { @@ -28,13 +28,13 @@ export default { columns: [ {title: "Titel", field: "titel"}, {title: "Text", field: "text", width: 350}, - {title: "VerfasserIn", field: "verfasser_uid", visible: false}, + {title: "VerfasserIn", field: "verfasser_uid"}, {title: "BearbeiterIn", field: "bearbeiter_uid", visible: false}, {title: "Start", field: "start", visible: false}, {title: "Ende", field: "ende", visible: false}, /* {title: "Dokumente", field: "dms_id"},*/ {title: "Dokumente", field: "countdoc"}, - {title: "Erledigt", field: "erledigt"}, + {title: "Erledigt", field: "erledigt", visible: false}, {title: "Notiz_id", field: "notiz_id", visible: false}, {title: "Notizzuordnung_id", field: "notizzuordnung_id", visible: false}, { @@ -58,6 +58,8 @@ export default { }, tabulatorEvents: [], notizen: [], + uid: '', + intVerfasser: '', filteredMitarbeiter: [], formData: { typeId: 'person_id', @@ -68,12 +70,13 @@ export default { bis: null, document: null, erledigt: false, - verfasser: null, + verfasser: this.uid, bearbeiter: null, anhang: [] }, showErweitert: true, - showDocument: true, + showDocument: true + } }, methods:{ @@ -111,35 +114,22 @@ export default { this.resetFormData(); this.formData.typeId = 'person_id'; this.formData.titel = ''; - this.formData.statusNew = false; + this.formData.statusNew = true; this.formData.text = null; this.formData.von = null; this.formData.bis = null; this.formData.document = null; this.formData.erledigt = false; - this.formData.verfasser = null; + this.formData.verfasser = this.uid; this.formData.bearbeiter = null; this.formData.anhang = []; }, addNewNotiz(notizData) { - /* console.log("here: anhang noch empty"); - console.log(this.formData);*/ const formData = new FormData(); - //working with single files - // Object.entries(this.formData).forEach(([k, v]) => formData.append(k, v)); - - //multiple files - //console.log(this.formData.anhang); - Object.entries(this.formData).forEach(([k, v]) => { - if(k!= 'anhang') - formData.append(k, v); - }); + formData.append('data', JSON.stringify(this.formData)); Object.entries(this.formData.anhang).forEach(([k, v]) => formData.append(k, v)); -/* - console.log(this.formData); - console.log(formData);*/ CoreRESTClient.post('components/stv/Notiz/addNewNotiz/' + this.modelValue.person_id, formData, @@ -228,46 +218,18 @@ export default { bis: null, document: null, erledigt: false, - verfasser: null, + verfasser: this.uid, bearbeiter: null, anhang: [] }; }, - /* updateNotiz(notiz_id){ - CoreRESTClient.post('components/stv/Notiz/updateNotiz/' + notiz_id, - this.formData - ).then(response => { - if (!response.data.error) { - this.$fhcAlert.alertSuccess('Update erfolgreich'); - this.resetFormData(); - this.reload(); - } else { - const errorData = response.data.retval; - Object.entries(errorData).forEach(entry => { - const [key, value] = entry; - this.$fhcAlert.alertError(value); - }); - } - }).catch(error => { - this.statusMsg = 'Error in Catch'; - this.$fhcAlert.alertError('Fehler bei Updateroutine aufgetreten'); - }).finally(() => { - window.scrollTo(0, 0); - //this.reload(); - }); - },*/ updateNotiz(notiz_id){ const formData = new FormData(); - - Object.entries(this.formData).forEach(([k, v]) => { - if(k!= 'anhang') - formData.append(k, v); - }); + formData.append('data', JSON.stringify(this.formData)); Object.entries(this.formData.anhang).forEach(([k, v]) => formData.append(k, v)); - console.log(this.formData); + //console.log(this.formData); - //warum geht das nicht analog? wie kann titel = null sein? CoreRESTClient.post('components/stv/Notiz/updateNotiz/' + notiz_id, formData, { Headers: { "Content-Type": "multipart/form-data" } } @@ -290,6 +252,17 @@ export default { }); }, }, + created(){ + CoreRESTClient + .get('components/stv/Notiz/getUid') + .then(result => { + if(result.data.retval) { + this.formData.verfasser = result.data.retval; + } + }) + .catch(this.$fhcAlert.handleSystemError); + }, + computed: { }, template: `
@@ -343,10 +316,7 @@ export default {
- parent: {{formData.bearbeiter}} - - +
` From 20edb299a76ecadd6daa12dda7c0227a94d7e72e Mon Sep 17 00:00:00 2001 From: ma0068 Date: Mon, 15 Jan 2024 14:05:34 +0100 Subject: [PATCH 096/464] Form validation --- .../controllers/components/stv/Notiz.php | 47 +++++++++---------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/application/controllers/components/stv/Notiz.php b/application/controllers/components/stv/Notiz.php index 494b1fdbf..197ec06d3 100644 --- a/application/controllers/components/stv/Notiz.php +++ b/application/controllers/components/stv/Notiz.php @@ -82,17 +82,8 @@ class Notiz extends FHC_Controller $this->load->model('person/Notiz_model', 'NotizModel'); $this->load->library('DmsLib'); + $this->load->library('form_validation'); - //$this->load->library('form_validation'); - //$_POST = json_decode($this->input->raw_input_stream, true); - - //TODO(Manu) Validation - -/* $this->form_validation->set_rules('titel', 'titel', 'required'); - $this->form_validation->set_rules('text', 'Text', 'required');*/ - - //TODO(Manu) form validation - schon für type hier? - //Speichern der Notiz und Notizzuordnung $uid = getAuthUID(); if (isset($_POST['data'])) @@ -104,6 +95,15 @@ class Notiz extends FHC_Controller } } + //Form Validation + $this->form_validation->set_rules('titel', 'titel', 'required'); + $this->form_validation->set_rules('text', 'Text', 'required'); + + if ($this->form_validation->run() == false) + { + return $this->outputJsonError($this->form_validation->error_array()); + } + $titel = $this->input->post('titel'); $text = $this->input->post('text'); $erledigt = $this->input->post('erledigt'); @@ -113,6 +113,7 @@ class Notiz extends FHC_Controller $start = $this->input->post('von'); $ende = $this->input->post('bis'); + //Speichern der Notiz und Notizzuordnung $result = $this->NotizModel->addNotizForType($type, $id, $titel, $text, $uid, $start, $ende, $erledigt, $verfasser_uid, $bearbeiter_uid); if (isError($result)) { @@ -222,23 +223,11 @@ class Notiz extends FHC_Controller public function updateNotiz($notiz_id) { - var_dump("in function updateNotiz " . $notiz_id); - //Loads Libraries - $this->load->library('form_validation'); - $this->load->library('DmsLib'); - - // Loads models $this->load->model('person/Notiz_model', 'NotizModel'); $this->load->model('person/Notizdokument_model', 'NotizdokumentModel'); - //$_POST = json_decode($this->input->raw_input_stream, true); - /* $this->form_validation->set_rules('titel', 'titel', 'required'); - $this->form_validation->set_rules('text', 'Text', 'required'); - - if ($this->form_validation->run() == false) - { - return $this->outputJsonError($this->form_validation->error_array()); - }*/ + $this->load->library('form_validation'); + $this->load->library('DmsLib'); if (isset($_POST['data'])) { @@ -254,6 +243,15 @@ class Notiz extends FHC_Controller return $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); } + //Form Validation + $this->form_validation->set_rules('titel', 'titel', 'required'); + $this->form_validation->set_rules('text', 'Text', 'required'); + + if ($this->form_validation->run() == false) + { + return $this->outputJsonError($this->form_validation->error_array()); + } + //update Notiz $uid = getAuthUID(); $titel = $this->input->post('titel'); @@ -288,7 +286,6 @@ class Notiz extends FHC_Controller } //neue Files speichern - //Todo(manu) check, welche files neu sind.. foreach ($_FILES as $k => $file) { $dms = array( From 70d7496ed9982c54f48af051f25babc2d4b8626a Mon Sep 17 00:00:00 2001 From: ma0068 Date: Mon, 15 Jan 2024 14:54:24 +0100 Subject: [PATCH 097/464] =?UTF-8?q?bei=20L=C3=B6schen=20von=20Notiz=20Entf?= =?UTF-8?q?ernen=20aller=20DMS-=20und=20Eintr=C3=A4ge=20in=20Notizdokument?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/components/stv/Notiz.php | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/application/controllers/components/stv/Notiz.php b/application/controllers/components/stv/Notiz.php index 197ec06d3..2356f8bf1 100644 --- a/application/controllers/components/stv/Notiz.php +++ b/application/controllers/components/stv/Notiz.php @@ -318,7 +318,7 @@ class Notiz extends FHC_Controller public function deleteNotiz ($notiz_id) { //dms_id auslesen aus notizdokument wenn vorhanden - $dms_id = null; + $dms_id_arr = []; $this->load->model('person/Notizdokument_model', 'NotizdokumentModel'); $result = $this->NotizdokumentModel->loadWhere(array('notiz_id' => $notiz_id)); @@ -326,35 +326,36 @@ class Notiz extends FHC_Controller if (isError($result)) { $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - $this->outputJson($result); + $this->outputJson(getError($result)); } elseif (!hasData($result)) { $this->outputJson($result); - $dms_id = null; + //$dms_id_arr = []; } else { - //Todo(manu( umbau auf array) - $result = current(getData($result)); - $dms_id = $result->dms_id; + $result = getData($result); + foreach($result as $doc) { + $dms_id_arr[] = $doc->dms_id; + } } - if($dms_id) + if($dms_id_arr) { $this->load->library('DmsLib'); - $result = $this->dmslib->removeAll($dms_id); - - if (isError($result)) + foreach($dms_id_arr as $dms_id) { - $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - $this->outputJson($result); + $result = $this->dmslib->removeAll($dms_id); + + if (isError($result)) + { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + return $this->outputJson(getError($result)); + } + else + $this->outputJson($result); } - else - $this->outputJson($result); - - //return $this->outputJsonSuccess(current(getData($result))); - } From 09c02b0906d4f9c5b5a949f52c2868aeeabaf156 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Mon, 15 Jan 2024 15:29:04 +0100 Subject: [PATCH 098/464] refactoring controllers, codesniffer --- .../controllers/components/stv/Kontakt.php | 117 ++++++------------ .../controllers/components/stv/Notiz.php | 78 +----------- 2 files changed, 46 insertions(+), 149 deletions(-) diff --git a/application/controllers/components/stv/Kontakt.php b/application/controllers/components/stv/Kontakt.php index 5ed9bc9ef..d8ed352f6 100644 --- a/application/controllers/components/stv/Kontakt.php +++ b/application/controllers/components/stv/Kontakt.php @@ -42,7 +42,6 @@ class Kontakt extends FHC_Controller } } - //old version public function addNewAddress($person_id) { $this->load->library('form_validation'); @@ -58,6 +57,16 @@ class Kontakt extends FHC_Controller $this->load->model('person/Adresse_model', 'AdresseModel'); $uid = getAuthUID(); +/* $person_id = $this->input->post('$person_id'); + $co_name = $this->input->post('co_name'); + $strasse = $this->input->post('strasse'); + $ort = $this->input->post('ort'); + $gemeinde = $this->input->post('gemeinde'); + $nation = $this->input->post('nation'); + $name = $this->input->post('name'); + $typ = $this->input->post('typ'); + $anmerkung = $this->input->post('anmerkung');*/ + $co_name = isset($_POST['co_name']) ? $_POST['co_name'] : null; $strasse = isset($_POST['strasse']) ? $_POST['strasse'] : null; $ort = isset($_POST['ort']) ? $_POST['ort'] : null; @@ -98,68 +107,11 @@ class Kontakt extends FHC_Controller if (isError($result)) { $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - return $this->outputJson($result); + return $this->outputJson(getError($result)); } return $this->outputJsonSuccess(true); } - //Version mit input->post() TODO(Manu) check mit Chris, not working -/* public function addNewAddress($person_id) - { - $this->load->library('form_validation'); - //$_POST = json_decode($this->input->raw_input_stream, true); - - - $this->load->model('person/Adresse_model', 'AdresseModel'); - - $uid = getAuthUID(); - - $data = [ - 'insertvon' => $uid, - 'insertamum' => date('c'), - 'plz' => $this->input->post('plz'), - 'heimatadresse' => $this->input->post('heimatadresse'), - 'zustelladresse' => $this->input->post('zustelladresse'), - 'rechnungsadresse' => $this->input->post('rechnungsadresse') - ]; - - - $this->form_validation->set_rules('plz', 'PLZ', 'required|numeric'); - - if ($this->form_validation->run() == false) - { - return $this->outputJsonError($this->form_validation->error_array()); - } - - - if ($this->input->post('co_name')) - $data['co_name'] = $this->input->post('co_name'); - if ($this->input->post('strasse')) - $data['strasse'] = $this->input->post('strasse'); - if ($this->input->post('ort')) - $data['ort'] = $this->input->post('ort'); - if ($this->input->post('gemeinde')) - $data['gemeinde'] = $this->input->post('gemeinde'); - if ($this->input->post('nation')) - $data['nation'] = $this->input->post('nation'); - if ($this->input->post('name')) - $data['name'] = $this->input->post('name'); - if ($this->input->post('typ')) - $data['typ'] = $this->input->post('typ'); - if ($this->input->post('anmerkung')) - $data['anmerkung'] = $this->input->post('anmerkung'); - if ($this->input->post('firma')) - $data['firma_id'] = $this->input->post('firma_id'); - - $result = $this->AdresseModel->insert($data); - if (isError($result)) - { - $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - return $this->outputJson($result); - } - return $this->outputJsonSuccess(true); - }*/ - public function updateAddress($address_id) { $uid = getAuthUID(); @@ -187,6 +139,8 @@ class Kontakt extends FHC_Controller else $firma_id = null; + + $person_id = isset($_POST['person_id']) ? $_POST['person_id'] : null; $co_name = isset($_POST['co_name']) ? $_POST['co_name'] : null; $strasse = isset($_POST['strasse']) ? $_POST['strasse'] : null; @@ -197,6 +151,16 @@ class Kontakt extends FHC_Controller $typ = isset($_POST['typ']) ? $_POST['typ'] : null; $anmerkung = isset($_POST['anmerkung']) ? $_POST['anmerkung'] : null; +/* $person_id = $this->input->post('$person_id'); + $co_name = $this->input->post('co_name'); + $strasse = $this->input->post('strasse'); + $ort = $this->input->post('ort'); + $gemeinde = $this->input->post('gemeinde'); + $nation = $this->input->post('nation'); + $name = $this->input->post('name'); + $typ = $this->input->post('typ'); + $anmerkung = $this->input->post('anmerkung');*/ + $result = $this->AdresseModel->update( [ 'adresse_id' => $address_id @@ -407,10 +371,11 @@ class Kontakt extends FHC_Controller $standort_id = null; $uid = getAuthUID(); - $kontakttyp = isset($_POST['kontakttyp']) ? $_POST['kontakttyp'] : null; - $anmerkung = isset($_POST['anmerkung']) ? $_POST['anmerkung'] : null; - $kontakt = isset($_POST['kontakt']) ? $_POST['kontakt'] : null; - $ext_id = isset($_POST['ext_id']) ? $_POST['ext_id'] : null; + + $kontakttyp = $this->input->post('kontakttyp'); + $anmerkung = $this->input->post('anmerkung'); + $kontakt = $this->input->post('kontakt'); + $ext_id = $this->input->post('ext_id'); $result = $this->KontaktModel->insert( [ @@ -453,11 +418,11 @@ class Kontakt extends FHC_Controller $standort_id = null; $uid = getAuthUID(); - $kontakttyp = isset($_POST['kontakttyp']) ? $_POST['kontakttyp'] : null; - $anmerkung = isset($_POST['anmerkung']) ? $_POST['anmerkung'] : null; - $kontakt = isset($_POST['kontakt']) ? $_POST['kontakt'] : null; - $ext_id = isset($_POST['ext_id']) ? $_POST['ext_id'] : null; - $person_id = isset($_POST['person_id']) ? $_POST['person_id'] : null; + $kontakttyp = $this->input->post('kontakttyp'); + $anmerkung = $this->input->post('anmerkung'); + $kontakt = $this->input->post('kontakt'); + $ext_id = $this->input->post('ext_id'); + $person_id = $this->input->post('person_id'); $result = $this->KontaktModel->update( [ @@ -536,14 +501,14 @@ class Kontakt extends FHC_Controller $this->load->model('person/Bankverbindung_model', 'BankverbindungModel'); - $ext_id = isset($_POST['ext_id']) ? $_POST['ext_id'] : null; - $oe_kurzbz = isset($_POST['oe_kurzbz']) ? $_POST['oe_kurzbz'] : null; - $orgform_kurzbz = isset($_POST['orgform_kurzbz']) ? $_POST['orgform_kurzbz'] : null; - $name = isset($_POST['name']) ? $_POST['name'] : null; - $anschrift = isset($_POST['anschrift']) ? $_POST['anschrift'] : null; - $bic = isset($_POST['bic']) ? $_POST['bic'] : null; - $blz = isset($_POST['blz']) ? $_POST['blz'] : null; - $kontonr = isset($_POST['kontonr']) ? $_POST['kontonr'] : null; + $ext_id = $this->input->post('ext_id'); + $oe_kurzbz = $this->input->post('oe_kurzbz'); + $orgform_kurzbz = $this->input->post('orgform_kurzbz'); + $name = $this->input->post('name'); + $anschrift = $this->input->post('anschrift'); + $bic = $this->input->post('bic'); + $blz = $this->input->post('blz '); + $kontonr = $this->input->post('kontonr'); $result = $this->BankverbindungModel->insert( [ diff --git a/application/controllers/components/stv/Notiz.php b/application/controllers/components/stv/Notiz.php index 2356f8bf1..36504d77d 100644 --- a/application/controllers/components/stv/Notiz.php +++ b/application/controllers/components/stv/Notiz.php @@ -25,16 +25,8 @@ class Notiz extends FHC_Controller $this->load->library('AuthLib'); $this->load->library('VariableLib', ['uid' => getAuthUID()]); $result = getAuthUid(); + $this->outputJsonError($result); - - // $this->outputJson(getData($result)); - -/* if (isError($result)) { - $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - $this->outputJson(getError($result)); - } else { - $this->outputJson($result); - }*/ } public function getNotizen($person_id) @@ -163,64 +155,6 @@ class Notiz extends FHC_Controller return $this->outputJsonSuccess(true); } - public function updateNotizOldVersion($notiz_id) - { - $uid = getAuthUID(); - $this->load->library('form_validation'); - //$_POST = json_decode($this->input->raw_input_stream, true); - - $this->form_validation->set_rules('titel', 'titel', 'required'); - $this->form_validation->set_rules('text', 'Text', 'required'); - - if ($this->form_validation->run() == false) - { - return $this->outputJsonError($this->form_validation->error_array()); - } - - $this->load->model('person/Notiz_model', 'NotizModel'); - - if(!$notiz_id) - { - return $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - } - - // $person_id = isset($_POST['person_id']) ? $_POST['person_id'] : null; - $uid = getAuthUID(); - $titel = isset($_POST['titel']) ? $_POST['titel'] : null; - $text = isset($_POST['text']) ? $_POST['text'] : null; - $verfasser_uid = isset($_POST['verfasser_uid']) ? $_POST['verfasser_uid'] : null; - $bearbeiter_uid = $uid; - $erledigt = $_POST['erledigt']; - $start = $this->input->post(date('von')); - $ende = $this->input->post(date('bis')); - - - - $result = $this->NotizModel->update( - [ - 'notiz_id' => $notiz_id - ], - [ - 'titel' => $titel, - 'updatevon' => $uid, - 'updateamum' => date('c'), - 'text' => $text, - 'verfasser_uid' => $verfasser_uid, - 'bearbeiter_uid' => $bearbeiter_uid, - 'start' => $start, - 'ende' => $ende, - 'erledigt' => $erledigt - ] - ); - - if (isError($result)) - { - $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - return $this->outputJson(getError($result)); - } - return $this->outputJsonSuccess(true); - } - public function updateNotiz($notiz_id) { $this->load->model('person/Notiz_model', 'NotizModel'); @@ -315,7 +249,7 @@ class Notiz extends FHC_Controller return $this->outputJsonSuccess(true); } - public function deleteNotiz ($notiz_id) + public function deleteNotiz($notiz_id) { //dms_id auslesen aus notizdokument wenn vorhanden $dms_id_arr = []; @@ -331,7 +265,6 @@ class Notiz extends FHC_Controller elseif (!hasData($result)) { $this->outputJson($result); - //$dms_id_arr = []; } else { @@ -387,8 +320,8 @@ class Notiz extends FHC_Controller $this->NotizModel->addSelect('campus.tbl_dms_version.*'); - $this->NotizModel->addJoin('public.tbl_notiz_dokument','ON (public.tbl_notiz_dokument.notiz_id = public.tbl_notiz.notiz_id)'); - $this->NotizModel->addJoin('campus.tbl_dms_version','ON (public.tbl_notiz_dokument.dms_id = campus.tbl_dms_version.dms_id)'); + $this->NotizModel->addJoin('public.tbl_notiz_dokument', 'ON (public.tbl_notiz_dokument.notiz_id = public.tbl_notiz.notiz_id)'); + $this->NotizModel->addJoin('campus.tbl_dms_version', 'ON (public.tbl_notiz_dokument.dms_id = campus.tbl_dms_version.dms_id)'); $result = $this->NotizModel->loadWhere( array('public.tbl_notiz.notiz_id' => $notiz_id) @@ -417,5 +350,4 @@ class Notiz extends FHC_Controller } $this->outputJson($result); } - -} \ No newline at end of file +} From 28fe3ef839820f6859b022962eccb9d3da930e98 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Tue, 16 Jan 2024 14:34:13 +0100 Subject: [PATCH 099/464] Funktionserweiterungen um idType --- .../controllers/components/stv/Notiz.php | 51 +++++++++---- application/models/person/Notiz_model.php | 48 +++++++----- .../models/person/Notizzuordnung_model.php | 31 ++++++++ public/js/components/Notiz/Notiz.js | 71 ++++++++---------- .../Studentenverwaltung/Details/Notizen.js | 73 +++++++++---------- 5 files changed, 163 insertions(+), 111 deletions(-) diff --git a/application/controllers/components/stv/Notiz.php b/application/controllers/components/stv/Notiz.php index 36504d77d..1850a5609 100644 --- a/application/controllers/components/stv/Notiz.php +++ b/application/controllers/components/stv/Notiz.php @@ -29,18 +29,30 @@ class Notiz extends FHC_Controller $this->outputJsonError($result); } - public function getNotizen($person_id) + public function getNotizen($id, $type) { $this->load->model('person/Notiz_model', 'NotizModel'); - $type = 'person'; + $this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel'); - $result = $this->NotizModel->getNotizWithDocEntries($person_id); + //check if valid type + $isValidType = $this->NotizzuordnungModel->isValidType($type); - if (isError($result)) { - $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + if($isValidType) + { + $result = $this->NotizModel->getNotizWithDocEntries($id, $type); + + if (isError($result)) { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + $this->outputJson(getError($result)); + } else { + $this->outputJson(getData($result) ?: []); + } + } + else + { + //Todo manu (correct return to ajax) + $result = "datatype not yet implemented for notes"; $this->outputJson(getError($result)); - } else { - $this->outputJson(getData($result) ?: []); } } @@ -60,8 +72,7 @@ class Notiz extends FHC_Controller } elseif (!hasData($result)) { - $this->outputJson($result); //success mit Wert null - // $this->outputJson(getData($result) ?: []); + $this->outputJson($result); } else { @@ -69,7 +80,7 @@ class Notiz extends FHC_Controller } } - public function addNewNotiz($id) + public function addNewNotiz($id, $paramTyp = null) { $this->load->model('person/Notiz_model', 'NotizModel'); @@ -87,6 +98,18 @@ class Notiz extends FHC_Controller } } + //Überprüfung ob type übergeben wurde (entweder Funktions- oder Postparameter) + if ($paramTyp) + $type = $paramTyp; + if(isset($_POST['typeId'])) + $type = $this->input->post('typeId'); + + if(!$type) + { + //Todo(manu) return error + var_dump("ERROR no type"); + } + //Form Validation $this->form_validation->set_rules('titel', 'titel', 'required'); $this->form_validation->set_rules('text', 'Text', 'required'); @@ -101,11 +124,11 @@ class Notiz extends FHC_Controller $erledigt = $this->input->post('erledigt'); $verfasser_uid = isset($_POST['verfasser_uid']) ? $_POST['verfasser_uid'] : $uid; $bearbeiter_uid = isset($_POST['bearbeiter']) ? $_POST['bearbeiter'] : null; - $type = $this->input->post('typeId'); + //$type = $this->input->post('typeId'); $start = $this->input->post('von'); $ende = $this->input->post('bis'); - //Speichern der Notiz und Notizzuordnung + //Speichern der Notiz und Notizzuordnung inkl Prüfung ob valid type $result = $this->NotizModel->addNotizForType($type, $id, $titel, $text, $uid, $start, $ende, $erledigt, $verfasser_uid, $bearbeiter_uid); if (isError($result)) { @@ -219,7 +242,10 @@ class Notiz extends FHC_Controller return $this->outputJson(getError($result)); } + //Todo(manu) update von Notizzuordnung?? typeId? + //neue Files speichern + //Todo(manu) update files foreach ($_FILES as $k => $file) { $dms = array( @@ -291,7 +317,6 @@ class Notiz extends FHC_Controller } } - //Todo(manu) rollback? //delete Notiz und Notizzuordnung $this->load->model('person/Notiz_model', 'NotizModel'); diff --git a/application/models/person/Notiz_model.php b/application/models/person/Notiz_model.php index 7e7ffbe32..21c91884b 100644 --- a/application/models/person/Notiz_model.php +++ b/application/models/person/Notiz_model.php @@ -140,11 +140,31 @@ class Notiz_model extends DB_Model * @param id for Dokumentzuordnung (person_id, prestudent_id, uid, projekt_id...) * @param titel, text, start, ende, erledigt, verfasser_uid, bearbeiter_uid, insertvon Parameter for notiz */ - public function addNotizForType($type, $id, $titel, $text, $insertvon, $start=null, $ende=null, $erledigt=false, $verfasser_uid=null, $bearbeiter_uid=null) - { + public function addNotizForType( + $type, + $id, + $titel, + $text, + $insertvon, + $start = null, + $ende = null, + $erledigt = false, + $verfasser_uid = null, + $bearbeiter_uid = null + ) { // Loads model Notizzuordnung_model $this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel'); + //check if valid type + $isValidType = $this->NotizzuordnungModel->isValidType($type); + + if(!$isValidType) + { + //Todo manu (correct return to controller) + $msg = "datatype " . $type . " not implemented for notes"; + return error($msg, EXIT_ERROR); + } + // Start DB transaction $this->db->trans_start(false); @@ -180,13 +200,10 @@ class Notiz_model extends DB_Model return $result; } - - /** * Add a Notiz for a given person with DMS_id */ - //TODO(manu) add type for Notizzuordnung - public function addNotizForPersonWithDoc($person_id, $titel, $text, $erledigt, $verfasser_uid, $von, $bis, $dms_id=null) + public function addNotizForPersonWithDoc($person_id, $titel, $text, $erledigt, $verfasser_uid, $von, $bis, $dms_id = null) { // Loads model Notizzuordnung_model $this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel'); @@ -243,16 +260,12 @@ class Notiz_model extends DB_Model /** * gets all Notizen with Documententries for a certain type and type_id - * @param $person_id + * @param String type of id eg. person_id, prestudent_id, mitarbeiter_uid, projekt_kurzbz, projektphase_id, projekttask_id, + * bestellung_id, lehreinheit_id, anrechnung_id, uid) + * @param $id the corresponding id, part of public.tbl_notizzuordnung */ - //Todo(Manu) rewrite in CI-Style - //Todo(Manu) auf andere types erweitern - public function getNotizWithDocEntries($id) + public function getNotizWithDocEntries($id, $type) { - $type = 'writeFunction'; - //$type_id = 'z.person_id'; - - $qry = " SELECT n.*, count(dms_id) as countDoc, z.notizzuordnung_id @@ -265,16 +278,15 @@ class Notiz_model extends DB_Model LEFT JOIN campus.tbl_dms_version USING (dms_id) WHERE - z.person_id = ? + z.$type = ? GROUP BY notiz_id, z.notizzuordnung_id "; - return $this->execQuery($qry, array($id)); - } + /** * gets all Notizen for a person with a specific title * @param $person_id @@ -361,6 +373,4 @@ class Notiz_model extends DB_Model return $this->loadWhere(array('anrechnung_id' => $anrechnung_id)); } - // ------------------------------------------------------------------------------------------------------ - } diff --git a/application/models/person/Notizzuordnung_model.php b/application/models/person/Notizzuordnung_model.php index 187a8399b..542c68e6f 100644 --- a/application/models/person/Notizzuordnung_model.php +++ b/application/models/person/Notizzuordnung_model.php @@ -11,4 +11,35 @@ class Notizzuordnung_model extends DB_Model $this->dbTable = 'public.tbl_notizzuordnung'; $this->pk = 'notizzuordnung_id'; } + + public function isValidType($type) + { + //var_dump($type); + $validTypes = []; + + $qry = " + SELECT column_name + FROM information_schema.columns + WHERE table_schema = 'public' + AND table_name = 'tbl_notizzuordnung' + "; + + $type_arr = $this->execQuery($qry); + $type_arr = $type_arr->retval; + + foreach ($type_arr as $t) { + $validTypes[] = $t->column_name; + } + + if (in_array($type, $validTypes)) + { + // var_dump($type . " is IN ARRAY"); + return true; + } + else + { + //var_dump($type . " is NOT IN ARRAY"); + return false; + } + } } diff --git a/public/js/components/Notiz/Notiz.js b/public/js/components/Notiz/Notiz.js index 46b6a6992..be472de6d 100644 --- a/public/js/components/Notiz/Notiz.js +++ b/public/js/components/Notiz/Notiz.js @@ -29,7 +29,7 @@ export default { multiupload: true, mitarbeiter: [], filteredMitarbeiter: [], - filteredFirmen: [] +/* filteredFirmen: []*/ } }, computed: { @@ -138,17 +138,16 @@ export default {
- {{action}}
[{{this.typeId}}] -
+
-
+
@@ -159,25 +158,21 @@ export default {
-
- + +
- -
+ +
-
- - - -
- -
- - +
+ + +
+
@@ -186,15 +181,15 @@ export default {
- -
+
@@ -205,32 +200,28 @@ export default {
-
- -
- +
+
- - -
- - - - -
` +
+ + + +
` } diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js index f88ce0627..8e9917287 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js @@ -6,7 +6,7 @@ import BsModal from "../../../Bootstrap/Modal"; var editIcon = function (cell, formatterParams) { return ""; }; -var deleteIcon = function (cell, formatterParams){ +var deleteIcon = function (cell, formatterParams) { return ""; }; @@ -20,11 +20,11 @@ export default { props: { modelValue: Object }, - data() { + data(){ return { tabulatorOptions: { - ajaxURL: CoreRESTClient._generateRouterURI('components/stv/Notiz/getNotizen/' + this.modelValue.person_id), - // + this.modelValue.person_id, 'person'), + ajaxURL: CoreRESTClient._generateRouterURI('components/stv/Notiz/getNotizen/' + this.modelValue.person_id + '/person_id'), + //ajaxURL: CoreRESTClient._generateRouterURI('components/stv/Notiz/getNotizen/' + this.modelValue.person_id + '/' + this.typeId), columns: [ {title: "Titel", field: "titel"}, {title: "Text", field: "text", width: 350}, @@ -52,7 +52,7 @@ export default { ], layout: 'fitDataFill', layoutColumnsOnNewData: false, - height: '200', + height: '150', selectable: true, index: 'notiz_id' }, @@ -74,10 +74,10 @@ export default { bearbeiter: null, anhang: [] }, - showErweitert: true, - showDocument: true + showErweitert: true, //show details verfasser, bearbeiter, von, bis, erledigt + showDocument: true //show upload documents - } + }; }, methods:{ actionDeleteNotiz(notiz_id){ @@ -107,8 +107,7 @@ export default { this.loadDocEntries(this.notizen.notiz_id); //console.log(this.formData.anhang); } - }) - ; + }); }, actionNewNotiz(){ this.resetFormData(); @@ -125,13 +124,13 @@ export default { this.formData.anhang = []; }, addNewNotiz(notizData) { - const formData = new FormData(); formData.append('data', JSON.stringify(this.formData)); Object.entries(this.formData.anhang).forEach(([k, v]) => formData.append(k, v)); - CoreRESTClient.post('components/stv/Notiz/addNewNotiz/' + this.modelValue.person_id, + CoreRESTClient.post( + 'components/stv/Notiz/addNewNotiz/' + this.modelValue.person_id, formData, { Headers: { "Content-Type": "multipart/form-data" } } ).then(response => { @@ -163,16 +162,15 @@ export default { this.$fhcAlert.alertError('Keine Notiz mit Id ' + notiz_id + ' gefunden'); } }).catch(error => { - this.$fhcAlert.alertError('Fehler bei Löschroutine aufgetreten'); - }).finally(()=> { - window.scrollTo(0, 0); - }); + this.$fhcAlert.alertError('Fehler bei Löschroutine aufgetreten'); + }).finally(()=> { + window.scrollTo(0, 0); + }); }, loadDocEntries(notiz_id){ return CoreRESTClient.get('components/stv/Notiz/loadDokumente/' + notiz_id) .then( result => { - //console.log(result.data); if(result.data.retval) { this.formData.anhang = result.data.retval; console.log(this.formData.anhang); @@ -187,15 +185,15 @@ export default { ); }, loadNotiz(notiz_id){ - return CoreRESTClient.get('components/stv/Notiz/loadNotiz/' + notiz_id) + return CoreRESTClient.get( + 'components/stv/Notiz/loadNotiz/' + notiz_id) .then( result => { if(result.data.retval) { this.notizen = result.data.retval; - console.log(this.notizen); + //console.log(this.notizen); } - else - { + else { this.notizen = {}; this.$fhcAlert.alertError('Keine Notiz mit Id ' + notiz_id + ' gefunden'); } @@ -230,7 +228,8 @@ export default { Object.entries(this.formData.anhang).forEach(([k, v]) => formData.append(k, v)); //console.log(this.formData); - CoreRESTClient.post('components/stv/Notiz/updateNotiz/' + notiz_id, + CoreRESTClient.post( + 'components/stv/Notiz/updateNotiz/' + notiz_id, formData, { Headers: { "Content-Type": "multipart/form-data" } } ).then(response => { @@ -256,9 +255,9 @@ export default { CoreRESTClient .get('components/stv/Notiz/getUid') .then(result => { - if(result.data.retval) { - this.formData.verfasser = result.data.retval; - } + if(result.data.retval) { + this.formData.verfasser = result.data.retval; + } }) .catch(this.$fhcAlert.handleSystemError); }, @@ -277,7 +276,7 @@ export default { - + -
+

- Neu anlegen - -
- -
-` -}; \ No newline at end of file + ` +}; From dc5368f346fc86656050cc6a913694920ea7bce0 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Wed, 17 Jan 2024 13:23:52 +0100 Subject: [PATCH 100/464] =?UTF-8?q?Letzte=20=C3=84nderung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/components/stv/Notiz.php | 2 ++ application/models/person/Notiz_model.php | 21 ++++++++++++- public/js/components/Notiz/Notiz.js | 31 +++++++++++++++++-- .../Studentenverwaltung/Details/Notizen.js | 8 ++++- 4 files changed, 57 insertions(+), 5 deletions(-) diff --git a/application/controllers/components/stv/Notiz.php b/application/controllers/components/stv/Notiz.php index 1850a5609..82d494a16 100644 --- a/application/controllers/components/stv/Notiz.php +++ b/application/controllers/components/stv/Notiz.php @@ -61,6 +61,8 @@ class Notiz extends FHC_Controller $this->load->model('person/Notiz_model', 'NotizModel'); $this->NotizModel->addJoin('public.tbl_notiz_dokument', 'notiz_id', 'LEFT'); $this->NotizModel->addSelect('*'); + $this->NotizModel->addSelect("TO_CHAR(CASE WHEN public.tbl_notiz.updateamum >= public.tbl_notiz.insertamum + THEN public.tbl_notiz.updateamum ELSE public.tbl_notiz.insertamum END::timestamp, 'DD.MM.YYYY HH24:MI:SS') AS lastUpdate"); $this->NotizModel->addLimit(1); $result = $this->NotizModel->loadWhere( diff --git a/application/models/person/Notiz_model.php b/application/models/person/Notiz_model.php index 21c91884b..aac679915 100644 --- a/application/models/person/Notiz_model.php +++ b/application/models/person/Notiz_model.php @@ -266,9 +266,27 @@ class Notiz_model extends DB_Model */ public function getNotizWithDocEntries($id, $type) { + // ci query builder returns null +/* $this->db->select('n.*, count(dms_id) as countDoc, z.notizzuordnung_id'); + $this->db->select('(CASE WHEN n.updateamum >= n.insertamum THEN n.updateamum ELSE n.insertamum END) AS lastUpdate'); + $this->db->from('public.tbl_notiz n'); + $this->db->join('public.tbl_notizzuordnung z', 'n.notiz_id = z.notiz_id'); + $this->db->join('public.tbl_notiz_dokument dok', 'n.notiz_id = dok.notiz_id', 'left'); + $this->db->join('campus.tbl_dms_version', 'dok.notiz_id = campus.tbl_dms_version.dms_id', 'left'); + $this->db->where("z.$type", $id); + $this->db->group_by('n.notiz_id, z.notizzuordnung_id'); + + $query = $this->db->get(); + return $query->result();*/ + + $qry = " SELECT - n.*, count(dms_id) as countDoc, z.notizzuordnung_id + n.*, count(dms_id) as countDoc, z.notizzuordnung_id, + TO_CHAR (CASE + WHEN n.updateamum >= n.insertamum THEN n.updateamum + ELSE n.insertamum + END::timestamp, 'DD.MM.YYYY HH24:MI:SS') AS lastUpdate FROM public.tbl_notiz n JOIN @@ -284,6 +302,7 @@ class Notiz_model extends DB_Model "; return $this->execQuery($qry, array($id)); + } diff --git a/public/js/components/Notiz/Notiz.js b/public/js/components/Notiz/Notiz.js index be472de6d..3c1bbab27 100644 --- a/public/js/components/Notiz/Notiz.js +++ b/public/js/components/Notiz/Notiz.js @@ -13,6 +13,7 @@ export default { 'typeId', 'titel', 'text', + 'lastChange', 'von', 'bis', 'statusNew', @@ -49,6 +50,14 @@ export default { this.$emit('update:text', value); } }, +/* intLastChange: { + get() { + return this.lastChange; + }, + set(value) { + this.$emit('update:lastChange', value); + } + },*/ intVon: { get() { return this.von; @@ -142,6 +151,13 @@ export default { [{{this.typeId}}]
+ +
+
+

Neue Notiz

+

Notiz bearbeiten

+
+
@@ -156,6 +172,7 @@ export default {
+
@@ -179,7 +196,7 @@ export default {
- +
- +
- + +
+ +
+ +

{{this.lastChange}}

+
+
+
` diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js index 8e9917287..bbe03d785 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js @@ -37,6 +37,7 @@ export default { {title: "Erledigt", field: "erledigt", visible: false}, {title: "Notiz_id", field: "notiz_id", visible: false}, {title: "Notizzuordnung_id", field: "notizzuordnung_id", visible: false}, + {title: "letzte Änderung", field: "lastupdate", visible: false}, { formatter: editIcon, cellClick: (e, cell) => { this.actionEditNotiz(cell.getData().notiz_id); @@ -66,6 +67,7 @@ export default { titel: null, statusNew: true, text: null, + lastChange: null, von: null, bis: null, document: null, @@ -93,6 +95,7 @@ export default { this.formData.titel = this.notizen.titel; this.formData.statusNew = false; this.formData.text = this.notizen.text; + this.formData.lastChange = this.notizen.lastupdate; this.formData.von = this.notizen.start; this.formData.bis = this.notizen.ende; this.formData.document = this.notizen.dms_id; @@ -115,6 +118,7 @@ export default { this.formData.titel = ''; this.formData.statusNew = true; this.formData.text = null; + this.formData.lastChange = null; this.formData.von = null; this.formData.bis = null; this.formData.document = null; @@ -212,6 +216,7 @@ export default { titel: null, statusNew: true, text: null, + lastChange: null, von: null, bis: null, document: null, @@ -299,6 +304,7 @@ export default { v-model:typeId="formData.typeId" v-model:titel="formData.titel" v-model:text="formData.text" + :lastChange="formData.lastChange" v-model:statusNew="formData.statusNew" v-model:von="formData.von" v-model:bis="formData.bis" @@ -312,7 +318,7 @@ export default { - +
` }; From 22f6e3fe3bdf7a20ae2cef3ac73c5091a2f3cb38 Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Wed, 17 Jan 2024 15:18:38 +0100 Subject: [PATCH 101/464] Upload Dms Component --- public/js/components/Form/Upload/Dms.js | 85 +++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 public/js/components/Form/Upload/Dms.js diff --git a/public/js/components/Form/Upload/Dms.js b/public/js/components/Form/Upload/Dms.js new file mode 100644 index 000000000..1c2f476e8 --- /dev/null +++ b/public/js/components/Form/Upload/Dms.js @@ -0,0 +1,85 @@ +export default { + emits: [ + 'update:modelValue' + ], + props: { + modelValue: { + type: [ FileList, Array ], + required: true + }, + multiple: Boolean, + id: String, + name: String + }, + methods: { + stringifyFile(file) { + return JSON.stringify({ + lastModified: file.lastModified, + lastModifiedDate: file.lastModifiedDate, + name: file.name, + size: file.size, + type: file.type + }); + }, + addFiles(event) { + if (!this.multiple) + return this.$emit('update:modelValue', event.target.files); + + const dt = new DataTransfer(); + const doubles = []; + for (var file of this.modelValue) { + dt.items.add(file); + doubles.push(this.stringifyFile(file)); + } + for (var file of event.target.files) { + // NOTE(chris): deep check (with FileReader) would require an async function so we only check the basic attributes + if (doubles.indexOf(this.stringifyFile(file)) < 0) + dt.items.add(file); + } + this.$emit('update:modelValue', dt.files); + }, + removeFile(id) { + const fileToRemove = Array.from(this.modelValue)[id]; + + const dt = new DataTransfer(); + for (var file of this.modelValue) { + if (file !== fileToRemove) + dt.items.add(file); + } + this.$emit('update:modelValue', dt.files); + } + }, + watch: { + modelValue(n) { + if (n instanceof FileList) + return this.$refs.upload.files = n; + + const dt = new DataTransfer(); + const dms = []; + for (var file of n) { + if (file instanceof File) { + dt.items.add(file); + } else { + const dmsFile = new File([JSON.stringify(file)], file.name, { + type: 'application/x.fhc-dms+json' + }); + dt.items.add(dmsFile); + } + } + this.$emit('update:modelValue', dt.files); + } + }, + template: ` +
+ +
    +
  • + + {{ file.name }} + +
  • +
+
` +} \ No newline at end of file From abb9885b3b9a19cccbafecc718419ec765ab4064 Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Wed, 17 Jan 2024 15:23:00 +0100 Subject: [PATCH 102/464] Fhc.css --- public/css/Fhc.css | 80 ++---------------------------- public/css/Studentenverwaltung.css | 1 + 2 files changed, 5 insertions(+), 76 deletions(-) diff --git a/public/css/Fhc.css b/public/css/Fhc.css index 23c2379ea..1376a251f 100644 --- a/public/css/Fhc.css +++ b/public/css/Fhc.css @@ -2,82 +2,10 @@ white-space: pre-line; } -.accordion-button-primary { - background-color: #e7f1ff; - color: #0c63e4; -} -.accordion-button-primary:not(.collapsed) { - background-color: #cfe2ff; - color: #0a58ca; +.btn-p-0 { + padding: 0 .375rem; } -.accordion-button-secondary { - background-color: #f0f1f2; - color: #616971; +.z-1 { + z-index: 1; } -.accordion-button-secondary:not(.collapsed) { - background-color: #e2e3e5; - color: #565e64; -} - -.accordion-button-success { - background-color: #e8f3ee; - color: #177a4c; -} -.accordion-button-success:not(.collapsed) { - background-color: #d1e7dd; - color: #146c43; -} - -.accordion-button-info { - background-color: #e7fafe; - color: #0cb6d8; -} -.accordion-button-info:not(.collapsed) { - background-color: #cff4fc; - color: #0aa2c0; -} - -.accordion-button-warning { - background-color: #fff9e6; - color: #e6ae06; -} -.accordion-button-warning:not(.collapsed) { - background-color: #fff3cd; - color: #cc9a06; -} - -.accordion-button-danger { - background-color: #fcebec; - color: #c6303e; -} -.accordion-button-danger:not(.collapsed) { - background-color: #f8d7da; - color: #b02a37; -} - -.accordion-button-light { - background-color: #fefeff; - color: #dfe0e1; -} -.accordion-button-light:not(.collapsed) { - background-color: #fefefe; - color: #c6c7c8; -} - -.accordion-button-dark { - background-color: #e9e9ea; - color: #1e2125; -} -.accordion-button-dark:not(.collapsed) { - background-color: #d3d3d4; - color: #1a1e21; -} - -.tabulator-edit-list .tabulator-edit-list-item { - background-color: white; -} -.tabulator-edit-list .tabulator-edit-list-item:hover, -.tabulator-edit-list .tabulator-edit-list-item.active { - color: white; -} \ No newline at end of file diff --git a/public/css/Studentenverwaltung.css b/public/css/Studentenverwaltung.css index f845adc43..3f12660ff 100644 --- a/public/css/Studentenverwaltung.css +++ b/public/css/Studentenverwaltung.css @@ -1,3 +1,4 @@ +@import './Fhc.css'; @import './components/searchbar.css'; @import './components/verticalsplit.css'; @import './components/FilterComponent.css'; From 8762e87658523265fe469b2943fa0845f502d375 Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Wed, 17 Jan 2024 15:24:44 +0100 Subject: [PATCH 103/464] Noten: Switch all/current semester --- .../controllers/components/stv/Noten.php | 4 +- .../Details/Noten/Zeugnis.js | 54 +++++++++++++------ 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/application/controllers/components/stv/Noten.php b/application/controllers/components/stv/Noten.php index dfde2892b..fb61de065 100644 --- a/application/controllers/components/stv/Noten.php +++ b/application/controllers/components/stv/Noten.php @@ -30,7 +30,7 @@ class Noten extends Auth_Controller return $this->outputJson($result); } - public function getZeugnis($prestudent_id) + public function getZeugnis($prestudent_id, $all = null) { $this->load->model('crm/Student_model', 'StudentModel'); $this->load->model('education/Zeugnisnote_model', 'ZeugnisnoteModel'); @@ -47,7 +47,7 @@ class Noten extends Auth_Controller $student_uid = current(getData($result))->student_uid; - $studiensemester_kurzbz = $this->variablelib->getVar('semester_aktuell'); + $studiensemester_kurzbz = ($all === null) ? $this->variablelib->getVar('semester_aktuell') : null; $result = $this->ZeugnisnoteModel->getZeugnisnoten($student_uid, $studiensemester_kurzbz); if (isError($result)) { diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis.js b/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis.js index 95875f868..0f5bcc62e 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis.js @@ -2,6 +2,8 @@ import {CoreFilterCmpt} from "../../../../filter/Filter.js"; import {CoreRESTClient} from '../../../../../RESTClient.js'; import ZeugnisActions from './Zeugnis/Actions.js'; +const LOCAL_STORAGE_ID = 'stv_details_noten_zeugnis_2024-01-11_stdsem_all'; + export default { components: { CoreFilterCmpt, @@ -13,12 +15,13 @@ export default { data() { return { validStudent: true, - tabulatorEvents: [] + tabulatorEvents: [], + stdsem: '' }; }, computed: { ajaxURL() { - return CoreRESTClient._generateRouterURI('components/stv/Noten/getZeugnis/' + this.student.prestudent_id); + return CoreRESTClient._generateRouterURI('components/stv/Noten/getZeugnis/' + this.student.prestudent_id + this.stdsem); }, tabulatorOptions() { return { @@ -59,29 +62,50 @@ export default { }; } }, + watch: { + ajaxURL(n) { + if (this.$refs.table) + this.$refs.table.tabulator.setData(n); + } + }, methods: { setGrades(selected) { CoreRESTClient .post('components/stv/Noten/update', selected) .then(this.$refs.table.reloadTable) .catch(this.$fhcAlert.handleFormValidation); + }, + saveStdsem(event) { + window.localStorage.setItem(LOCAL_STORAGE_ID, event.target.value ? 'true' : ''); } }, + created() { + const savedPath = window.localStorage.getItem(LOCAL_STORAGE_ID); + this.stdsem = savedPath ? '/all' : ''; + }, + // TODO(chris): phrasen template: `
Kein Student
- - - +
` }; \ No newline at end of file From 5c9e1b3fd36ac56238b352964e6d6e571d2c4a2c Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Wed, 17 Jan 2024 15:28:39 +0100 Subject: [PATCH 104/464] Use new Form Components in Details --- .../controllers/components/stv/Student.php | 7 +- public/js/components/Form/Input.js | 20 +- public/js/components/Form/Upload/Image.js | 18 +- .../Studentenverwaltung/Details/Details.js | 512 ++++++++++-------- 4 files changed, 329 insertions(+), 228 deletions(-) diff --git a/application/controllers/components/stv/Student.php b/application/controllers/components/stv/Student.php index 88627ca03..ddfd95aed 100644 --- a/application/controllers/components/stv/Student.php +++ b/application/controllers/components/stv/Student.php @@ -77,6 +77,7 @@ class Student extends FHC_Controller $this->form_validation->set_rules('semester', 'Semester', 'integer'); if ($this->form_validation->run() == false) { + $this->output->set_status_header(REST_Controller::HTTP_BAD_REQUEST); return $this->outputJsonError($this->form_validation->error_array()); } @@ -202,7 +203,11 @@ class Student extends FHC_Controller } } - $this->outputJsonSuccess(true); + $this->outputJson(success(array_fill_keys(array_merge( + array_keys($update_lehrverband), + array_keys($update_person), + array_keys($update_student) + ), ''), 1)); } public function check() diff --git a/public/js/components/Form/Input.js b/public/js/components/Form/Input.js index 46ddbd3c5..8bdff639b 100644 --- a/public/js/components/Form/Input.js +++ b/public/js/components/Form/Input.js @@ -14,7 +14,8 @@ export default { bsFeedback: Boolean, noAutoClass: Boolean, type: String, - name: String + name: String, + containerClass: [String, Array, Object] }, data() { return { @@ -23,6 +24,13 @@ export default { } }, computed: { + hasContainer() { + if (!this.bsFeedback) + return true; + if (this.containerClass) + return true; + return false; + }, lcType() { if (!this.type) return 'text'; @@ -37,6 +45,8 @@ export default { return 'VueDatePicker'; case 'autocomplete': return 'PvAutocomplete'; + case 'uploadimage': + return 'UploadImage'; default: return 'input'; } @@ -133,7 +143,9 @@ export default { if (this.tag == 'VueDatePicker' && !this._.components.VueDatePicker) { this._.components.VueDatePicker = Vue.defineAsyncComponent(() => import("../vueDatepicker.js.php")); } else if (this.tag == 'PvAutocomplete' && !this._.components.PvAutocomplete) { - this._.components.PvAutocomplete = Vue.defineAsyncComponent(() => import(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + "/public/js/components/primevue/autocomplete/autocomplete.esm.min.js"));; + this._.components.PvAutocomplete = Vue.defineAsyncComponent(() => import(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + "/public/js/components/primevue/autocomplete/autocomplete.esm.min.js")); + } else if (this.tag == 'UploadImage' && !this._.components.UploadImage) { + this._.components.UploadImage = Vue.defineAsyncComponent(() => import("./Upload/Image.js")); } } }, @@ -149,7 +161,7 @@ export default { // TODO(chris): wrap check in div? }, template: ` - + @@ -197,7 +209,7 @@ export default { > -
+
- +
` } \ No newline at end of file diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Details.js b/public/js/components/Stv/Studentenverwaltung/Details/Details.js index ebbd68dd2..0c988179f 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Details.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Details.js @@ -1,16 +1,14 @@ -import VueDatePicker from '../../../vueDatepicker.js.php'; -import FormUploadImage from '../../../Form/Upload/Image.js'; import {CoreRESTClient} from '../../../../RESTClient.js'; - - -import PvToast from "../../../../../../index.ci.php/public/js/components/primevue/toast/toast.esm.min.js"; +import FormForm from '../../../Form/Form.js'; +import FormInput from '../../../Form/Input.js'; +import FormUploadImage from '../../../Form/Upload/Image.js'; export default { components: { - VueDatePicker, - FormUploadImage, - PvToast + FormForm, + FormInput, + FormUploadImage }, inject: { showBpk: { @@ -62,6 +60,9 @@ export default { }, changedLength() { return Object.keys(this.changed).length; + }, + noImageSrc() { + return FHC_JS_DATA_STORAGE_OBJECT.app_root + 'skin/images/profilbild_dummy.jpg'; } }, watch: { @@ -69,6 +70,7 @@ export default { this.updateStudent(n); }, data: { + // TODO(chris): use @input instead? handler(n) { let res = {}; for (var k in this.original) { @@ -82,7 +84,6 @@ export default { } } this.changed = res; - this.resetErrors(); }, deep: true } @@ -98,213 +99,264 @@ export default { this.data.familienstand = ''; this.original = {...this.data}; }) - .catch(err => { - console.error(err.response.data || err.message); - }); + .catch(this.$fhcAlert.handleSystemError); }, save() { - CoreRESTClient - .post('components/stv/Student/save/' + this.modelValue.prestudent_id, this.changed) - .then(result => result.data) + this.$refs.form + .send(CoreRESTClient.post('components/stv/Student/save/' + this.modelValue.prestudent_id, this.changed)) .then(result => { - this.resetErrors(); - if (CoreRESTClient.isError(result)) { - let errors = CoreRESTClient.getError(result); - - if (errors === "Generic error") - console.error(errors, result); - else { - for (var k in errors) - this.addError(k, errors[k]); - } - } else { - for (var node of document.querySelectorAll(Object.keys(this.changed).map(el => '#stv-details-' + el).join(','))) - node.classList.add('is-valid'); - if (this.changed.gebdatum !== undefined) - this.gebDatumIsValid = true; - - // TODO(chris): phrase - this.$fhcAlert.alertSuccess('Gespeichert'); - //this.addToast('Gespeichert', '', 'success'); - - this.original = {...this.data}; - this.changed = {}; - } + this.original = {...this.data}; + this.changed = {}; }) - .catch(this.$fhcAlert.handleSystemError/*err => { - // TODO(chris): phrase - this.addToast('Error', err?.response?.data || err?.message, 'error'); - }*/); - }, - resetErrors() { - Array.from(this.$refs.form.getElementsByClassName('is-valid')).forEach(el => el.classList.remove('is-valid')); - Array.from(this.$refs.form.getElementsByClassName('is-invalid')).forEach(el => el.classList.remove('is-invalid')); - Array.from(this.$refs.form.getElementsByClassName('invalid-feedback')).forEach(el => el.remove()); - this.gebDatumIsValid = false; - this.gebDatumIsInvalid = false; - }, - addError(field, msg) { - let id = 'stv-details-' + field; - - let input = document.getElementById(id); - if (field === 'gebdatum') { - this.gebDatumIsInvalid = true; - input = document.getElementById('dp-input-' + id).parentNode; - } - - input.classList.add('is-invalid'); - - let feedback = document.createElement('div'); - feedback.classList.add('invalid-feedback'); - feedback.innerHTML = msg; - input.after(feedback); - /*}, - addToast(header, msg, severity) { - this.$refs.responseToast.add({ - severity: severity, - summary: header, - detail: msg, - life: 3000 - })*/ + .catch(this.$fhcAlert.handleSystemError); } }, created() { this.updateStudent(this.modelValue); }, + //TODO(chris): Phrasen //TODO(chris): Geburtszeit? Anzahl der Kinder? template: ` -
-
+ +
Person
@@ -315,47 +367,79 @@ export default { StudentIn
Loading...
- - ` +
` }; \ No newline at end of file From f17591327dc882a61b24ac5e0707a52aecf79fc9 Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Wed, 17 Jan 2024 16:00:56 +0100 Subject: [PATCH 105/464] Quickfix missing "!" --- public/js/components/Form/Input.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/components/Form/Input.js b/public/js/components/Form/Input.js index 8bdff639b..8107c1a19 100644 --- a/public/js/components/Form/Input.js +++ b/public/js/components/Form/Input.js @@ -161,7 +161,7 @@ export default { // TODO(chris): wrap check in div? }, template: ` - + From 0c0d5294789a9087031ec2dfb4e43e43c3f54c10 Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Wed, 17 Jan 2024 16:03:24 +0100 Subject: [PATCH 106/464] Tabs: vertical usage & reactive configUrl & configUrl accepts object --- public/js/components/Tabs.js | 99 +++++++++++++++++++++--------------- 1 file changed, 57 insertions(+), 42 deletions(-) diff --git a/public/js/components/Tabs.js b/public/js/components/Tabs.js index 7d2cf0500..1e77fa996 100644 --- a/public/js/components/Tabs.js +++ b/public/js/components/Tabs.js @@ -11,9 +11,14 @@ export default { 'changed' ], props: { - configUrl: String, + // TODO(chris): rename to config? + configUrl: { + type: [String, Object], + required: true + }, default: String, - modelValue: [String, Number, Boolean, Array, Object, Date, Function, Symbol] + modelValue: [String, Number, Boolean, Array, Object, Date, Function, Symbol], + vertical: Boolean }, data() { return { @@ -37,60 +42,70 @@ export default { } } }, + watch: { + configUrl(n) { + this.initConfig(n); + } + }, methods: { change(key) { this.$emit("change", key) this.current = key; this.$nextTick(() => this.$emit("changed", key)); - } - }, - created() { - CoreRESTClient - .get(this.configUrl) - .then(result => CoreRESTClient.getData(result.data)) - .then(result => { - if (!result) - return; + }, + initConfig(config) { + if (!config) + return; + if (typeof config === 'string' || config instanceof String) + return CoreRESTClient.get(config) + .then(result => CoreRESTClient.getData(result.data)) + .then(this.initConfig) + .catch(this.$fhcAlert.handleSystemError); - const tabs = {}; + console.log(config); + const tabs = {}; - if (Array.isArray(result)) { - result.forEach((config, key) => { - if (!config.component) - return console.error('Component missing for ' + key); + if (Array.isArray(config)) { + config.forEach((item, key) => { + if (!item.component) + return console.error('Component missing for ' + key); - tabs[key] = { - component: Vue.markRaw(Vue.defineAsyncComponent(() => import(config.component))), - title: config.title || key, - config: config.config, - key - } - }); + tabs[key] = { + component: Vue.markRaw(Vue.defineAsyncComponent(() => import(item.component))), + title: item.title || key, + config: item.config, + key + } + }); + } else { + Object.entries(config).forEach(([key, item]) => { + if (!item.component) + return console.error('Component missing for ' + key); - } else { - Object.entries(result).forEach(([key, config]) => { - if (!config.component) - return console.error('Component missing for ' + key); + tabs[key] = { + component: Vue.markRaw(Vue.defineAsyncComponent(() => import(item.component))), + title: item.title || key, + config: item.config, + key + } + }); + } - tabs[key] = { - component: Vue.markRaw(Vue.defineAsyncComponent(() => import(config.component))), - title: config.title || key, - config: config.config, - key - } - }); - } + if (this.current === null || !tabs[this.current]) { if (tabs[this.default]) this.current = this.default; else this.current = Object.keys(tabs)[0]; - this.tabs = tabs; - }) - .catch(this.$fhcAlert.handleSystemError); + } + this.tabs = tabs; + } + }, + created() { + this.initConfig(this.configUrl); }, template: ` -
-