Notizcomponent: Tinymce optional

This commit is contained in:
ma0068
2024-02-06 08:08:17 +01:00
parent 23853e4a19
commit 1ddf5a8370
3 changed files with 55 additions and 53 deletions
@@ -224,8 +224,8 @@ class Notiz extends FHC_Controller
$bearbeiter_uid = isset($_POST['bearbeiter']) ? $_POST['bearbeiter'] : $uid;
$erledigt = $this->input->post('erledigt');
//$type = $this->input->post('typeId'); //soll auch dieser geändert werden können?
$start = $this->input->post('Von');
$ende = $this->input->post('Bis');
$start = $this->input->post('von');
$ende = $this->input->post('bis');
$result = $this->NotizModel->update(
[
@@ -443,7 +443,7 @@ class Notiz extends FHC_Controller
public function titel_required($value)
{
if (empty($value)) {
$this->form_validation->set_message('titel_required', $this->p->t('ui','error_fieldRequired',['field' => 'Titel']));
$this->form_validation->set_message('titel_required', $this->p->t('ui', 'error_fieldRequired', ['field' => 'Titel']));
return false;
}
else
@@ -455,7 +455,7 @@ class Notiz extends FHC_Controller
public function text_required($value)
{
if (empty($value)) {
$this->form_validation->set_message('text_required', $this->p->t('ui','error_fieldRequired',['field' => 'Text']));
$this->form_validation->set_message('text_required', $this->p->t('ui', 'error_fieldRequired', ['field' => 'Text']));
return false;
}
else
+45 -36
View File
@@ -18,7 +18,8 @@ export default {
'typeId',
'id',
'showErweitert',
'showDocument'
'showDocument',
'showTinyMCE'
],
data(){
return {
@@ -45,7 +46,9 @@ export default {
let button = document.createElement('button');
button.className = 'btn btn-outline-secondary btn-action';
button.innerHTML = '<i class="fa fa-edit"></i>';
button.addEventListener('click', (event) =>
button.addEventListener(
'click',
(event) =>
this.actionEditNotiz(cell.getData().notiz_id)
);
container.append(button);
@@ -53,7 +56,9 @@ export default {
button = document.createElement('button');
button.className = 'btn btn-outline-secondary btn-action';
button.innerHTML = '<i class="fa fa-xmark"></i>';
button.addEventListener('click', () =>
button.addEventListener(
'click',
() =>
this.actionDeleteNotiz(cell.getData().notiz_id)
);
container.append(button);
@@ -61,8 +66,7 @@ export default {
return container;
},
frozen: true
}
],
}],
layout: 'fitDataFill',
layoutColumnsOnNewData: false,
height: '150',
@@ -109,14 +113,15 @@ export default {
this.notizData.titel = this.notizen.titel;
this.notizData.statusNew = false;
this.notizData.text = this.notizen.text;
this.notizData.intText = this.notizen.text;
this.notizData.lastChange = this.notizen.lastupdate;
this.notizData.von = this.notizen.start;
this.notizData.bis = this.notizen.ende;
this.notizData.document = this.notizen.dms_id;
this.notizData.erledigt = this.notizen.erledigt;
this.notizData.verfasser = this.notizen.verfasser_uid; //todo(manu) better
this.notizData.verfasser = this.notizen.verfasser_uid;
this.notizData.intVerfasser = this.notizen.verfasser_uid;
this.notizData.intBearbeiter = this.notizen.bearbeiter_uid; //todo(manu) better
this.notizData.intBearbeiter = this.notizen.bearbeiter_uid;
this.notizData.bearbeiter = this.notizen.bearbeiter_uid;
}
})
@@ -170,19 +175,17 @@ 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);
});
},
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);
}
else {
this.notizen = {};
@@ -273,7 +276,7 @@ export default {
this.filteredMitarbeiter = CoreRESTClient.getData(result.data);
});
},
/* initTinyMCE() {
initTinyMCE() {
const vm = this;
tinymce.init({
@@ -299,16 +302,22 @@ export default {
editor.on('input', () => {
const newContent = editor.getContent();
vm.intText = newContent;
vm.notizData.text = newContent;
//vm.text = newContent;
console.log('vm.text: ' + newContent);
});
},
});
},*/
},
updateText(value) {
this.notizData.text = value;
}
},
created(){
this.getUid();
},
async mounted() {
this.initTinyMCE();
await this.$p.loadCategory(['notiz','global']);
let cm = this.$refs.table.tabulator.columnManager;
@@ -341,11 +350,9 @@ export default {
title: this.$p.t('notiz', 'letzte_aenderung')
});
},
/* mounted() {
this.initTinyMCE();
},*/
/* watch: {
intText: function(newVal) {
watch: {
//watcher für Tinymce-Textfeld
'notizData.text': function (newVal) {
const tinymcsVal = this.editor.getContent();
if (tinymcsVal != newVal) {
@@ -353,11 +360,6 @@ export default {
this.editor.setContent(newVal);
}
},
},*/
beforeDestroy() {
this.editor.destroy();
},
watch: {
//Watcher für autocomplete Bearbeiter und Verfasser
'notizData.intBearbeiter': {
handler(newVal) {
@@ -376,6 +378,9 @@ export default {
deep: true
}
},
beforeDestroy() {
this.editor.destroy();
},
template: `
<div class="notiz-notiz">
@@ -431,14 +436,18 @@ export default {
<div class="row mb-3">
<label for="text" class="form-label col-sm-2">{{$p.t('global','text')}}</label>
<!--Todo(manu) make TINYMCE optional -->
<!-- TinyMce 5 -->
<!-- <div class="col-sm-7">
<textarea ref="editor" rows="5" cols="75" class="form-control"></textarea>
<div v-if="showTinyMCE"class="col-sm-7">
<textarea
ref="editor"
rows="5"
cols="75"
class="form-control"
:value="notizData.text"
@input="updateText"></textarea>
</div>
-->
<div class="col-sm-7">
<div v-else class="col-sm-7">
<textarea rows="5" cols="75" v-model="notizData.text" class="form-control"></textarea>
</div>
@@ -470,7 +479,7 @@ export default {
<div class="col-sm-3">
<vue-date-picker
id="von"
v-model="notizData.Von"
v-model="notizData.von"
clearable="false"
auto-apply
:enable-time-picker="false"
@@ -490,13 +499,13 @@ export default {
<div class="col-sm-3">
<vue-date-picker
id="bis"
v-model="notizData.Bis"
v-model="notizData.bis"
clearable="false"
auto-apply
:enable-time-picker="false"
format="dd.MM.yyyy"
preview-format="dd.MM.yyyy"></vue-date-picker>
</div>
</div>
</div>
@@ -9,8 +9,10 @@ export default {
},
data(){
return {
showErweitert: true, //show details verfasser, bearbeiter, von, bis, erledigt
/* showErweitert: true, //show details verfasser, bearbeiter, von, bis, erledigt
showDocument: true, //show upload documents
showTinyMCE: true
*/
};
},
template: `
@@ -22,7 +24,8 @@ export default {
:id="modelValue.person_id"
:showErweitert=true
:showDocument=true
>
:showTinyMCE=true
>
</NotizComponent>
<br><br>
@@ -33,19 +36,9 @@ export default {
:id="modelValue.prestudent_id"
:showErweitert=false
:showDocument=true
>
>
</NotizComponent>
<br><br>
<h3>Test Projekt</h3>
<NotizComponent
ref="formc"
typeId="projekt_kurzbz"
:id="ZeitErfassung"
:showErweitert=true
:showDocument=false
>
</NotizComponent>
</div>
`
};