mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch '2133-Messages-in-Admin-Interface' into Contribution-Messages
This commit is contained in:
commit
8adf366c52
@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<div class="contribution-messages-formular">
|
||||
<div v-if="form.text !== ''" class="mt-5">
|
||||
<h4>{{ $t('preview') }}</h4>
|
||||
<div class="border border-info m-5">
|
||||
<b-row>
|
||||
<b-col cols="1"><b-avatar square text="AA"></b-avatar></b-col>
|
||||
<b-col cols="11">
|
||||
<pre class="mt-2">
|
||||
{{ $store.state.moderator.firstName }} {{ $store.state.moderator.lastName }}
|
||||
</pre>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<b-row>
|
||||
<b-col>
|
||||
<pre class="ml-3 mt-3 mb-5">{{ form.text }}</pre>
|
||||
</b-col>
|
||||
</b-row>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<b-form @submit="onSubmit" @reset="onReset">
|
||||
<b-form-textarea
|
||||
id="textarea"
|
||||
v-model="form.text"
|
||||
placeholder="Enter something..."
|
||||
rows="3"
|
||||
max-rows="6"
|
||||
></b-form-textarea>
|
||||
<b-button type="submit" variant="primary">{{ $t('form.submit') }}</b-button>
|
||||
<b-button type="reset" variant="danger">{{ $t('form.reset') }}</b-button>
|
||||
</b-form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { adminCreateContributionMessage } from '@/graphql/adminCreateContributionMessage'
|
||||
|
||||
export default {
|
||||
name: 'ContributionMessagesFormular',
|
||||
props: {
|
||||
contributionId: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
text: '',
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onSubmit(event) {
|
||||
event.preventDefault()
|
||||
this.$apollo
|
||||
.mutate({
|
||||
mutation: adminCreateContributionMessage,
|
||||
variables: {
|
||||
contributionId: this.contributionId,
|
||||
message: this.form.text,
|
||||
},
|
||||
})
|
||||
.then((result) => {
|
||||
this.toastSuccess(result)
|
||||
})
|
||||
.catch((error) => {
|
||||
this.toastError(error.message)
|
||||
})
|
||||
},
|
||||
onReset(event) {
|
||||
event.preventDefault()
|
||||
this.form.text = ''
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@ -0,0 +1,89 @@
|
||||
<template>
|
||||
<div class="contribution-messages-list">
|
||||
<b-container>
|
||||
<div v-for="message in messages" v-bind:key="message.id">
|
||||
<contribution-messages-list-item :typeId="message.isModerator">
|
||||
<template #1>
|
||||
<is-moderator :message="message"></is-moderator>
|
||||
</template>
|
||||
<template #0>
|
||||
<is-not-moderator :message="message" class="text-right"></is-not-moderator>
|
||||
</template>
|
||||
</contribution-messages-list-item>
|
||||
</div>
|
||||
</b-container>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<contribution-messages-formular :contributionId="contributionId" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import ContributionMessagesListItem from './slots/ContributionMessagesListItem.vue'
|
||||
import IsModerator from './slots/IsModerator.vue'
|
||||
import IsNotModerator from './slots/IsNotModerator.vue'
|
||||
import ContributionMessagesFormular from '../ContributionMessages/ContributionMessagesFormular.vue'
|
||||
|
||||
export default {
|
||||
name: 'ContributionMessagesList',
|
||||
props: {
|
||||
contributionId: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
components: {
|
||||
ContributionMessagesListItem,
|
||||
IsModerator,
|
||||
IsNotModerator,
|
||||
ContributionMessagesFormular,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
messages: [
|
||||
{
|
||||
id: '0',
|
||||
msgid: '0',
|
||||
memo: 'kjsdn sdnnasd andandandak sd n askdna kdnak asdnadjasndk adkand',
|
||||
uuid: '1',
|
||||
firstName: 'peter',
|
||||
lastName: 'lustig',
|
||||
isModerator: 1,
|
||||
},
|
||||
{
|
||||
id: '1',
|
||||
msgid: '0',
|
||||
memo: 'nftzfD dfRDTD FDdrD TFt F ZTFZF TZfz FF T TZF Z ff ',
|
||||
uuid: '2',
|
||||
firstName: 'bibi',
|
||||
lastName: 'bloxberg',
|
||||
isModerator: 0,
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
msgid: '0',
|
||||
memo: 'oG iu Hih hi ',
|
||||
uuid: '1',
|
||||
firstName: 'peter',
|
||||
lastName: 'lustig',
|
||||
isModerator: 1,
|
||||
},
|
||||
{
|
||||
id: '3',
|
||||
msgid: '0',
|
||||
memo: 'zdg gdggs ds gdggusgdug nftz s s ZF TZfz FF 564c ',
|
||||
uuid: '2',
|
||||
firstName: 'bibi',
|
||||
lastName: 'bloxberg',
|
||||
isModerator: 0,
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.temp-message {
|
||||
margin-top: 50px;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,16 @@
|
||||
<template>
|
||||
<div>
|
||||
<slot :name="typeId"></slot>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'ContributionMessagesListItem',
|
||||
props: {
|
||||
typeId: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@ -0,0 +1,27 @@
|
||||
<template>
|
||||
<div class="slot-is-moderator">
|
||||
<b-avatar square text="AA"></b-avatar>
|
||||
<span class="ml-2 mr-2">{{ message.firstName }} {{ message.lastName }}</span>
|
||||
<div class="mt-2">{{ message }}</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
message: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {}
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.slot-is-moderator {
|
||||
clear: both;
|
||||
background-color: rgb(250, 158, 207);
|
||||
width: 75%;
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,34 @@
|
||||
<template>
|
||||
<div class="slot-is-not-moderator">
|
||||
<div class="text-right">
|
||||
<b-avatar text="BV"></b-avatar>
|
||||
<span class="ml-2 mr-2 text-bold">{{ message.firstName }} {{ message.lastName }}</span>
|
||||
<div class="mt-2">{{ message }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
message: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {}
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
||||
.slot-is-not-moderator {
|
||||
clear: both;
|
||||
float: right;
|
||||
background-color: aquamarine;
|
||||
width: 75%;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
</style>
|
||||
@ -21,6 +21,10 @@
|
||||
>
|
||||
<b-icon :icon="row.detailsShowing ? 'x' : 'pencil-square'" aria-label="Help"></b-icon>
|
||||
</b-button>
|
||||
<b-button v-else @click="rowToggleDetails(row, 0)">
|
||||
<b-icon icon="chat-dots"></b-icon>
|
||||
<b-icon icon="exclamation-circle-fill"></b-icon>
|
||||
</b-button>
|
||||
</template>
|
||||
<template #cell(confirm)="row">
|
||||
<b-button variant="success" size="md" @click="$emit('show-overlay', row.item)" class="mr-2">
|
||||
@ -33,10 +37,10 @@
|
||||
type="show-creation"
|
||||
slotName="show-creation"
|
||||
:index="0"
|
||||
@row-toggle-details="rowToggleDetails"
|
||||
@row-toggle-details="rowToggleDetails(row, 0)"
|
||||
>
|
||||
<template #show-creation>
|
||||
<div>
|
||||
<div v-if="row.item.moderator">
|
||||
<edit-creation-formular
|
||||
type="singleCreation"
|
||||
:creation="row.item.creation"
|
||||
@ -47,6 +51,9 @@
|
||||
@update-user-data="updateUserData"
|
||||
/>
|
||||
</div>
|
||||
<div v-else>
|
||||
<contribution-messages-list :contributionId="row.item.id" />
|
||||
</div>
|
||||
</template>
|
||||
</row-details>
|
||||
</template>
|
||||
@ -59,12 +66,15 @@ import { toggleRowDetails } from '../../mixins/toggleRowDetails'
|
||||
import RowDetails from '../RowDetails.vue'
|
||||
import EditCreationFormular from '../EditCreationFormular.vue'
|
||||
|
||||
import ContributionMessagesList from '../ContributionMessages/ContributionMessagesList.vue'
|
||||
|
||||
export default {
|
||||
name: 'OpenCreationsTable',
|
||||
mixins: [toggleRowDetails],
|
||||
components: {
|
||||
EditCreationFormular,
|
||||
RowDetails,
|
||||
ContributionMessagesList,
|
||||
},
|
||||
props: {
|
||||
items: {
|
||||
|
||||
15
admin/src/graphql/adminCreateContributionMessage.js
Normal file
15
admin/src/graphql/adminCreateContributionMessage.js
Normal file
@ -0,0 +1,15 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export const adminCreateContributionMessage = gql`
|
||||
mutation ($contributionId: Float!, $message: String!) {
|
||||
adminCreateContributionMessage(contributionId: $contributionId, message: $message) {
|
||||
id
|
||||
message
|
||||
createdAt
|
||||
updatedAt
|
||||
type
|
||||
userFirstName
|
||||
userLastName
|
||||
}
|
||||
}
|
||||
`
|
||||
@ -69,6 +69,10 @@
|
||||
},
|
||||
"short_hash": "({shortHash})"
|
||||
},
|
||||
"form": {
|
||||
"submit": "absenden",
|
||||
"reset": "löschen"
|
||||
},
|
||||
"GDD": "GDD",
|
||||
"hide_details": "Details verbergen",
|
||||
"lastname": "Nachname",
|
||||
@ -155,5 +159,6 @@
|
||||
},
|
||||
"user_deleted": "Nutzer ist gelöscht.",
|
||||
"user_recovered": "Nutzer ist wiederhergestellt.",
|
||||
"user_search": "Nutzer-Suche"
|
||||
"user_search": "Nutzer-Suche",
|
||||
"preview": "Vorschau"
|
||||
}
|
||||
|
||||
@ -69,6 +69,10 @@
|
||||
},
|
||||
"short_hash": "({shortHash})"
|
||||
},
|
||||
"form": {
|
||||
"submit": "submit",
|
||||
"reset": "reset"
|
||||
},
|
||||
"GDD": "GDD",
|
||||
"hide_details": "Hide details",
|
||||
"lastname": "Lastname",
|
||||
@ -155,5 +159,6 @@
|
||||
},
|
||||
"user_deleted": "User is deleted.",
|
||||
"user_recovered": "User is recovered.",
|
||||
"user_search": "User search"
|
||||
"user_search": "User search",
|
||||
"preview": "Preview"
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user