diff --git a/application/controllers/components/stv/Notiz.php b/application/controllers/components/stv/Notiz.php index 439e7c7fb..00935a95d 100644 --- a/application/controllers/components/stv/Notiz.php +++ b/application/controllers/components/stv/Notiz.php @@ -23,7 +23,7 @@ class Notiz extends FHC_Controller { $this->load->model('person/Notiz_model', 'NotizModel'); - $result = $this->NotizModel->getNotiz($person_id, true); + $result = $this->NotizModel->getNotizWithDocEntries($person_id); if (isError($result)) { $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); @@ -62,7 +62,9 @@ class Notiz extends FHC_Controller public function addNewNotiz($person_id) { - $_POST = json_decode($this->input->raw_input_stream, true); + var_dump($this->input->post('titel')); + var_dump($this->input->post('anhang')); + var_dump($_FILES); $this->load->library('form_validation'); @@ -79,17 +81,11 @@ class Notiz extends FHC_Controller $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; $verfasser_uid = $uid; $start = isset($_POST['von']) ? $_POST['von'] : null; $ende = isset($_POST['bis']) ? $_POST['bis'] : null; $erledigt = $_POST['erledigt']; -/* $dms_id = isset($_POST['dms_id']) ? $_POST['dms_id'] : null; - $bearbeiter_uid = isset($_POST['bearbeiter_uid']) ? $_POST['bearbeiter_uid'] : null; - -*/ - $result = $this->NotizModel->addNotizForPersonWithDoc($person_id, $titel, $text, $erledigt, $verfasser_uid, $start, $ende); // var_dump($result); @@ -191,4 +187,32 @@ class Notiz extends FHC_Controller return $this->outputJsonSuccess(current(getData($result))); } + public function loadDokumente($notiz_id) + { + $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)'); + $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) + ); + if (isError($result)) { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + $this->outputJson($result); + } + + elseif (!hasData($result)) { + $this->outputJson($result); + } + else + { + $this->outputJsonSuccess(getData($result)); + } + } + } \ No newline at end of file diff --git a/application/models/person/Notiz_model.php b/application/models/person/Notiz_model.php index 5a8bf1858..fbebc3bd8 100644 --- a/application/models/person/Notiz_model.php +++ b/application/models/person/Notiz_model.php @@ -175,17 +175,41 @@ class Notiz_model extends DB_Model * gets all Notizen for a person * @param $person_id */ - public function getNotiz($person_id, $withDoc=false) + public function getNotiz($person_id) { - // Join with the table public.tbl_notizzuordnung using notiz_id + $this->addSelect('public.tbl_notiz.*'); $this->addJoin('public.tbl_notizzuordnung', 'notiz_id'); - if($withDoc) - $this->addJoin('public.tbl_notiz_dokument', 'notiz_id', 'LEFT'); - return $this->loadWhere(array('person_id' => $person_id)); } + /** + * gets all Notizen with Documententries for a person + * @param $person_id + */ + public function getNotizWithDocEntries($person_id) + { + $qry = " + SELECT + n.*, count(dms_id) as countDoc + FROM + public.tbl_notiz n + JOIN + public.tbl_notizzuordnung z USING (notiz_id) + LEFT JOIN + public.tbl_notiz_dokument dok USING (notiz_id) + LEFT JOIN + campus.tbl_dms_version USING (dms_id) + WHERE + z.person_id = ? + GROUP BY + notiz_id + "; + + return $this->execQuery($qry, array($person_id)); + + } + /** * gets all Notizen for a person with a specific title * @param $person_id diff --git a/public/css/Tabulator5.css b/public/css/Tabulator5.css index 48124335f..a9a79a6d8 100644 --- a/public/css/Tabulator5.css +++ b/public/css/Tabulator5.css @@ -38,3 +38,6 @@ .tabulator .tabulator-col-resize-handle:last-of-type { z-index: 999999; } +.tabulator { + font-size: 1rem; +} diff --git a/public/js/components/Form/Upload/SingleFile.js b/public/js/components/Form/Upload/SingleFile.js new file mode 100644 index 000000000..74c60fcb8 --- /dev/null +++ b/public/js/components/Form/Upload/SingleFile.js @@ -0,0 +1,36 @@ +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: ` +
Selected File: {{file.name}}
+