Merge branch '_test_closePerson' into _31_interface_creation_parcours

This commit is contained in:
Mathieu Jaumotte 2021-05-05 20:47:39 +02:00
commit e6fcb5ff22
5 changed files with 39 additions and 12 deletions

View File

@ -5,7 +5,7 @@
@include button($green, $white); @include button($green, $white);
} }
&.bt-reset, &.bt-delete { &.bt-reset, &.bt-delete, &.bt-remove {
@include button($red, $white); @include button($red, $white);
} }
@ -24,6 +24,7 @@
&.bt-save::before, &.bt-save::before,
&.bt-new::before, &.bt-new::before,
&.bt-delete::before, &.bt-delete::before,
&.bt-remove::before,
&.bt-update::before, &.bt-update::before,
&.bt-edit::before, &.bt-edit::before,
&.bt-cancel::before, &.bt-cancel::before,
@ -56,7 +57,12 @@
// add a trash // add a trash
content: ""; content: "";
} }
&.bt-remove::before {
// add a times
content: "";
}
&.bt-edit::before, &.bt-update::before { &.bt-edit::before, &.bt-update::before {
// add a pencil // add a pencil
content: ""; content: "";
@ -94,6 +100,7 @@
&.bt-save::before, &.bt-save::before,
&.bt-new::before, &.bt-new::before,
&.bt-delete::before, &.bt-delete::before,
&.bt-remove::before,
&.bt-update::before, &.bt-update::before,
&.bt-edit::before, &.bt-edit::before,
&.bt-cancel::before, &.bt-cancel::before,
@ -123,6 +130,7 @@
&.bt-save::before, &.bt-save::before,
&.bt-new::before, &.bt-new::before,
&.bt-delete::before, &.bt-delete::before,
&.bt-remove::before,
&.bt-update::before, &.bt-update::before,
&.bt-edit::before, &.bt-edit::before,
&.bt-cancel::before, &.bt-cancel::before,

View File

@ -24,10 +24,16 @@
</li> </li>
<li> <li>
<button class="sc-button bt-delete" <button class="sc-button bt-delete"
:title="$t('action.remove')" :title="$t('action.delete')"
@click.prevent="$emit('remove', participation)"> @click.prevent="$emit('remove', participation)">
</button> </button>
</li> </li>
<li>
<button class="sc-button bt-remove"
:title="$t('action.remove')"
@click="closeParticipation">
</button>
</li>
</ul> </ul>
</td> </td>
</tr> </tr>
@ -45,6 +51,11 @@ export default {
} }
} }
}, },
emits: ['remove'] emits: ['remove'],
methods: {
closeParticiapation() {
}
}
} }
</script> </script>

View File

@ -17,17 +17,17 @@
v-for="participation in participations" v-for="participation in participations"
v-bind:participation="participation" v-bind:participation="participation"
v-bind:key="participation.id" v-bind:key="participation.id"
@remove="removePerson"> @remove="removeParticipation">
</person-item> </person-item>
</tbody> </tbody>
</table> </table>
<add-persons></add-persons> <add-persons></add-persons>
<ul class="record_actions"> <ul class="record_actions">
<li> <!--li>
<button class="sc-button orange" @click="savePersons"> <button class="sc-button orange" @click="savePersons">
{{ $t('action.save') }} {{ $t('action.save') }}
</button> </button>
</li> </li-->
</ul> </ul>
</div> </div>
</template> </template>
@ -48,12 +48,14 @@ export default {
counter: state => state.accompanying_course.participations.length counter: state => state.accompanying_course.participations.length
}), }),
methods: { methods: {
removePerson(item) { removeParticipation(item) {
this.$store.dispatch('removeParticipation', item) this.$store.dispatch('removeParticipation', item)
}, },
/*
savePersons() { savePersons() {
console.log('[wip] saving persons'); console.log('[wip] saving persons');
} }
*/
} }
} }
</script> </script>

View File

@ -28,10 +28,13 @@ let getDataPromise = getAccompanyingCourse(id)
}, },
mutations: { mutations: {
removeParticipation(state, item) { removeParticipation(state, item) {
//console.log('remove item', item.id); //console.log('mutation: remove item', item.id);
state.accompanying_course.participations = state.accompanying_course.participations.filter( state.accompanying_course.participations = state.accompanying_course.participations.filter(participation => participation !== item);
participation => participation !== item },
); closeParticipation(state, item) {
console.log('mutation: close item', item.id);
let participation = state.accompanying_course.participations.filter(participation => participation === item);
console.log('participation', participation);
}, },
addParticipation(state, { participation, payload }) { addParticipation(state, { participation, payload }) {
//console.log('### mutation: add participation', participation); //console.log('### mutation: add participation', participation);

View File

@ -44,6 +44,9 @@
v-bind:item="item" v-bind:item="item"
v-bind:key="item.id"> v-bind:key="item.id">
</person-suggestion> </person-suggestion>
<button v-if="query.length >= 3" class="sc-button bt-create ml-5 mt-2" name="createPerson">
Ajouter "{{ query }}"
</button>
</div> </div>
</template> </template>