-
Notifications
You must be signed in to change notification settings - Fork 457
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into portabilis-patch-2024-11-25
- Loading branch information
Showing
54 changed files
with
1,339 additions
and
734 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,20 @@ | ||
<?php | ||
|
||
namespace App\Events; | ||
|
||
use App\Models\Employee; | ||
use App\Models\LegacyRegistration; | ||
use Illuminate\Broadcasting\InteractsWithSockets; | ||
use Illuminate\Foundation\Events\Dispatchable; | ||
use Illuminate\Queue\SerializesModels; | ||
|
||
class EmployeeCreated | ||
{ | ||
use Dispatchable; | ||
use InteractsWithSockets; | ||
use SerializesModels; | ||
|
||
public function __construct( | ||
public Employee $employee, | ||
) {} | ||
} |
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,19 @@ | ||
<?php | ||
|
||
namespace App\Events; | ||
|
||
use App\Models\LegacyStudent; | ||
use Illuminate\Broadcasting\InteractsWithSockets; | ||
use Illuminate\Foundation\Events\Dispatchable; | ||
use Illuminate\Queue\SerializesModels; | ||
|
||
class StudentCreated | ||
{ | ||
use Dispatchable; | ||
use InteractsWithSockets; | ||
use SerializesModels; | ||
|
||
public function __construct( | ||
public LegacyStudent $student, | ||
) {} | ||
} |
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,59 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Http\Requests\BlockEnrollmentRequest; | ||
use App\Models\LegacySchoolGrade; | ||
use App\Process; | ||
use iEducar\Support\Exceptions\Exception; | ||
use Illuminate\Support\Facades\DB; | ||
|
||
class BlockEnrollmentController extends Controller | ||
{ | ||
public function update(BlockEnrollmentRequest $request) | ||
{ | ||
$query = LegacySchoolGrade::query() | ||
->whereHas('school', fn ($q) => $q->whereInstitution($request->get('ref_cod_instituicao'))) | ||
->when($request->get('ref_cod_escola'), fn ($q, $school) => $q->where('ref_cod_escola', $school)) | ||
->when($request->get('ref_cod_curso'), function ($q, $course) { | ||
$q->whereHas('grade', fn ($q) => $q->whereCourse($course)); | ||
}) | ||
->whereRaw("anos_letivos @> ?", ["{" . $request->get('ano') . "}"]) | ||
->where('ativo', 1); | ||
|
||
$gradesCount = $query->count(); | ||
|
||
if ($gradesCount === 0) { | ||
return redirect()->route('block-enrollment.edit')->withInput()->with('error', 'Nenhuma série da escola encontrada com os filtros selecionados'); | ||
} | ||
|
||
if (empty($request->get('confirmation'))) { | ||
return redirect()->route('block-enrollment.edit')->withInput()->with('show-confirmation', $gradesCount); | ||
} | ||
|
||
try { | ||
DB::beginTransaction(); | ||
$query->update([ | ||
'bloquear_enturmacao_sem_vagas' => $request->get('bloquear_enturmacao_sem_vagas'), | ||
'updated_at' => now() | ||
]); | ||
DB::commit(); | ||
session()->flash('success', 'Atualização em lote efetuada com sucesso.'); | ||
} catch (Exception) { | ||
DB::rollBack(); | ||
session()->flash('error', 'Atualização em lote não realizada.'); | ||
} | ||
|
||
return redirect()->route('block-enrollment.edit'); | ||
} | ||
|
||
public function edit() | ||
{ | ||
$this->menu(Process::BLOCK_ENROLLMENT); | ||
$this->breadcrumb('Bloquear enturmação em lote', [ | ||
url('/intranet/educar_configuracoes_index.php') => 'Configurações', | ||
]); | ||
|
||
return view('block-enrollment.edit', ['user' => request()->user()]); | ||
} | ||
} |
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,24 @@ | ||
<?php | ||
|
||
namespace App\Http\Requests; | ||
|
||
use Illuminate\Foundation\Http\FormRequest; | ||
|
||
class BlockEnrollmentRequest extends FormRequest | ||
{ | ||
protected function prepareForValidation() | ||
{ | ||
$this->merge([ | ||
'bloquear_enturmacao_sem_vagas' => $this->has('bloquear_enturmacao_sem_vagas') ? 1 : 0, | ||
]); | ||
} | ||
|
||
public function rules() | ||
{ | ||
return [ | ||
'ano' => ['required','integer'], | ||
'ref_cod_instituicao' => ['required','integer'], | ||
'bloquear_enturmacao_sem_vagas' => ['required','in:0,1'], | ||
]; | ||
} | ||
} |
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
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
Oops, something went wrong.