-
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.
- Loading branch information
1 parent
53ae281
commit fa6da11
Showing
16 changed files
with
245 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Illuminate\Database\Eloquent { | ||
use Illuminate\Contracts\Database\Eloquent\Builder as BuilderContract; | ||
|
||
class Builder implements BuilderContract { | ||
public function whereLikeUnaccentInsensitive(string $column, mixed $value): static { | ||
return $intance; | ||
} | ||
|
||
public function orWhereLikeUnaccentInsensitive(string $column, mixed $value): static { | ||
return $intance; | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Keating\Http\Controllers\Dashboard; | ||
|
||
use Illuminate\Http\JsonResponse; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Routing\ResponseFactory; | ||
use Inertia\Response; | ||
use Keating\DTOs\CourseSemesterData; | ||
use Keating\Models\CourseSemester; | ||
use Keating\Models\Grade; | ||
use Keating\Models\GradeColumn; | ||
use Keating\Models\Group; | ||
|
||
class GradeImportController | ||
{ | ||
public function index(CourseSemester $course, Group $group, GradeColumn $column): Response | ||
{ | ||
return inertia("Dashboard/CourseSemester/Grade/Import", [ | ||
"course" => CourseSemesterData::fromModel($course), | ||
"group" => $group, | ||
"column" => $column, | ||
"csrfToken" => csrf_token(), | ||
]); | ||
} | ||
|
||
public function prepare(Request $request, CourseSemester $course, Group $group, GradeColumn $column, ResponseFactory $response): JsonResponse | ||
{ | ||
$students = $request; | ||
|
||
return $response->json([ | ||
"students" => $column->refresh()->grades->map(fn(Grade $grade): array => [ | ||
"id" => $grade->id, | ||
"column" => [ | ||
"id" => $column->id, | ||
], | ||
"student" => [ | ||
"id" => $grade->student->id, | ||
"name" => $grade->student->fullName, | ||
"indexNumber" => $grade->student->index_number, | ||
], | ||
"status" => $grade->status, | ||
"value" => $grade->value, | ||
"imported" => rand(0, 1) > .5, | ||
]), | ||
]); | ||
} | ||
} |
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
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
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
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
96 changes: 96 additions & 0 deletions
96
resources/js/Pages/Dashboard/CourseSemester/Grade/Import.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,96 @@ | ||
<script setup> | ||
import DashboardLayout from '@/Layouts/DashboardLayout.vue' | ||
import ManagementHeader from '@/Shared/Components/ManagementHeader.vue' | ||
import Section from '@/Shared/Components/Section.vue' | ||
import SubmitButton from '@/Shared/Components/Buttons/SubmitButton.vue' | ||
import FormGroup from '@/Shared/Forms/FormGroup.vue' | ||
import FormLabel from '@/Shared/Forms/FormLabel.vue' | ||
import { useForm } from '@inertiajs/inertia-vue3' | ||
import FormError from '@/Shared/Forms/FormError.vue' | ||
import TableWrapper from '@/Shared/Components/Table/Public/TableWrapper.vue' | ||
import TableRow from '@/Shared/Components/Table/Public/TableRow.vue' | ||
import TableCell from '@/Shared/Components/Table/Public/TableCell.vue' | ||
import GradeCell from '@/Shared/Components/GradeCell.vue' | ||
const props = defineProps({ | ||
course: Object, | ||
group: Object, | ||
column: Object, | ||
csrfToken: String, | ||
}) | ||
const preparationForm = useForm({ | ||
content: '', | ||
}) | ||
const gradesForm = useForm({ | ||
grades: '', | ||
}) | ||
function prepareStudentsList() { | ||
fetch(`/dashboard/semester-courses/${props.course.id}/groups/${props.group.id}/grades/${props.column.id}/prepare`) | ||
.then(response => response.json()) | ||
.then(data => { | ||
gradesForm.grades = data['students'] | ||
}) | ||
} | ||
</script> | ||
|
||
<template> | ||
<DashboardLayout> | ||
<div class="flex flex-col gap-8"> | ||
<ManagementHeader> | ||
<template #header> | ||
Import aktywności studentów | ||
<span class="text-gray-500">{{ group.name }}</span> | ||
<br> dla kursu | ||
<span class="text-gray-500">{{ course.course }}</span> | ||
dla oceny | ||
<span class="text-gray-500">{{ column.name }}</span> | ||
</template> | ||
</ManagementHeader> | ||
<div class="grid grid-cols-2 gap-8"> | ||
<Section> | ||
<form class="flex flex-col justify-between gap-4" @submit.prevent="prepareStudentsList()"> | ||
<FormGroup> | ||
<FormLabel for="content"> | ||
Lista studentów do zaimportowania | ||
<span class="text-gray-500">(z pliku CSV przysłanego z Google Workspace)</span> | ||
</FormLabel> | ||
<textarea v-model="preparationForm.content" class="block h-[320px] w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 sm:text-sm sm:leading-6" /> | ||
<FormError :error="preparationForm.errors.content" /> | ||
</FormGroup> | ||
<div class="mt-4 flex justify-end"> | ||
<SubmitButton> | ||
przygotuj | ||
</SubmitButton> | ||
</div> | ||
</form> | ||
</Section> | ||
<Section> | ||
<FormLabel for="content"> | ||
Lista ocen | ||
</FormLabel> | ||
<TableWrapper class="mt-2"> | ||
<template #body> | ||
<TableRow v-for="data in gradesForm.grades" :key="data.student.id"> | ||
<TableCell class="h-[70px] w-1 cursor-pointer flex-row border-2"> | ||
<div class="text-nowrap font-bold"> | ||
{{ data.student.name }} | ||
</div> | ||
<div> | ||
({{ data.student.indexNumber }}) | ||
</div> | ||
</TableCell> | ||
<GradeCell :grade="data" :grade-column="data.column" :student="data.student" class="cursor-pointer border-2" @create-grade="createGrade" @update-grade="updateGrade" /> | ||
<TableCell class="h-[70px] w-1 cursor-pointer flex-row border-2"> | ||
<span v-if="data.imported">zaimportowane</span> | ||
</TableCell> | ||
</TableRow> | ||
</template> | ||
</TableWrapper> | ||
</Section> | ||
</div> | ||
</div> | ||
</DashboardLayout> | ||
</template> |
Oops, something went wrong.