-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2088 from sophiemoustard/COM-3845
Com 3845
- Loading branch information
Showing
4 changed files
with
167 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
src/core/components/courses/AttendanceSheetEditionModal.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<template> | ||
<ni-modal :model-value="modelValue" @hide="hide" @update:model-value="input"> | ||
<template #title> | ||
Modifier la <span class="text-weight-bold">feuille d'émargement</span> | ||
</template> | ||
<ni-select :model-value="editedAttendanceSheet.trainee" :options="traineeIdentity" disable /> | ||
<ni-option-group :model-value="editedAttendanceSheet.slots" in-modal required-field | ||
@update:model-value="update($event, 'slots')" type="checkbox" inline :options="editionSlotOptions" | ||
caption="Sélectionner les créneaux auxquels a été présent·e le/la participant·e" | ||
:error="validations.slots.$error" /> | ||
<template #footer> | ||
<ni-button class="full-width modal-btn bg-primary" label="Modifier la feuille d'émargement" :loading="loading" | ||
icon-right="add" @click="submit" color="white" /> | ||
</template> | ||
</ni-modal> | ||
</template> | ||
|
||
<script> | ||
import { toRefs, computed } from 'vue'; | ||
import Modal from '@components/modal/Modal'; | ||
import Select from '@components/form/Select'; | ||
import OptionGroup from '@components/form/OptionGroup'; | ||
import Button from '@components/Button'; | ||
import { formatIdentity } from '@helpers/utils'; | ||
export default { | ||
name: 'AttendanceSheetEditionModal', | ||
components: { | ||
'ni-modal': Modal, | ||
'ni-select': Select, | ||
'ni-option-group': OptionGroup, | ||
'ni-button': Button, | ||
}, | ||
props: { | ||
modelValue: { type: Boolean, default: false }, | ||
editedAttendanceSheet: { type: Object, default: () => ({}) }, | ||
validations: { type: Object, default: () => ({}) }, | ||
loading: { type: Boolean, default: false }, | ||
editionSlotOptions: { type: Array, default: () => [] }, | ||
}, | ||
emits: ['hide', 'update:model-value', 'submit', 'update:edited-attendance-sheet'], | ||
setup (props, { emit }) { | ||
const { editedAttendanceSheet } = toRefs(props); | ||
const traineeIdentity = computed(() => [{ | ||
label: formatIdentity(editedAttendanceSheet.value.trainee.identity, 'FL'), | ||
value: editedAttendanceSheet.value.trainee, | ||
}]); | ||
const hide = () => emit('hide'); | ||
const input = event => emit('update:model-value', event); | ||
const submit = () => emit('submit'); | ||
const update = (slotsValue, prop) => emit( | ||
'update:edited-attendance-sheet', | ||
{ ...editedAttendanceSheet.value, [prop]: slotsValue } | ||
); | ||
return { | ||
// Computed | ||
traineeIdentity, | ||
// Methods | ||
hide, | ||
input, | ||
submit, | ||
update, | ||
}; | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters