mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
add ckeditor for comment
This commit is contained in:
parent
e135b98072
commit
71f794c4d9
@ -76,8 +76,6 @@
|
|||||||
v-for="conc in concByPosition(position.id)"
|
v-for="conc in concByPosition(position.id)"
|
||||||
v-bind:key="conc.person.id"
|
v-bind:key="conc.person.id"
|
||||||
v-bind:conc="conc"
|
v-bind:conc="conc"
|
||||||
draggable="true"
|
|
||||||
@dragstart="onStartDragConcern($event, conc.person.id)"
|
|
||||||
>
|
>
|
||||||
</member-details>
|
</member-details>
|
||||||
<div
|
<div
|
||||||
@ -163,7 +161,6 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
addNewPersons({ selected, modal }) {
|
addNewPersons({ selected, modal }) {
|
||||||
console.log(selected);
|
|
||||||
selected.forEach(function(item) {
|
selected.forEach(function(item) {
|
||||||
this.$store.dispatch('addConcerned', item.result);
|
this.$store.dispatch('addConcerned', item.result);
|
||||||
}, this);
|
}, this);
|
||||||
@ -171,15 +168,11 @@ export default {
|
|||||||
modal.showModal = false;
|
modal.showModal = false;
|
||||||
},
|
},
|
||||||
onStartDragConcern(evt, person_id) {
|
onStartDragConcern(evt, person_id) {
|
||||||
console.log(evt);
|
|
||||||
console.log(person_id);
|
|
||||||
evt.dataTransfer.dropEffect = 'move'
|
evt.dataTransfer.dropEffect = 'move'
|
||||||
evt.dataTransfer.effectAllowed = 'move'
|
evt.dataTransfer.effectAllowed = 'move'
|
||||||
evt.dataTransfer.setData('application/x.person', person_id)
|
evt.dataTransfer.setData('application/x.person', person_id)
|
||||||
},
|
},
|
||||||
onDropConcern(evt, position_id) {
|
onDropConcern(evt, position_id) {
|
||||||
console.log(evt);
|
|
||||||
console.log('position_id', position_id);
|
|
||||||
const person_id = Number(evt.dataTransfer.getData('application/x.person'));
|
const person_id = Number(evt.dataTransfer.getData('application/x.person'));
|
||||||
this.moveToPosition(person_id, position_id);
|
this.moveToPosition(person_id, position_id);
|
||||||
},
|
},
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
<div class="item-row person">
|
<div class="item-row person">
|
||||||
<div class="item-col box-person">
|
<div class="item-col box-person">
|
||||||
<div>
|
<div>
|
||||||
<img src="~ChillMainAssets/img/draggable.svg" class="drag-icon" />
|
|
||||||
<person :person="conc.person"></person>
|
<person :person="conc.person"></person>
|
||||||
<span v-if="isHolder" class="badge badge-primary holder">
|
<span v-if="isHolder" class="badge badge-primary holder">
|
||||||
{{ $t('household_members_editor.holder') }}
|
{{ $t('household_members_editor.holder') }}
|
||||||
@ -21,6 +20,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="item-row comment">
|
||||||
|
<ckeditor :editor="editor" v-model="comment" tag-name="textarea"></ckeditor>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="item-row participation-details">
|
<div class="item-row participation-details">
|
||||||
<div v-if="conc.position.allowHolder" class="action">
|
<div v-if="conc.position.allowHolder" class="action">
|
||||||
<button class="btn" :class="{ 'btn-primary': isHolder, 'btn-secondary': !isHolder}" @click="toggleHolder">
|
<button class="btn" :class="{ 'btn-primary': isHolder, 'btn-secondary': !isHolder}" @click="toggleHolder">
|
||||||
@ -71,24 +74,43 @@ div.participation-details {
|
|||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import Person from 'ChillPersonAssets/vuejs/_components/Person/Person.vue';
|
import Person from 'ChillPersonAssets/vuejs/_components/Person/Person.vue';
|
||||||
|
import CKEditor from '@ckeditor/ckeditor5-vue';
|
||||||
|
import ClassicEditor from 'ChillMainAssets/modules/ckeditor5/index.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'MemberDetails',
|
name: 'MemberDetails',
|
||||||
components: {
|
components: {
|
||||||
Person,
|
Person,
|
||||||
|
ckeditor: CKEditor.component,
|
||||||
},
|
},
|
||||||
props: [
|
props: [
|
||||||
'conc'
|
'conc'
|
||||||
],
|
],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
editor: ClassicEditor,
|
||||||
|
};
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters( [
|
...mapGetters( [
|
||||||
'concByPersonId'
|
'concByPersonId'
|
||||||
]),
|
]),
|
||||||
isHolder() {
|
isHolder() {
|
||||||
return this.conc.holder;
|
return this.conc.holder;
|
||||||
|
},
|
||||||
|
comment: {
|
||||||
|
get() {
|
||||||
|
return this.conc.comment;
|
||||||
|
},
|
||||||
|
set(text) {
|
||||||
|
console.log('set comment');
|
||||||
|
console.log('comment', text);
|
||||||
|
|
||||||
|
this.$store.dispatch('setComment', { conc: this.conc, comment: text });
|
||||||
}
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toggleHolder() {
|
toggleHolder() {
|
||||||
this.$store.dispatch('toggleHolder', this.conc);
|
this.$store.dispatch('toggleHolder', this.conc);
|
||||||
},
|
},
|
||||||
|
@ -9,7 +9,8 @@ const concerned = window.household_members_editor_data.persons.map(p => {
|
|||||||
person: p,
|
person: p,
|
||||||
position: null,
|
position: null,
|
||||||
allowRemove: false,
|
allowRemove: false,
|
||||||
holder: false
|
holder: false,
|
||||||
|
comment: "",
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -28,8 +29,6 @@ const store = createStore({
|
|||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
isHouseholdNew(state) {
|
isHouseholdNew(state) {
|
||||||
console.log('isHouseholdNew', !Number.isInteger(state.household.id));
|
|
||||||
console.log('household', state.household);
|
|
||||||
return !Number.isInteger(state.household.id);
|
return !Number.isInteger(state.household.id);
|
||||||
},
|
},
|
||||||
hasHousehold(state) {
|
hasHousehold(state) {
|
||||||
@ -80,7 +79,6 @@ const store = createStore({
|
|||||||
|
|
||||||
for (let i in state.concerned) {
|
for (let i in state.concerned) {
|
||||||
conc = state.concerned[i];
|
conc = state.concerned[i];
|
||||||
console.log('loop', conc);
|
|
||||||
payload.concerned.push({
|
payload.concerned.push({
|
||||||
person: {
|
person: {
|
||||||
id: conc.person.id,
|
id: conc.person.id,
|
||||||
@ -91,7 +89,7 @@ const store = createStore({
|
|||||||
type: conc.position.type
|
type: conc.position.type
|
||||||
},
|
},
|
||||||
holder: conc.holder,
|
holder: conc.holder,
|
||||||
comment: "",
|
comment: conc.comment,
|
||||||
start_date: {
|
start_date: {
|
||||||
datetime: datetimeToISO(state.startDate)
|
datetime: datetimeToISO(state.startDate)
|
||||||
}
|
}
|
||||||
@ -109,26 +107,23 @@ const store = createStore({
|
|||||||
person,
|
person,
|
||||||
position: null,
|
position: null,
|
||||||
allowRemove: true,
|
allowRemove: true,
|
||||||
holder: false
|
holder: false,
|
||||||
|
comment: "",
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.err("person already included");
|
console.err("person already included");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
markPosition(state, { person_id, position_id}) {
|
markPosition(state, { person_id, position_id}) {
|
||||||
console.log('from mutation markPosition');
|
|
||||||
console.log('person_id', person_id);
|
|
||||||
console.log('position_id', position_id);
|
|
||||||
console.log('state', state.concerned);
|
|
||||||
let
|
let
|
||||||
position = state.positions.find(pos => pos.id === position_id),
|
position = state.positions.find(pos => pos.id === position_id),
|
||||||
conc = state.concerned.find(c => c.person.id === person_id);
|
conc = state.concerned.find(c => c.person.id === person_id);
|
||||||
console.log(position);
|
|
||||||
console.log(conc);
|
|
||||||
conc.position = position;
|
conc.position = position;
|
||||||
},
|
},
|
||||||
|
setComment(state, {conc, comment}) {
|
||||||
|
conc.comment = comment;
|
||||||
|
},
|
||||||
toggleHolder(state, conc) {
|
toggleHolder(state, conc) {
|
||||||
console.log('toggleHolder', conc);
|
|
||||||
conc.holder = !conc.holder;
|
conc.holder = !conc.holder;
|
||||||
},
|
},
|
||||||
removePosition(state, conc) {
|
removePosition(state, conc) {
|
||||||
@ -156,14 +151,10 @@ const store = createStore({
|
|||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
addConcerned({ commit, dispatch }, person) {
|
addConcerned({ commit, dispatch }, person) {
|
||||||
console.log('from actions addConcerned');
|
|
||||||
commit('addConcerned', person);
|
commit('addConcerned', person);
|
||||||
dispatch('computeWarnings');
|
dispatch('computeWarnings');
|
||||||
},
|
},
|
||||||
markPosition({ commit, state, dispatch }, { person_id, position_id }) {
|
markPosition({ commit, state, dispatch }, { person_id, position_id }) {
|
||||||
console.log('from action markPosition');
|
|
||||||
console.log('person_id', person_id);
|
|
||||||
console.log('position_id', position_id);
|
|
||||||
commit('markPosition', { person_id, position_id });
|
commit('markPosition', { person_id, position_id });
|
||||||
dispatch('computeWarnings');
|
dispatch('computeWarnings');
|
||||||
},
|
},
|
||||||
@ -189,6 +180,9 @@ const store = createStore({
|
|||||||
setStartDate({ commit }, date) {
|
setStartDate({ commit }, date) {
|
||||||
commit('setStartDate', date);
|
commit('setStartDate', date);
|
||||||
},
|
},
|
||||||
|
setComment({ commit }, payload) {
|
||||||
|
commit('setComment', payload);
|
||||||
|
},
|
||||||
computeWarnings({ commit, state, getters }) {
|
computeWarnings({ commit, state, getters }) {
|
||||||
let warnings = [],
|
let warnings = [],
|
||||||
payload;
|
payload;
|
||||||
@ -211,7 +205,6 @@ const store = createStore({
|
|||||||
confirm({ getters }) {
|
confirm({ getters }) {
|
||||||
let payload = getters.buildPayload;
|
let payload = getters.buildPayload;
|
||||||
householdMove(payload).then(household => {
|
householdMove(payload).then(household => {
|
||||||
console.log('move success', household);
|
|
||||||
let id = household.id;
|
let id = household.id;
|
||||||
// nothing to do anymore here, bye-bye !
|
// nothing to do anymore here, bye-bye !
|
||||||
window.location.replace(`/fr/person/household/{id}/members`);
|
window.location.replace(`/fr/person/household/{id}/members`);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user