mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-03 20:09:29 +00:00
Adaptierung Notizcomponent: teleport datepicker, tinymce mount conditionally, fehlerhandling missing id and type
This commit is contained in:
@@ -100,21 +100,6 @@ class Notiz extends FHC_Controller
|
||||
}
|
||||
}
|
||||
|
||||
//Überprüfung ob type übergeben wurde (via Funktions- oder Postparameter)
|
||||
$type = null;
|
||||
if ($paramTyp)
|
||||
$type = $paramTyp;
|
||||
if(isset($_POST['typeId']))
|
||||
$type = $this->input->post('typeId');
|
||||
|
||||
if(!$type)
|
||||
{
|
||||
$result = error('kein Type für ID vorhanden', ERROR);
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
|
||||
return $this->outputJson(getError($result));
|
||||
}
|
||||
|
||||
//Form Validation
|
||||
$this->form_validation->set_rules('titel', 'titel', 'callback_titel_required');
|
||||
$this->form_validation->set_rules('text', 'text', 'callback_text_required');
|
||||
|
||||
@@ -152,6 +152,13 @@ class Notiz_model extends DB_Model
|
||||
$verfasser_uid = null,
|
||||
$bearbeiter_uid = null
|
||||
) {
|
||||
|
||||
//check, ob id und type valid
|
||||
if (!isset($id) || ($id == "undefined")) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return error("Id(". $id. ') ist keine gültige ID!');
|
||||
}
|
||||
|
||||
// Loads model Notizzuordnung_model
|
||||
$this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel');
|
||||
|
||||
@@ -160,17 +167,8 @@ class Notiz_model extends DB_Model
|
||||
if (isError($result))
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
|
||||
$result = error($result->retval, EXIT_ERROR);
|
||||
return $result;
|
||||
return error($type . ' ist kein gültiger ID_TYP!');
|
||||
}
|
||||
/*
|
||||
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);
|
||||
|
||||
@@ -67,7 +67,7 @@ export default {
|
||||
},
|
||||
frozen: true
|
||||
}],
|
||||
layout: 'fitDataFill',
|
||||
layout: 'fitColumns',
|
||||
layoutColumnsOnNewData: false,
|
||||
height: '150',
|
||||
selectableRangeMode: 'click',
|
||||
@@ -135,7 +135,7 @@ export default {
|
||||
actionNewNotiz(){
|
||||
this.resetFormData();
|
||||
},
|
||||
addNewNotiz(notizData) {
|
||||
addNewNotiz() {
|
||||
const formData = new FormData();
|
||||
|
||||
formData.append('data', JSON.stringify(this.notizData));
|
||||
@@ -158,6 +158,7 @@ export default {
|
||||
}
|
||||
}).catch(error => {
|
||||
if (error.response) {
|
||||
console.log(error.response);
|
||||
this.$fhcAlert.alertError(error.response.data);
|
||||
}
|
||||
}).finally(() => {
|
||||
@@ -303,8 +304,6 @@ export default {
|
||||
editor.on('input', () => {
|
||||
const newContent = editor.getContent();
|
||||
vm.notizData.text = newContent;
|
||||
//vm.text = newContent;
|
||||
console.log('vm.text: ' + newContent);
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -317,7 +316,10 @@ export default {
|
||||
this.getUid();
|
||||
},
|
||||
async mounted() {
|
||||
this.initTinyMCE();
|
||||
if(this.showTinyMCE){
|
||||
this.initTinyMCE();
|
||||
}
|
||||
|
||||
await this.$p.loadCategory(['notiz','global']);
|
||||
|
||||
let cm = this.$refs.table.tabulator.columnManager;
|
||||
@@ -353,11 +355,13 @@ export default {
|
||||
watch: {
|
||||
//watcher für Tinymce-Textfeld
|
||||
'notizData.text': function (newVal) {
|
||||
const tinymcsVal = this.editor.getContent();
|
||||
if(this.showTinyMCE) {
|
||||
const tinymcsVal = this.editor.getContent();
|
||||
|
||||
if (tinymcsVal != newVal) {
|
||||
//Inhalt des Editors aktualisieren
|
||||
this.editor.setContent(newVal);
|
||||
if (tinymcsVal != newVal) {
|
||||
//Inhalt des Editors aktualisieren
|
||||
this.editor.setContent(newVal);
|
||||
}
|
||||
}
|
||||
},
|
||||
//Watcher für autocomplete Bearbeiter und Verfasser
|
||||
@@ -379,7 +383,9 @@ export default {
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.editor.destroy();
|
||||
if(this.showTinyMCE) {
|
||||
this.editor.destroy();
|
||||
}
|
||||
},
|
||||
template: `
|
||||
<div class="notiz-notiz">
|
||||
@@ -484,6 +490,7 @@ export default {
|
||||
auto-apply
|
||||
:enable-time-picker="false"
|
||||
format="dd.MM.yyyy"
|
||||
:teleport="true"
|
||||
preview-format="dd.MM.yyyy"></vue-date-picker>
|
||||
</div>
|
||||
</div>
|
||||
@@ -504,6 +511,7 @@ export default {
|
||||
auto-apply
|
||||
:enable-time-picker="false"
|
||||
format="dd.MM.yyyy"
|
||||
:teleport="true"
|
||||
preview-format="dd.MM.yyyy"></vue-date-picker>
|
||||
</div>
|
||||
|
||||
@@ -528,8 +536,7 @@ export default {
|
||||
<button v-if="notizData.statusNew" type="button" class="btn btn-primary" @click="addNewNotiz()"> {{$p.t('studierendenantrag', 'btn_new')}}</button>
|
||||
<button v-else type="button" class="btn btn-primary" @click="updateNotiz(notizen.notiz_id)"> {{$p.t('ui', 'speichern')}}</button>
|
||||
|
||||
</form>
|
||||
|
||||
</form>
|
||||
</div>`
|
||||
}
|
||||
|
||||
|
||||
@@ -7,14 +7,6 @@ export default {
|
||||
props: {
|
||||
modelValue: Object
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
/* showErweitert: true, //show details verfasser, bearbeiter, von, bis, erledigt
|
||||
showDocument: true, //show upload documents
|
||||
showTinyMCE: true
|
||||
*/
|
||||
};
|
||||
},
|
||||
template: `
|
||||
<div class="stv-details-details h-100 pb-3">
|
||||
<h3>Notizen</h3>
|
||||
@@ -24,21 +16,37 @@ export default {
|
||||
:id="modelValue.person_id"
|
||||
:showErweitert=true
|
||||
:showDocument=true
|
||||
:showTinyMCE=true
|
||||
:showTinyMCE="true"
|
||||
>
|
||||
</NotizComponent>
|
||||
|
||||
<br><br>
|
||||
<!-- <br><br>
|
||||
<h3>Test prestudentId</h3>
|
||||
<NotizComponent
|
||||
ref="formc"
|
||||
typeId="prestudent_id"
|
||||
:id="modelValue.prestudent_id"
|
||||
:showErweitert=false
|
||||
:showDocument=true
|
||||
>
|
||||
</NotizComponent>
|
||||
|
||||
<br><br>
|
||||
<h3>Test mitarbeiter_uid</h3>
|
||||
<NotizComponent
|
||||
ref="formc"
|
||||
typeId="uid"
|
||||
:id="'ma0068'"
|
||||
>
|
||||
</NotizComponent>-->
|
||||
|
||||
<!-- <br><br>
|
||||
<h3>Test projekt</h3>
|
||||
<NotizComponent
|
||||
ref="formc"
|
||||
typeId="projekt_kurzbz"
|
||||
:id="'Studentenausweis'"
|
||||
>
|
||||
</NotizComponent>-->
|
||||
|
||||
</div>
|
||||
`
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user