Skip to content

Commit

Permalink
Reset form and visual of provas
Browse files Browse the repository at this point in the history
  • Loading branch information
MatheusTKoch committed Jan 25, 2024
1 parent 7089c90 commit 7a7730e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
3 changes: 2 additions & 1 deletion app/Http/Controllers/ProvaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class ProvaController extends Controller
public function index()
{
return Inertia::render('Provas', [
'materias' => Materia::get()->where('user_id', Auth::id())
'materias' => Materia::get()->where('user_id', Auth::id()),
'provas' => Prova::get()->where('aluno_id', Auth::id())
]);
}

Expand Down
6 changes: 3 additions & 3 deletions resources/js/Pages/Materias.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const form = useForm({
});
const submit = () => {
form.post(route('materia'), {
onSuccess: () => form.reset('materias')
form.post('/materia', {
onSuccess: () => form.reset()
});
};
Expand All @@ -29,7 +29,7 @@ const prop = defineProps({
<h2 class="font-semibold text-xl text-gray-800 leading-tight">Matérias</h2>
</template>

<form @submit.prevent="submit" class="flex justify-center">
<form @submit.prevent="submit" class="flex justify-center">
<div class="my-2">
<InputLabel for="materias" value="Cadastre suas matérias:" />

Expand Down
18 changes: 10 additions & 8 deletions resources/js/Pages/Provas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ const form = useForm({
const submit = () => {
form.post(route('prova'), {
onSuccess: () => form.reset('provas')
form.post('/prova', {
onSuccess: () => form.reset()
});
};
const props = defineProps({
materias: ''
materias: '',
provas: ''
});
</script>

Expand All @@ -43,7 +44,7 @@ const props = defineProps({
<div class="h-5"></div>
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
<div class="p-6 text-gray-900 float">
<form @submit.prevent="submit">
<form @submit.prevent="submit" id="provas">
<InputLabel for="provasDesc" value="Título da Prova:" />

<TextInput
Expand Down Expand Up @@ -106,16 +107,17 @@ const props = defineProps({
<th class="font-bold py-2 px-4 border-b border-l text-left">Prova</th>
<th class="font-bold py-2 px-4 border-b border-l text-left">Nota</th>
<th class="font-bold py-2 px-4 border-b border-l text-left">Matéria</th>
<th class="font-bold py-2 px-4 border-b border-l text-left">Corrigido Por</th>
<th class="font-bold py-2 px-4 border-b border-l text-left">Status</th>
</tr>
</thead>
<tbody>
<tr>
<tbody v-for="prov in provas">
{{ prov }}
<!-- <tr>
<td class="p-2 border-b border-l text-left">Prova 1</td>
<td class="p-2 border-b border-l text-left">9.5</td>
<td class="p-2 border-b border-l text-left">Historia</td>
<td class="p-2 border-b border-l text-left">Professor 1</td>
</tr>
</tr> -->
</tbody>
</table>
</div>
Expand Down

0 comments on commit 7a7730e

Please sign in to comment.