mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 08:22:17 +00:00
use endpoint for Messages, refactor component Vorlagendropdown to fhcapi
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Copyright (C) 2025 fhcomplete.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export default {
|
||||
getVorlagen() {
|
||||
return {
|
||||
method: 'get',
|
||||
url: 'api/frontend/v1/vorlagen/vorlagen/getVorlagen/'
|
||||
};
|
||||
},
|
||||
getVorlagenByLoggedInUser() {
|
||||
return {
|
||||
method: 'get',
|
||||
url: 'api/frontend/v1/vorlagen/vorlagen/getVorlagenByLoggedInUser/'
|
||||
};
|
||||
},
|
||||
|
||||
};
|
||||
@@ -4,8 +4,6 @@ import FormInput from '../../../Form/Input.js';
|
||||
import ListBox from "../../../../../../index.ci.php/public/js/components/primevue/listbox/listbox.esm.min.js";
|
||||
import DropdownComponent from "../../../VorlagenDropdown/VorlagenDropdown.js";
|
||||
|
||||
import ApiMessages from '../../../../api/factory/messages/messages.js';
|
||||
|
||||
export default {
|
||||
name: "ModalNewMessages",
|
||||
components: {
|
||||
@@ -17,7 +15,7 @@ export default {
|
||||
},
|
||||
props: {
|
||||
endpoint: {
|
||||
type: String,
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
typeId: String,
|
||||
@@ -124,7 +122,7 @@ export default {
|
||||
data.append('data', JSON.stringify(merged));
|
||||
|
||||
return this.$refs.formMessage
|
||||
.call(ApiMessages.sendMessageFromModalContext(this.uid, data))
|
||||
.call(this.endpoint.sendMessageFromModalContext(this.uid, data))
|
||||
.then(response => {
|
||||
this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSent'));
|
||||
this.hideModal('modalNewMessage');
|
||||
@@ -140,7 +138,7 @@ export default {
|
||||
},
|
||||
getVorlagentext(vorlage_kurzbz){
|
||||
return this.$api
|
||||
.call(ApiMessages.getVorlagentext(vorlage_kurzbz))
|
||||
.call(this.endpoint.getVorlagentext(vorlage_kurzbz))
|
||||
.then(response => {
|
||||
this.formData.body = response.data;
|
||||
}).catch(this.$fhcAlert.handleSystemError)
|
||||
@@ -155,7 +153,7 @@ export default {
|
||||
|
||||
data.append('data', JSON.stringify(this.formData.body));
|
||||
return this.$api
|
||||
.call(ApiMessages.getPreviewText({
|
||||
.call(this.endpoint.getPreviewText({
|
||||
id: this.id,
|
||||
type_id: this.typeId}, data))
|
||||
.then(response => {
|
||||
@@ -214,7 +212,7 @@ export default {
|
||||
type_id: typeId
|
||||
};
|
||||
this.$api
|
||||
.call(ApiMessages.getUid(params))
|
||||
.call(this.endpoint.getUid(params))
|
||||
.then(result => {
|
||||
this.uid = result.data;
|
||||
})
|
||||
@@ -252,7 +250,7 @@ export default {
|
||||
if (!newMessageId) return;
|
||||
|
||||
try {
|
||||
const result = await this.$api.call(ApiMessages.getReplyData(newMessageId));
|
||||
const result = await this.$api.call(this.endpoint.getReplyData(newMessageId));
|
||||
this.replyData = result.data;
|
||||
|
||||
if (this.replyData.length > 0) {
|
||||
@@ -275,7 +273,7 @@ export default {
|
||||
type_id: this.typeId
|
||||
};
|
||||
this.$api
|
||||
.call(ApiMessages.getMessageVarsPerson(params))
|
||||
.call(this.endpoint.getMessageVarsPerson(params))
|
||||
.then(result => {
|
||||
this.fieldsPerson = result.data;
|
||||
const person = this.fieldsPerson[0];
|
||||
@@ -293,7 +291,7 @@ export default {
|
||||
type_id: this.typeId
|
||||
};
|
||||
this.$api
|
||||
.call(ApiMessages.getMsgVarsPrestudent(params))
|
||||
.call(this.endpoint.getMsgVarsPrestudent(params))
|
||||
.then(result => {
|
||||
this.fieldsPrestudent = result.data;
|
||||
const prestudent = this.fieldsPrestudent[0];
|
||||
@@ -306,7 +304,7 @@ export default {
|
||||
}
|
||||
|
||||
this.$api
|
||||
.call(ApiMessages.getMsgVarsLoggedInUser())
|
||||
.call(this.endpoint.getMsgVarsLoggedInUser())
|
||||
.then(result => {
|
||||
this.fieldsUser = result.data;
|
||||
const user = this.fieldsUser;
|
||||
@@ -318,7 +316,7 @@ export default {
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
|
||||
this.$api
|
||||
.call(ApiMessages.getNameOfDefaultRecipient({
|
||||
.call(this.endpoint.getNameOfDefaultRecipient({
|
||||
id: this.id,
|
||||
type_id: this.typeId}))
|
||||
.then(result => {
|
||||
@@ -332,7 +330,7 @@ export default {
|
||||
//case of reply
|
||||
if(this.messageId) {
|
||||
this.$api
|
||||
.call(ApiMessages.getReplyData(this.messageId))
|
||||
.call(this.endpoint.getReplyData(this.messageId))
|
||||
.then(result => {
|
||||
this.replyData = result.data;
|
||||
this.formData.subject = this.replyData[0].replySubject;
|
||||
|
||||
@@ -2,7 +2,6 @@ import FormForm from '../../../Form/Form.js';
|
||||
import FormInput from '../../../Form/Input.js';
|
||||
import ListBox from "../../../../../../index.ci.php/public/js/components/primevue/listbox/listbox.esm.min.js";
|
||||
import DropdownComponent from '../../../VorlagenDropdown/VorlagenDropdown.js';
|
||||
import ApiMessages from "../../../../api/factory/messages/messages.js";
|
||||
|
||||
export default {
|
||||
name: "ComponentNewMessages",
|
||||
@@ -14,7 +13,7 @@ export default {
|
||||
},
|
||||
props: {
|
||||
endpoint: {
|
||||
type: String,
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
openMode: String,
|
||||
@@ -119,7 +118,7 @@ export default {
|
||||
};
|
||||
data.append('data', JSON.stringify(merged));
|
||||
return this.$api
|
||||
.call(ApiMessages.sendMessage(this.uid, data))
|
||||
.call(this.endpoint.sendMessage(this.uid, data))
|
||||
.then(response => {
|
||||
this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSent'));
|
||||
this.hideTemplate();
|
||||
@@ -139,7 +138,7 @@ export default {
|
||||
},
|
||||
getVorlagentext(vorlage_kurzbz){
|
||||
return this.$api
|
||||
.call(ApiMessages.getVorlagentext(vorlage_kurzbz))
|
||||
.call(this.endpoint.getVorlagentext(vorlage_kurzbz))
|
||||
.then(response => {
|
||||
this.formData.body = response.data;
|
||||
}).catch(this.$fhcAlert.handleSystemError)
|
||||
@@ -152,7 +151,7 @@ export default {
|
||||
|
||||
data.append('data', JSON.stringify(this.formData.body));
|
||||
return this.$api
|
||||
.call(ApiMessages.getPreviewText({
|
||||
.call(this.endpoint.getPreviewText({
|
||||
id: this.id,
|
||||
type_id: this.typeId}, data))
|
||||
.then(response => {
|
||||
@@ -226,7 +225,7 @@ export default {
|
||||
type_id: typeId
|
||||
};
|
||||
this.$api
|
||||
.call(ApiMessages.getUid(params))
|
||||
.call(this.endpoint.getUid(params))
|
||||
.then(result => {
|
||||
this.uid = result.data;
|
||||
})
|
||||
@@ -264,7 +263,7 @@ export default {
|
||||
};
|
||||
|
||||
this.$api
|
||||
.call(ApiMessages.getMessageVarsPerson(params))
|
||||
.call(this.endpoint.getMessageVarsPerson(params))
|
||||
.then(result => {
|
||||
this.fieldsPerson = result.data;
|
||||
const person = this.fieldsPerson[0];
|
||||
@@ -282,7 +281,7 @@ export default {
|
||||
type_id: this.typeId
|
||||
};
|
||||
this.$api
|
||||
.call(ApiMessages.getMsgVarsPrestudent(params))
|
||||
.call(this.endpoint.getMsgVarsPrestudent(params))
|
||||
.then(result => {
|
||||
this.fieldsPrestudent = result.data;
|
||||
const prestudent = this.fieldsPrestudent[0];
|
||||
@@ -296,7 +295,7 @@ export default {
|
||||
}
|
||||
|
||||
this.$api
|
||||
.call(ApiMessages.getMsgVarsLoggedInUser())
|
||||
.call(this.endpoint.getMsgVarsLoggedInUser())
|
||||
.then(result => {
|
||||
this.fieldsUser = result.data;
|
||||
const user = this.fieldsUser;
|
||||
@@ -308,7 +307,7 @@ export default {
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
|
||||
this.$api
|
||||
.call(ApiMessages.getNameOfDefaultRecipient({
|
||||
.call(this.endpoint.getNameOfDefaultRecipient({
|
||||
id: this.id,
|
||||
type_id: this.typeId}))
|
||||
.then(result => {
|
||||
@@ -322,7 +321,7 @@ export default {
|
||||
//case of reply
|
||||
if(this.messageId != null) {
|
||||
this.$api
|
||||
.call(ApiMessages.getReplyData(this.messageId))
|
||||
.call(this.endpoint.getReplyData(this.messageId))
|
||||
.then(result => {
|
||||
this.replyData = result.data;
|
||||
this.formData.subject = this.replyData[0].replySubject;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import {CoreFilterCmpt} from "../../filter/Filter.js";
|
||||
import FormForm from '../../Form/Form.js';
|
||||
|
||||
import ApiMessages from '../../../api/factory/messages/messages.js';
|
||||
|
||||
export default {
|
||||
name: "TableMessages",
|
||||
components: {
|
||||
@@ -16,7 +14,7 @@ export default {
|
||||
},
|
||||
props: {
|
||||
endpoint: {
|
||||
type: String,
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
typeId: String,
|
||||
@@ -257,7 +255,7 @@ export default {
|
||||
},
|
||||
deleteMessage(message_id){
|
||||
return this.$api
|
||||
.call(ApiMessages.deleteMessage(message_id))
|
||||
.call(this.endpoint.deleteMessage(message_id))
|
||||
.then(response => {
|
||||
this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete'));
|
||||
}).catch(this.$fhcAlert.handleSystemError)
|
||||
@@ -318,7 +316,7 @@ export default {
|
||||
},
|
||||
loadAjaxCall(url, config, params){
|
||||
return this.$api.call(
|
||||
ApiMessages.getMessages(params)
|
||||
this.endpoint.getMessages(params)
|
||||
);
|
||||
}
|
||||
},
|
||||
@@ -349,7 +347,7 @@ export default {
|
||||
type_id: this.typeId
|
||||
};
|
||||
this.$api
|
||||
.call(ApiMessages.getPersonId(params))
|
||||
.call(this.endpoint.getPersonId(params))
|
||||
.then(result => {
|
||||
this.personId = result.data;
|
||||
})
|
||||
|
||||
@@ -15,7 +15,7 @@ export default {
|
||||
},
|
||||
props: {
|
||||
endpoint: {
|
||||
type: String,
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
typeId: {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import CoreMessages from "../../../Messages/Messages.js";
|
||||
import ApiMessages from "../../../../api/factory/messages/messages.js";
|
||||
|
||||
export default {
|
||||
name: "TabMessages",
|
||||
@@ -8,13 +9,18 @@ export default {
|
||||
props: {
|
||||
modelValue: Object
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
endpoint: ApiMessages
|
||||
};
|
||||
},
|
||||
template: `
|
||||
<div class="stv-details-messages h-100 pb-3 overflow-hidden">
|
||||
|
||||
<template v-if="modelValue.prestudent_id">
|
||||
<core-messages
|
||||
ref="formc"
|
||||
endpoint="$fhcApi.factory.messages.person"
|
||||
:endpoint="endpoint"
|
||||
type-id="prestudent_id"
|
||||
:id="modelValue.prestudent_id"
|
||||
messageLayout="twoColumnsTableLeft"
|
||||
|
||||
@@ -2,6 +2,8 @@ import {CoreFilterCmpt} from "../filter/Filter.js";
|
||||
import FormForm from '../Form/Form.js';
|
||||
import FormInput from '../Form/Input.js';
|
||||
|
||||
import ApiVorlage from '../../api/factory/vorlagen.js';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
FormForm,
|
||||
@@ -39,7 +41,8 @@ export default {
|
||||
},
|
||||
created() {
|
||||
if(this.isAdmin) {
|
||||
this.$fhcApi.factory.vorlagen.getVorlagen()
|
||||
this.$api
|
||||
.call(ApiVorlage.getVorlagen())
|
||||
.then(result => {
|
||||
this.vorlagen = result.data;
|
||||
})
|
||||
@@ -47,7 +50,8 @@ export default {
|
||||
}
|
||||
|
||||
if(this.useLoggedInUserOe){
|
||||
this.$fhcApi.factory.vorlagen.getVorlagenByLoggedInUser()
|
||||
this.$api
|
||||
.call(ApiVorlage.getVorlagenByLoggedInUser())
|
||||
.then(result => {
|
||||
//console.log(this.vorlagenOe);
|
||||
this.vorlagenOe = result.data;
|
||||
|
||||
Reference in New Issue
Block a user