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

View File

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

View File

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

View File

@ -28,10 +28,13 @@ let getDataPromise = getAccompanyingCourse(id)
},
mutations: {
removeParticipation(state, item) {
//console.log('remove item', item.id);
state.accompanying_course.participations = state.accompanying_course.participations.filter(
participation => participation !== item
);
//console.log('mutation: remove item', item.id);
state.accompanying_course.participations = state.accompanying_course.participations.filter(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 }) {
//console.log('### mutation: add participation', participation);

View File

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