mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-10 00:29:27 +00:00
Merge remote-tracking branch 'origin/feature-30660/FHC4_StudierendenGUI_Prototyp' into feature-30660/FHC4_StudierendenGUI_Prototyp
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -38,3 +38,6 @@
|
||||
.tabulator .tabulator-col-resize-handle:last-of-type {
|
||||
z-index: 999999;
|
||||
}
|
||||
.tabulator {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
@@ -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: `
|
||||
<div>
|
||||
<h2>File Upload</h2>
|
||||
<form
|
||||
@submit.prevent="uploadFile">
|
||||
<input type="file" ref="fileInput" @change="handleFileChange" />
|
||||
<button type="submit">Upload</button>
|
||||
</form>
|
||||
<div v-if="file">
|
||||
<p>Selected File: {{file.name}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>`
|
||||
@@ -1,5 +1,26 @@
|
||||
import VueDatePicker from '../vueDatepicker.js.php';
|
||||
//import SingleFile from '../Form/Upload/SingleFile.js';
|
||||
|
||||
export default {
|
||||
props: ['titel', 'text', 'von', 'bis', 'action', 'document', 'erledigt', 'verfasser', 'bearbeiter'],
|
||||
components: {
|
||||
VueDatePicker,
|
||||
//BsModal
|
||||
//SingleFile
|
||||
},
|
||||
props: [
|
||||
'titel',
|
||||
'text',
|
||||
'von',
|
||||
'bis',
|
||||
'action',
|
||||
'document',
|
||||
'erledigt',
|
||||
'verfasser',
|
||||
'bearbeiter',
|
||||
'showErweitert',
|
||||
'showDocument',
|
||||
'anhang'
|
||||
],
|
||||
computed: {
|
||||
intTitel: {
|
||||
get() {
|
||||
@@ -65,72 +86,111 @@ export default {
|
||||
this.$emit('update:bearbeiter', value);
|
||||
}
|
||||
},
|
||||
intAnhang: {
|
||||
get() {
|
||||
return this.anhang;
|
||||
},
|
||||
set(value) {
|
||||
console.log(value);
|
||||
this.$emit('update:anhang', value);
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
handleFileChange(event) {
|
||||
this.intAnhang = event.target.files[0];
|
||||
},
|
||||
},
|
||||
template: `
|
||||
<div>
|
||||
<!--{{intTitel}} {{intText}} {{intVon}}| {{titel}} {{text}} {{action}} {{von}} {{bis}} {{document}} {{erledigt}} {{verfasser}} {{bearbeiter}}-->
|
||||
|
||||
component: {{intTitel}} {{intVon}} || {{intAnhang.name}} {{intAnhang}}
|
||||
<form class="row">
|
||||
<div class="notizAction row mb-3">
|
||||
<b>{{action}}</b>
|
||||
</div>
|
||||
<div class="notizTitle row mb-3">
|
||||
<label for="titel" class="form-label col-sm-2">Titel</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" v-model="intTitel" class="form-control">
|
||||
</div>
|
||||
<div>
|
||||
<div class="row mb-3">
|
||||
<b>{{action}}</b>
|
||||
</div>
|
||||
<div class="notizTitle row mb-3">
|
||||
<label for="titel" class="form-label col-sm-2">Titel</label>
|
||||
<div class="col-sm-7">
|
||||
<input type="text" v-model="intTitel" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="text" class="form-label col-sm-2">Text</label>
|
||||
<div class="col-sm-7">
|
||||
<textarea rows="5" cols="75" v-model="intText" class="form-control"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="showDocument">
|
||||
<slot name="document">
|
||||
<div class="row mb-3">
|
||||
<label for="text" class="form-label col-sm-2">Dokument</label>
|
||||
|
||||
<!--Todo(Manu) Component SingleFile-->
|
||||
<!--<single-file id="file" v-model="intDocument"></single-file>-->
|
||||
|
||||
<div class="col-sm-7">
|
||||
<span>
|
||||
<input type="file" ref="fileInput" @change="handleFileChange" v-model="intAnhang"/>
|
||||
<!-- <button type="submit">Upload</button>-->
|
||||
<div v-if="intAnhang.name">
|
||||
<p>Selected File: {{ intAnhang.name }}</p>
|
||||
<button class="text-danger">X</button>
|
||||
</div>
|
||||
</span>
|
||||
<span >
|
||||
<ul>
|
||||
<li v-for="anh in anhang">
|
||||
<button>{{anh.name}}</button><button class="text-danger">X</button>
|
||||
</li>
|
||||
</ul>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</slot>
|
||||
</div>
|
||||
|
||||
<div v-if="showErweitert">
|
||||
<slot name="erweitert">
|
||||
<div class="row mb-3">
|
||||
<label for="bis" class="form-label col-sm-2">VerfasserIn</label>
|
||||
<div class="col-sm-7">
|
||||
<input type="text" v-model="intVerfasser" class="form-contrsol">
|
||||
{{uid}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="bis" class="form-label col-sm-2">BearbeiterIn</label>
|
||||
<div class="col-sm-7">
|
||||
<input type="text" v-model="intBearbeiter" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="von" class="form-label col-sm-2">von</label>
|
||||
<div class="col-sm-2">
|
||||
<vue-date-picker id="von" v-model="intVon" clearable="false" no-today auto-apply enable-time-picker="true" format="dd.MM.yyyy" preview-format="dd.MM.yyyy"></vue-date-picker>
|
||||
</div>
|
||||
|
||||
<label for="bis" class="form-label col-sm-1">bis</label>
|
||||
<div class="col-sm-2">
|
||||
<vue-date-picker id="bis" v-model="intBis" clearable="false" no-today auto-apply enable-time-picker="true" format="dd.MM.yyyy" preview-format="dd.MM.yyyy"></vue-date-picker>
|
||||
</div>
|
||||
|
||||
<label for="bis" class="form-label col-sm-1">erledigt</label>
|
||||
<div class="col-sm-1">
|
||||
<input type="checkbox" v-model="intErledigt">
|
||||
</div>
|
||||
</div>
|
||||
</slot>
|
||||
|
||||
<div class="notizText row mb-3">
|
||||
<label for="text" class="form-label col-sm-2">Text</label>
|
||||
<div class="col-sm-6">
|
||||
<textarea rows="5" cols="75" v-model="intText" class="form-control"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="notizDoc row mb-3">
|
||||
<label for="text" class="form-label col-sm-2">Dokument</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" v-model="intDocument" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="notizVon row mb-3">
|
||||
<label for="von" class="form-label col-sm-2">von</label>
|
||||
<div class="col-sm-6" >
|
||||
<input type="text" v-model="intVon" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="notizBis row mb-3">
|
||||
<label for="bis" class="form-label col-sm-2">bis</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" v-model="intBis" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="notizErledigt row mb-3">
|
||||
<label for="bis" class="form-label col-sm-2">erledigt</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="checkbox" v-model="intErledigt">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="notizVerfasser row mb-3">
|
||||
<label for="bis" class="form-label col-sm-2">VerfasserIn</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" v-model="intVerfasser" class="form-control">
|
||||
{{uid}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="notizBearbeiter row mb-3">
|
||||
<label for="bis" class="form-label col-sm-2">BearbeiterIn</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" v-model="intBearbeiter" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>`
|
||||
|
||||
@@ -15,7 +15,7 @@ export default {
|
||||
CoreRESTClient,
|
||||
CoreFilterCmpt,
|
||||
Notiz,
|
||||
BsModal
|
||||
BsModal,
|
||||
},
|
||||
props: {
|
||||
modelValue: Object
|
||||
@@ -31,7 +31,8 @@ export default {
|
||||
{title: "BearbeiterIn", field: "bearbeiter_uid", visible: false},
|
||||
{title: "Start", field: "start"},
|
||||
{title: "Ende", field: "ende"},
|
||||
{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},
|
||||
{title: "Notizzuordnung_id", field: "notizzuordnung_id", visible: false},
|
||||
@@ -62,18 +63,23 @@ export default {
|
||||
text: null,
|
||||
von: null,
|
||||
bis: null,
|
||||
dms_id: null,
|
||||
document: null,
|
||||
erledigt: false,
|
||||
verfasser: null,
|
||||
bearbeiter: null
|
||||
bearbeiter: null,
|
||||
anhang: []
|
||||
},
|
||||
showErweitert: true,
|
||||
showDocument: true,
|
||||
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
actionDeleteNotiz(notiz_id){
|
||||
this.loadNotiz(notiz_id).then(() => {
|
||||
if(this.notizen.notiz_id)
|
||||
if(this.notizen.notiz_id) {
|
||||
this.$refs.deleteNotizModal.show();
|
||||
}
|
||||
});
|
||||
},
|
||||
actionEditNotiz(notiz_id){
|
||||
@@ -84,10 +90,14 @@ export default {
|
||||
this.formData.text = this.notizen.text;
|
||||
this.formData.von = this.notizen.start;
|
||||
this.formData.bis = this.notizen.ende;
|
||||
this.formData.doc = this.notizen.dms_id;
|
||||
this.formData.document = this.notizen.dms_id;
|
||||
this.formData.erledigt = this.notizen.erledigt;
|
||||
this.formData.verfasser = this.notizen.verfasser_uid;
|
||||
this.formData.bearbeiter = this.notizen.bearbeiter_uid;
|
||||
if(this.notizen.dms_id){
|
||||
console.log("loadEntries");
|
||||
this.loadDocEntries(this.notizen.notiz_id);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -97,14 +107,20 @@ export default {
|
||||
this.formData.text = null;
|
||||
this.formData.von = null;
|
||||
this.formData.bis = null;
|
||||
this.formData.dms_id = null;
|
||||
this.formData.document = null;
|
||||
this.formData.erledigt = false;
|
||||
this.formData.verfasser = null;
|
||||
this.formData.bearbeiter = null;
|
||||
this.formData.anhang = [];
|
||||
},
|
||||
addNewNotiz(notizData) {
|
||||
console.log(this.formData);
|
||||
const formData = new FormData();
|
||||
Object.entries(this.formData).forEach(([k, v]) => formData.append(k, v));
|
||||
console.log(formData);
|
||||
CoreRESTClient.post('components/stv/Notiz/addNewNotiz/' + this.modelValue.person_id,
|
||||
this.formData
|
||||
formData,
|
||||
{ Headers: { "Content-Type": "multipart/form-data" } }
|
||||
).then(response => {
|
||||
if (!response.data.error) {
|
||||
this.$fhcAlert.alertSuccess('Anlegen von neuer Notiz erfolgreich');
|
||||
@@ -123,6 +139,9 @@ export default {
|
||||
window.scrollTo(0, 0);
|
||||
});
|
||||
},
|
||||
attachFile(){
|
||||
console.log("ATTACH FILE");
|
||||
},
|
||||
deleteNotiz(notiz_id){
|
||||
CoreRESTClient.post('components/stv/Notiz/deleteNotiz/' + notiz_id)
|
||||
.then(response => {
|
||||
@@ -139,12 +158,30 @@ export default {
|
||||
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;
|
||||
else
|
||||
{
|
||||
this.formData.anhang = {};
|
||||
this.$fhcAlert.alertError('Kein Dokumenteneintrag mit NotizId ' + notiz_id + ' gefunden');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
);
|
||||
},
|
||||
loadNotiz(notiz_id){
|
||||
return CoreRESTClient.get('components/stv/Notiz/loadNotiz/' + notiz_id)
|
||||
.then(
|
||||
result => {
|
||||
if(result.data.retval)
|
||||
if(result.data.retval) {
|
||||
this.notizen = result.data.retval;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
this.notizen = {};
|
||||
@@ -162,10 +199,11 @@ export default {
|
||||
this.formData.text = null;
|
||||
this.formData.von = null;
|
||||
this.formData.bis = null;
|
||||
this.formData.dms_id = null;
|
||||
this.formData.document = null;
|
||||
this.formData.erledigt = false;
|
||||
this.formData.verfasser = null;
|
||||
this.formData.bearbeiter = null;
|
||||
this.formData.anhang = [];
|
||||
},
|
||||
updateNotiz(notiz_id){
|
||||
CoreRESTClient.post('components/stv/Notiz/updateNotiz/' + notiz_id,
|
||||
@@ -189,11 +227,12 @@ export default {
|
||||
window.scrollTo(0, 0);
|
||||
//this.reload();
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
template: `
|
||||
<div class="stv-details-details h-100 pb-3">
|
||||
|
||||
{{modelValue}}
|
||||
|
||||
<!--Modal: deleteNotizModal-->
|
||||
<BsModal ref="deleteNotizModal">
|
||||
<template #title>Notiz löschen</template>
|
||||
@@ -205,7 +244,7 @@ export default {
|
||||
<button ref="Close" type="button" class="btn btn-primary" @click="deleteNotiz(notizen.notiz_id)">OK</button>
|
||||
</template>
|
||||
</BsModal>
|
||||
|
||||
|
||||
<core-filter-cmpt
|
||||
ref="table"
|
||||
:tabulator-options="tabulatorOptions"
|
||||
@@ -220,20 +259,30 @@ export default {
|
||||
</core-filter-cmpt>
|
||||
|
||||
<br>
|
||||
<hr>
|
||||
<Notiz
|
||||
:showErweitert="showErweitert"
|
||||
:showDocument="showDocument"
|
||||
v-model:titel="formData.titel"
|
||||
v-model:text="formData.text"
|
||||
v-model:action="formData.action"
|
||||
v-model:action="formData.action"
|
||||
v-model:von="formData.von"
|
||||
v-model:bis="formData.bis"
|
||||
v-model:document="formData.dms_id"
|
||||
v-model:document="formData.document"
|
||||
v-model:erledigt="formData.erledigt"
|
||||
v-model:verfasser="formData.verfasser"
|
||||
v-model:bearbeiter="formData.bearbeiter"
|
||||
></Notiz>
|
||||
v-model:anhang="formData.anhang"
|
||||
>
|
||||
</Notiz>
|
||||
|
||||
<button v-if="formData.action === 'Neue Notiz'" type="button" class="btn btn-primary" @click="addNewNotiz()"> Neu anlegen </button>
|
||||
<button v-else type="button" class="btn btn-warning" @click="updateNotiz(notizen.notiz_id)"> Speichern </button>
|
||||
|
||||
|
||||
<div>
|
||||
parent: {{anhang}} | {{formData.anhang.name}}
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
};
|
||||
Reference in New Issue
Block a user