Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Training Codes to be stored, bugfixes #679

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@ seed:
php artisan db:seed

serve:
php artisan serve --host=0.0.0.0
php artisan serve --host=0.0.0.0

clear_cache:
php artisan cache:clear
php artisan view:clear
php artisan config:clear
php artisan event:clear
php artisan route:clear
3 changes: 2 additions & 1 deletion app/Http/Controllers/Secretariat/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ public function updateEducationalInformation(Request $request, User $user): Redi
'study_lines' => 'array',
'study_lines.*.name' => 'required|string|max:255',
'study_lines.*.level' => ['required', Rule::in(array_keys(StudyLine::TYPES))],
'study_lines.*.training_code' => 'string|max:255',
'study_lines.*.minor' => 'nullable|string|max:255',
'study_lines.*.start' => 'required',
'email' => [
Expand Down Expand Up @@ -209,7 +210,6 @@ public function updateEducationalInformation(Request $request, User $user): Redi

if ($request->has('workshop')) {
$user->workshops()->sync($request->input('workshop'));
WorkshopBalance::generateBalances(Semester::current());
}

if ($request->has('faculty')) {
Expand All @@ -223,6 +223,7 @@ public function updateEducationalInformation(Request $request, User $user): Redi
'name' => $studyLine["name"],
'type' => $studyLine["level"],
'minor' => $studyLine["minor"] ?? null,
'training_code' => $studyLine["training_code"],
'start' => $studyLine["start"],
'end' => $studyLine["end"] ?? null,
]);
Expand Down
2 changes: 0 additions & 2 deletions app/Http/Controllers/StudentsCouncil/EconomicController.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ public static function payKKTNetregLogic(User $payer, User $receiver, int $kkt_a
'moved_to_checkout' => null,
]);

WorkshopBalance::generateBalances(Semester::current());

$new_expiry_date = $payer->internetAccess->extendInternetAccess();

return [$kkt, $netreg, $new_expiry_date];
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Semester.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public static function current(): Semester
}
$current = Semester::getOrCreate($year, $part);

Cache::put('semester.current.' . $today, $current, Carbon::tomorrow());
Cache::put('semester.current.' . $today, $current, $seconds = 10);
}

return Cache::get('semester.current.' . $today);
Expand Down
5 changes: 5 additions & 0 deletions app/Models/StudyLine.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* @property string $name
* @property string $minor
* @property string $type
* @property string $training_code
* @property Semester $startSemester
* @property ?Semester $endSemester
* @property int $id
Expand Down Expand Up @@ -47,6 +48,7 @@ class StudyLine extends Model
'name',
'minor',
'type',
'training_code',
'start',
'end'
];
Expand Down Expand Up @@ -109,6 +111,9 @@ public function getNameWithYear(): string
if ($this->start) {
$name .= ' (' . $this->startSemester->tag . ' - ' . $this->endSemester?->tag . ')';
}
if ($this->training_code) {
$name .= ' - ' . $this->training_code;
}
return $name;
}

Expand Down
1 change: 0 additions & 1 deletion app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,6 @@ public function setCollegist($objectName): void
$this->addRole($role, $object);

Cache::forget('collegists');
WorkshopBalance::generateBalances(Semester::current());
}

/**
Expand Down
1 change: 1 addition & 0 deletions database/factories/StudyLineFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public function definition()
return [
'educational_information_id' => \App\Models\EducationalInformation::factory()->create()->id,
'name' => $this->faker->jobTitle,
'training_code' => $this->faker->boolean ? $this->faker->lexify("???-???_??????") : null,
'type' => $this->faker->randomElement(array_keys(\App\Models\StudyLine::TYPES)),
'start' => Semester::current()->id,
];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('study_lines', function (Blueprint $table) {
$table->string('training_code')->after('type')->nullable(); //It is nullable it was not mandatory, but it will be from now on
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('study_lines', function (Blueprint $table) {
$table->dropColumn('training_code');
});
}
};
1 change: 1 addition & 0 deletions resources/lang/en/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
'study_line_level' => 'Level',
'study_line_minor' => 'Minor/Specialization',
'study_line_start' => 'Start',
'study_line_training_code' => 'Training Code',
'surname' => 'Surname',
'szlavisztika_muhely' => 'Szlavisztika műhely',
'tanito_eso_vokepzo_kar' => 'Tanító- és Óvóképző Kar',
Expand Down
1 change: 1 addition & 0 deletions resources/lang/hu/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
'study_line_level' => 'Képzési szint',
'study_line_minor' => 'Minor / Specializáció',
'study_line_start' => 'Képzés kezdete',
'study_line_training_code' => 'Képzési kód',
'surname' => 'vezetéknév',
'szlavisztika_muhely' => 'Szlavisztika műhely',
'tanito_eso_vokepzo_kar' => 'Tanító- és Óvóképző Kar',
Expand Down
2 changes: 1 addition & 1 deletion resources/views/auth/application/application.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
<th scope="row">Szak(ok)</th>
<td>
@forelse($user->educationalInformation?->studyLines ?? [] as $studyLine)
{{ $studyLine->getName() }}
{{ $studyLine->getNameWithYear() }}
<br>
@empty
<span style="font-style:italic;color:red">hiányzó szak</span>
Expand Down
9 changes: 7 additions & 2 deletions resources/views/user/study-line-selector.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="study_line" id="study_line_{{$index}}">
<div class="row" style="margin:0">
<x-input.text id="study_lines[{{ $index }}][name]"
xl=6
xl=4
text="user.study_line"
:value="$value?->name"
required />
Expand All @@ -11,8 +11,13 @@
:value="$value?->type"
:elements="App\View\Components\Input\Select::convertArray(\App\Models\StudyLine::TYPES)"
required />
<x-input.text id="study_lines[{{ $index }}][training_code]"
xl=2 s=6
text="user.study_line_training_code"
:value="$value?->training_code"
required />
<x-input.text id="study_lines[{{ $index }}][minor]"
xl=4 s=6
xl=3 s=6
text="user.study_line_minor"
:value="$value?->minor"
helper="Nem kötelező"
Expand Down
Loading