Skip to content

Commit

Permalink
ajuste: mostrando soma de ch no form de grades
Browse files Browse the repository at this point in the history
  • Loading branch information
belone0 committed Aug 27, 2024
1 parent 81215b3 commit 2d8e9b3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions resources/js/Components/Grades/GradesForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export default {
value_disciplinas: this.grade ? this.grade.disciplinas : null,
grade: this.grade,
titulo: this.grade ? this.grade.titulo : '',
edit: this.edit
edit: this.edit,
soma_ch:0
}
},
methods: {
Expand Down Expand Up @@ -60,6 +61,9 @@ export default {
.catch(error => {
console.error(error);
});
},
handleCHDisplay() {
this.soma_ch = this.value_disciplinas.reduce((acc, item) => acc + item.carga_horaria, 0)
}
}
}
Expand All @@ -84,7 +88,7 @@ export default {
<MultiSelect v-model="value_disciplinas" :options="$page.props.disciplinas" filter
scrollHeight="25rem" dataKey="id" :virtualScrollerOptions="{ itemSize: 44 }"
optionLabel="titulo" display="chip" placeholder="Adicionar disciplinas" class="w-full">
optionLabel="titulo" display="chip" placeholder="Adicionar disciplinas" class="w-full" @change="handleCHDisplay">
<template #option="props">
<div class="flex items-center">
<span class="option__title">{{ props.option.codigo }}</span> &nbsp - &nbsp <span
Expand All @@ -93,7 +97,7 @@ export default {
</template>
</MultiSelect>
</div>
<span v-show="soma_ch>0">Carga Horária Total: <span class="text-primary">{{ soma_ch }} h</span></span>
</div>
<div class="flex justify-end mt-6">
<button type="submit"
Expand Down

0 comments on commit 2d8e9b3

Please sign in to comment.