mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-16 14:32:18 +00:00
Aktionen Start New, Update, Delete
This commit is contained in:
@@ -172,6 +172,23 @@ class Notiz extends FHC_Controller
|
||||
return $this->outputJsonSuccess(true);
|
||||
}
|
||||
|
||||
public function deleteNotiz ($notiz_id)
|
||||
{
|
||||
$this->load->model('person/Notiz_model', 'NotizModel');
|
||||
|
||||
$result = $this->NotizModel->delete(
|
||||
array('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);
|
||||
}
|
||||
return $this->outputJsonSuccess(current(getData($result)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -71,7 +71,7 @@ export default {
|
||||
},
|
||||
template: `
|
||||
<div>
|
||||
{{intTitel}} {{intText}} {{intVon}}| {{titel}} {{text}} {{action}} {{von}} {{bis}} {{document}} {{erledigt}} {{verfasser}} {{bearbeiter}}
|
||||
<!--{{intTitel}} {{intText}} {{intVon}}| {{titel}} {{text}} {{action}} {{von}} {{bis}} {{document}} {{erledigt}} {{verfasser}} {{bearbeiter}}-->
|
||||
<form class="row">
|
||||
<div class="notizAction row mb-3">
|
||||
<b>{{action}}</b>
|
||||
|
||||
@@ -513,7 +513,7 @@ export default{
|
||||
</template>
|
||||
</BsModal>
|
||||
|
||||
<!--Modal: deleteAdressModal TODO(manu) Formatierung mit zuviel Abstand-->
|
||||
<!--Modal: deleteAdressModal-->
|
||||
<BsModal ref="deleteAdressModal">
|
||||
<template #title>Adresse löschen</template>
|
||||
<template #default>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//import NotizList from "./Notizen/Notizen.js";
|
||||
import {CoreRESTClient} from "../../../../RESTClient.js";
|
||||
import {CoreFilterCmpt} from "../../../filter/Filter.js";
|
||||
import Notiz from "../../../Notiz/Notiz.js";
|
||||
import BsModal from "../../../Bootstrap/Modal";
|
||||
|
||||
var editIcon = function (cell, formatterParams) {
|
||||
return "<i class='fa fa-edit'></i>";
|
||||
@@ -14,7 +14,8 @@ export default {
|
||||
components: {
|
||||
CoreRESTClient,
|
||||
CoreFilterCmpt,
|
||||
Notiz
|
||||
Notiz,
|
||||
BsModal
|
||||
},
|
||||
props: {
|
||||
modelValue: Object
|
||||
@@ -69,6 +70,12 @@ export default {
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
actionDeleteNotiz(notiz_id){
|
||||
this.loadNotiz(notiz_id).then(() => {
|
||||
if(this.notizen.notiz_id)
|
||||
this.$refs.deleteNotizModal.show();
|
||||
});
|
||||
},
|
||||
actionEditNotiz(notiz_id){
|
||||
this.loadNotiz(notiz_id).then(() => {
|
||||
if(this.notizen.notiz_id) {
|
||||
@@ -116,6 +123,22 @@ export default {
|
||||
window.scrollTo(0, 0);
|
||||
});
|
||||
},
|
||||
deleteNotiz(notiz_id){
|
||||
CoreRESTClient.post('components/stv/Notiz/deleteNotiz/' + notiz_id)
|
||||
.then(response => {
|
||||
if (!response.data.error) {
|
||||
this.$fhcAlert.alertSuccess('Löschen erfolgreich');
|
||||
this.$refs.deleteNotizModal.hide();
|
||||
this.reload();
|
||||
} else {
|
||||
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);
|
||||
});
|
||||
},
|
||||
loadNotiz(notiz_id){
|
||||
return CoreRESTClient.get('components/stv/Notiz/loadNotiz/' + notiz_id)
|
||||
.then(
|
||||
@@ -171,6 +194,18 @@ export default {
|
||||
template: `
|
||||
<div class="stv-details-details h-100 pb-3">
|
||||
|
||||
<!--Modal: deleteNotizModal-->
|
||||
<BsModal ref="deleteNotizModal">
|
||||
<template #title>Notiz löschen</template>
|
||||
<template #default>
|
||||
<p>Notiz wirklich löschen?</p>
|
||||
</template>
|
||||
<template #footer>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" @click="resetModal">Abbrechen</button>
|
||||
<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"
|
||||
@@ -184,8 +219,7 @@ export default {
|
||||
>
|
||||
</core-filter-cmpt>
|
||||
|
||||
<br>
|
||||
|
||||
<br>
|
||||
<Notiz
|
||||
v-model:titel="formData.titel"
|
||||
v-model:text="formData.text"
|
||||
@@ -196,14 +230,8 @@ export default {
|
||||
v-model:erledigt="formData.erledigt"
|
||||
v-model:verfasser="formData.verfasser"
|
||||
v-model:bearbeiter="formData.bearbeiter"
|
||||
></Notiz>
|
||||
></Notiz>
|
||||
|
||||
|
||||
<hr>
|
||||
Parent: {{titel}} {{text}}| {{notizTitel}} {{notizText}}
|
||||
<br> {{modelValue}}
|
||||
<br> {{formData}}
|
||||
<hr>
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user