diff --git a/application/controllers/components/stv/Notiz.php b/application/controllers/components/stv/Notiz.php
index 3ec8b6f26..73c06ba86 100644
--- a/application/controllers/components/stv/Notiz.php
+++ b/application/controllers/components/stv/Notiz.php
@@ -62,50 +62,23 @@ class Notiz extends FHC_Controller
public function addNewNotiz($id)
{
$this->load->library('form_validation');
- $dms_id = null;
+ //$_POST = json_decode($this->input->raw_input_stream, true);
- //DMS-Logik zum Speichern des Anhangs
-/* var_dump("im Backend: addNewNotiz, dmslogik");
- var_dump($_FILES);*/
+ //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?,
$this->load->library('DmsLib');
-
-
-
-
-
$uid = getAuthUID();
- //single
- $dms_id = null;
- $dms = array(
- 'kategorie_kurzbz' => 'notiz',
- 'version' => 0,
- 'name' => $_FILES["anhang"]["name"],
- 'mimetype' => $_FILES["anhang"]["type"],
- 'insertamum' => date('c'),
- 'insertvon' => $uid
- );
-
- //var_dump($dms);
-
- $result = $this->dmslib->upload($dms, 'anhang', array('pdf'));
- //var_dump($result);
-
- if (isSuccess($result))
- {
- //TODO(Manu) change to array
- $dms_id = $result->retval['dms_id'];
- }
-
- //var_dump($dms_id);
-
-/* //multiple files
+ //multiple files
$dms_id = [];
- foreach ($_FILES as $file)
+ foreach ($_FILES as $k => $file)
{
- //var_dump($file["name"]);
- var_dump($file);
+/* var_dump($file["name"]);
+ var_dump($file);*/
$dms = array(
'kategorie_kurzbz' => 'notiz',
'version' => 0,
@@ -115,26 +88,27 @@ class Notiz extends FHC_Controller
'insertvon' => $uid
);
- $result = $this->dmslib->upload($dms, 'file', array('pdf'));
- var_dump($result);
+ $result = $this->dmslib->upload($dms, $k, array('pdf'));
if (isSuccess($result))
{
//TODO(Manu) change to array
$dms_id[] = $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)]);
+ }*/
}
- var_dump($dms_id);
- return;*/
-
-
$this->load->model('person/Notiz_model', 'NotizModel');
- //var_dump($_POST);
-
$uid = getAuthUID();
$titel = isset($_POST['titel']) ? $_POST['titel'] : null;
$text = isset($_POST['text']) ? $_POST['text'] : null;
@@ -180,30 +154,12 @@ class Notiz extends FHC_Controller
//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);
-
-
-
- // var_dump($result);
-
-/* $result = $this->NotizModel->insert(
- [
- 'titel' => $titel,
- 'text' => $text,
- 'insertvon' => $uid,
- 'insertamum' => date('c'),
- 'verfasser_uid' => $verfasser_uid,
- 'bearbeiter_uid' => $bearbeiter_uid,
- 'start' => $start,
- 'ende' => $ende,
- 'erledigt' => $_POST['erledigt'],
- //'dms_id' => $dms_id
- ]
- );*/
if (isError($result))
{
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
diff --git a/application/models/person/Notiz_model.php b/application/models/person/Notiz_model.php
index 141065c87..3a4888f38 100644
--- a/application/models/person/Notiz_model.php
+++ b/application/models/person/Notiz_model.php
@@ -162,7 +162,13 @@ class Notiz_model extends DB_Model
// Loads model Notizdokument_model
$this->load->model('person/Notizdokument_model', 'NotizdokumentModel');
//Todo(manu) change for multiple files
- $result = $this->NotizdokumentModel->insert(array('notiz_id' => $notiz_id, 'dms_id' => $dms_id));
+ 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));
}
if ($type == 'person')
diff --git a/public/js/components/Form/Upload/File.js b/public/js/components/Form/Upload/File.js
new file mode 100644
index 000000000..0394afd42
--- /dev/null
+++ b/public/js/components/Form/Upload/File.js
@@ -0,0 +1,51 @@
+export default {
+ props: [
+ 'dateien',
+ 'multiupload'
+ ],
+ computed: {
+ intDateien:{
+ get() {
+ return this.dateien;
+ },
+ set(value) {
+ this.$emit('update:dateien', value);
+ }
+ },
+ },
+ methods: {
+ handleFileChange(event) {
+ this.intDateien = event.target.files;
+ },
+ deleteFile(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);
+ }
+
+ this.$refs.upload.files = dt.files;
+ this.$emit('update:dateien', dt.files);
+ }
+ },
+ template: `
+
+
+
+
+
+
+
+
+
+
+
+
+`
+}
\ 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: `
-
Selected File: {{file.name}}
-