diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index a417bc568e..4244f893f8 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -7,6 +7,7 @@ use iEducar\Modules\ErrorTracking\Tracker; use iEducar\Support\Exceptions\DisciplinesWithoutInformedHoursException; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; +use Illuminate\Validation\ValidationException; use Throwable; class Handler extends ExceptionHandler @@ -19,6 +20,7 @@ class Handler extends ExceptionHandler protected $dontReport = [ App_Model_Exception::class, DisciplinesWithoutInformedHoursException::class, + ValidationException::class, ]; /** diff --git a/app/Http/Controllers/AnnouncementPublishController.php b/app/Http/Controllers/AnnouncementPublishController.php new file mode 100644 index 0000000000..f34e189d1f --- /dev/null +++ b/app/Http/Controllers/AnnouncementPublishController.php @@ -0,0 +1,95 @@ +menu(Process::ANNOUNCEMENT); + $this->breadcrumb('Publicação de avisos', [ + url('/intranet/educar_configuracoes_index.php') => 'Configurações', + ]); + $announcements = Announcement::query() + ->withTrashed() + ->with([ + 'userTypes', + ]) + ->latest() + ->paginate(); + + return view('announcement.publish.index', [ + 'announcements' => $announcements, + ]); + } + + public function update(AnnouncementRequest $request, $announcementId) + { + try { + DB::beginTransaction(); + $announcement = Announcement::query()->withTrashed()->findOrFail($announcementId); + $announcement->fill($request->all()); + $announcement->save(); + $announcement->userTypes()->sync($request->get('tipo_usuario')); + $request->get('active') ? $announcement->restore() : $announcement->delete(); + DB::commit(); + session()->flash('success', 'Edição efetuada com sucesso.'); + } catch (Exception) { + DB::rollBack(); + session()->flash('error', 'Edição não realizada.'); + } + + return redirect()->route('announcement.publish.edit', $announcementId); + } + + public function store(AnnouncementRequest $request) + { + try { + DB::beginTransaction(); + $announcement = Announcement::create($request->all()); + $announcement->userTypes()->sync($request->get('tipo_usuario')); + $request->get('active') ? $announcement->restore() : $announcement->delete(); + DB::commit(); + session()->flash('success', 'Cadastro efetuado com sucesso.'); + } catch (Exception) { + DB::rollBack(); + session()->flash('error', 'Cadastro não realizado.'); + } + + return redirect()->route('announcement.publish.index'); + } + + public function create() + { + $this->menu(Process::ANNOUNCEMENT); + $this->breadcrumb('Publicação de avisos', [ + url('/intranet/educar_configuracoes_index.php') => 'Configurações', + ]); + + return view('announcement.publish.create', [ + 'announcement' => new Announcement(), + 'userTypes' => null, + ]); + } + + public function edit($announcementId) + { + $this->menu(Process::ANNOUNCEMENT); + $this->breadcrumb('Publicação de avisos', [ + url('/intranet/educar_configuracoes_index.php') => 'Configurações', + ]); + $announcement = Announcement::query()->withTrashed()->findOrFail($announcementId); + $userTypes = $announcement->userTypes->pluck('cod_tipo_usuario'); + + return view('announcement.publish.create', [ + 'announcement' => $announcement, + 'userTypes' => $userTypes, + ]); + } +} diff --git a/app/Http/Controllers/AnnouncementUserController.php b/app/Http/Controllers/AnnouncementUserController.php new file mode 100644 index 0000000000..31f80c8821 --- /dev/null +++ b/app/Http/Controllers/AnnouncementUserController.php @@ -0,0 +1,80 @@ +breadcrumb('Avisos'); + $this->menu(Process::ANNOUNCEMENT); + $announcement = Announcement::query()->latest()->first(); + $announcement->users()->sync([ + $request->user()->getKey() => ['read_at' => now()], + ]); + + return view('announcement.user.show', [ + 'announcement' => $announcement, + 'schools' => $this->getUserSchools($announcement->show_vacancy), + ]); + } + + private function getUserSchools(bool $show) + { + if (!$show) { + return []; + } + + return LegacyEnrollment::query() + ->selectRaw(" + nm_turma, + UPPER(pessoa.nome) as escola, + string_agg(distinct nm_serie, ', ') as serie, + string_agg(distinct nm_curso, ', ') as curso, + max_aluno - COUNT(distinct matricula.cod_matricula) as vagas + ") + ->join('relatorio.view_situacao', function ($join) { + $join->on('view_situacao.cod_matricula', 'ref_cod_matricula') + ->on('view_situacao.cod_turma', 'ref_cod_turma') + ->on('view_situacao.sequencial', 'matricula_turma.sequencial'); + }) + ->join('pmieducar.turma', fn ($join) => $join->on('turma.cod_turma', 'ref_cod_turma')->where('turma.ativo', 1)->where('turma.ano', Carbon::now()->year)) + ->join('pmieducar.escola', fn ($join) => $join->on('cod_escola', 'turma.ref_ref_cod_escola')->where('escola.ativo', 1)) + ->join('cadastro.pessoa', 'idpes', 'escola.ref_idpes') + ->join('pmieducar.matricula', 'matricula.cod_matricula', 'ref_cod_matricula') + ->join('pmieducar.serie', fn ($join) => $join->on('cod_serie', 'matricula.ref_ref_cod_serie')->where('matricula.ativo', 1)) + ->join('pmieducar.curso', fn ($join) => $join->on('cod_curso', 'matricula.ref_cod_curso')->where('curso.ativo', 1)) + ->when(Auth::user()->isSchooling(), fn ($q) => $q->whereIn('cod_escola', Auth::user()->schools()->pluck('ref_cod_escola'))) + ->having('max_aluno', '>', DB::raw('COUNT(distinct matricula.cod_matricula)')) + ->orderBy('escola') + ->orderBy('curso') + ->orderBy('serie') + ->where('matricula_turma.ativo', 1) + ->orderBy('nm_turma') + ->groupBy('nm_turma', 'max_aluno', 'pessoa.nome') + ->get() + ->groupBy([ + 'escola', + 'curso', + 'serie', + ]); + } + + public function confirm(Request $request) + { + $announcement = Announcement::query()->latest()->first(); + $announcement->users()->sync([ + $request->user()->getKey() => ['confirmed_at' => now()], + ]); + + return redirect('/'); + } +} diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 1d204aa400..02cd608a7b 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; +use App\Models\Announcement; use App\Rules\ReCaptchaV3; use Illuminate\Foundation\Auth\AuthenticatesUsers; use Illuminate\Http\Request; @@ -77,4 +78,40 @@ public function validateLogin(Request $request) 'password.string' => 'O campo senha é obrigatório.', ]); } + + protected function authenticated(Request $request, $user) + { + $announcement = Announcement::query() + ->whereHas('userTypes', fn ($q) => $q->whereKey($user->ref_cod_tipo_usuario)) + ->latest()->first(); + + if (!$announcement) { + return; + } + + if ($announcement->repeat_on_login) { + $this->resetAnnouncementConfirmation($announcement, $user); + + return redirect()->route('announcement.user.show'); + } + + if (!$this->userReadAnnouncement($announcement, $user)) { + return redirect()->route('announcement.user.show'); + } + } + + private function resetAnnouncementConfirmation(Announcement $announcement, $user): void + { + if ($announcement->show_confirmation) { + $announcement->users()->updateExistingPivot($user->getKey(), ['confirmed_at' => null]); + } + } + + private function userReadAnnouncement(Announcement $announcement, $user): bool + { + return $announcement->users() + ->whereKey($user->getKey()) + ->wherePivotNotNull('read_at') + ->exists(); + } } diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 66e269285f..05453e5370 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -38,6 +38,7 @@ class Kernel extends HttpKernel \Illuminate\View\Middleware\ShareErrorsFromSession::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, \App\Http\Middleware\SetLayoutVariables::class, + \App\Http\Middleware\AnnouncementMiddleware::class, ], 'api' => [ diff --git a/app/Http/Middleware/AnnouncementMiddleware.php b/app/Http/Middleware/AnnouncementMiddleware.php new file mode 100644 index 0000000000..d81383e83f --- /dev/null +++ b/app/Http/Middleware/AnnouncementMiddleware.php @@ -0,0 +1,36 @@ +user()) { + $announcement = Announcement::query() + ->whereHas('userTypes', fn ($q) => $q->whereKey($user->ref_cod_tipo_usuario) + )->latest()->first(); + + if ($announcement?->show_confirmation && !$this->userConfirmedAnnouncement($announcement, $user)) { + Session::flash('error', 'Confirme a ciência do aviso antes de prosseguir!'); + + return redirect()->route('announcement.user.show'); + } + } + + return $next($request); + } + + private function userConfirmedAnnouncement(Announcement $announcement, $user): bool + { + return $announcement->users() + ->whereKey($user->getKey()) + ->wherePivotNotNull('confirmed_at') + ->exists(); + } +} diff --git a/app/Http/Requests/AnnouncementRequest.php b/app/Http/Requests/AnnouncementRequest.php new file mode 100644 index 0000000000..38cccf6855 --- /dev/null +++ b/app/Http/Requests/AnnouncementRequest.php @@ -0,0 +1,56 @@ +merge([ + 'repeat_on_login' => $this->has('repeat_on_login'), + 'show_confirmation' => $this->has('show_confirmation'), + 'show_vacancy' => $this->has('show_vacancy'), + 'active' => $this->has('active'), + 'tipo_usuario' => Arr::flatten($this->get('tipo_usuario', [])), + 'created_by_user_id' => $this->user()->getKey(), + ]); + } + + public function rules() + { + return [ + 'name' => ['required', 'max:255'], + 'description' => ['required'], + 'repeat_on_login' => ['boolean'], + 'show_confirmation' => ['boolean'], + 'active' => ['boolean', function ($attribute, $value, $fail) { + if ($value) { + $exists = Announcement::query() + ->withoutTrashed() + ->where('id', '<>', $this->route('announcement')) + ->exists(); + + if ($exists) { + $fail('Já existe um aviso ativo.'); + } + } + }], + 'show_vacancy' => ['boolean'], + 'tipo_usuario' => ['required', 'array'], + 'tipo_usuario.*' => ['integer', Rule::exists('tipo_usuario', 'cod_tipo_usuario')], + ]; + } + + public function attributes() + { + return [ + 'description' => 'Conteúdo do aviso', + 'tipo_usuario' => 'Tipos de usuários que serão notificados', + ]; + } +} diff --git a/app/Models/Announcement.php b/app/Models/Announcement.php new file mode 100644 index 0000000000..cfaa8434bf --- /dev/null +++ b/app/Models/Announcement.php @@ -0,0 +1,47 @@ +belongsToMany(LegacyUserType::class, 'announcement_user_types', 'announcement_id', 'user_type_id'); + } + + public function users(): BelongsToMany + { + return $this->belongsToMany(LegacyUser::class, 'announcement_users', 'announcement_id', 'user_id'); + } + + public function createdByUser(): BelongsTo + { + return $this->belongsTo(LegacyUser::class); + } + + protected function description(): Attribute + { + return Attribute::make( + set: function (string $value) { + return strip_tags($value, '
'); + }, + ); + } +} diff --git a/app/Models/AnnouncementTipoUsuario.php b/app/Models/AnnouncementTipoUsuario.php new file mode 100644 index 0000000000..7c417f19da --- /dev/null +++ b/app/Models/AnnouncementTipoUsuario.php @@ -0,0 +1,11 @@ +whereHas('races', fn ($q) => $q->where('cod_raca', $race)); + } +} diff --git a/app/Models/Builders/LegacyRegistrationBuilder.php b/app/Models/Builders/LegacyRegistrationBuilder.php index 4e2feb6ebf..1a17059a54 100644 --- a/app/Models/Builders/LegacyRegistrationBuilder.php +++ b/app/Models/Builders/LegacyRegistrationBuilder.php @@ -123,6 +123,14 @@ public function whereDeficiencyTypes(string $deficiencyTypes): self return $this->whereHas('student.person', fn ($q) => $q->whereDeficiencyTypes($deficiencyTypes)); } + /** + * Filtra por Raca + */ + public function whereRaceId(int $race): self + { + return $this->whereHas('student.individual', fn ($q) => $q->whereRace($race)); + } + /** * Filtra por Situacao */ diff --git a/app/Models/Exporter/Builders/EnrollmentEloquentBuilder.php b/app/Models/Exporter/Builders/EnrollmentEloquentBuilder.php index a34913fcab..c454ff33fc 100644 --- a/app/Models/Exporter/Builders/EnrollmentEloquentBuilder.php +++ b/app/Models/Exporter/Builders/EnrollmentEloquentBuilder.php @@ -275,7 +275,7 @@ public function place($columns) if ($only = $this->model->getLegacyExportedColumns('place', $columns)) { $this->addSelect($only); - $this->leftJoin('places as p', 'p.id', 'person_has_place.id') + $this->leftJoin('places as p', 'p.id', 'person_has_place.place_id') ->leftJoin('cities as c', 'c.id', 'p.city_id') ->leftJoin('states as s', 's.id', 'c.state_id') ->leftJoin('countries as cn', 'cn.id', 's.country_id'); diff --git a/app/Models/Exporter/Builders/StudentEloquentBuilder.php b/app/Models/Exporter/Builders/StudentEloquentBuilder.php index 17d362e179..e5a08804d1 100644 --- a/app/Models/Exporter/Builders/StudentEloquentBuilder.php +++ b/app/Models/Exporter/Builders/StudentEloquentBuilder.php @@ -270,7 +270,7 @@ public function place($columns): self if ($only = $this->model->getLegacyExportedColumns('place', $columns)) { $this->addSelect($only); - $this->leftJoin('places as p', 'p.id', 'person_has_place.id') + $this->leftJoin('places as p', 'p.id', 'person_has_place.place_id') ->leftJoin('cities as c', 'c.id', 'p.city_id') ->leftJoin('states as s', 's.id', 'c.state_id') ->leftJoin('countries as cn', 'cn.id', 's.country_id'); diff --git a/app/Models/LegacyIndividual.php b/app/Models/LegacyIndividual.php index f61cb15690..906322c52a 100644 --- a/app/Models/LegacyIndividual.php +++ b/app/Models/LegacyIndividual.php @@ -2,8 +2,10 @@ namespace App\Models; +use App\Models\Builders\LegacyIndividualBuilder; use Carbon\Carbon; use Illuminate\Database\Eloquent\Casts\Attribute; +use Illuminate\Database\Eloquent\HasBuilder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsToMany; @@ -22,12 +24,16 @@ */ class LegacyIndividual extends Model { + /** @use HasBuilder */ + use HasBuilder; use HasFiles; public const CREATED_AT = 'data_cad'; public const UPDATED_AT = null; + protected static string $builder = LegacyIndividualBuilder::class; + protected $table = 'cadastro.fisica'; protected $primaryKey = 'idpes'; @@ -109,6 +115,21 @@ public function race(): BelongsToMany ); } + /** + * @return BelongsToMany + */ + public function races(): BelongsToMany + { + return $this->belongsToMany( + LegacyRace::class, + 'cadastro.fisica_raca', + 'ref_idpes', + 'ref_cod_raca', + 'idpes', + 'cod_raca' + ); + } + /** * @return BelongsToMany */ @@ -322,3 +343,6 @@ protected function parentsName(): Attribute ); } } + + + diff --git a/app/Models/LegacyInstitutionDocument.php b/app/Models/LegacyInstitutionDocument.php new file mode 100644 index 0000000000..5b4fb8fd73 --- /dev/null +++ b/app/Models/LegacyInstitutionDocument.php @@ -0,0 +1,20 @@ + $value ? Carbon::createFromFormat('d/m/Y', $value) : null, ); } + + /** + * Retorna as labels das opções de Uniformes + * @return array + */ + public function labels(): array + { + return [ + 'coat_pants' => 'Agasalhos (jaqueta)', + 'shirt_short' => 'Camisetas (manga curta)', + 'shirt_long' => 'Camisetas (manga longa)', + 'socks' => 'Meias', + 'shorts_tactel' => 'Bermuda masculina (tecidos diversos)', + 'shorts_coton' => 'Bermuda feminina (tecidos diversos)', + 'sneakers' => 'Tênis', + 'kids_shirt' => 'Camisetas infantis (sem manga)', + 'pants_jeans' => 'Calça jeans', + 'skirt' => 'Saias', + 'coat_jacket' => 'Agasalhos (calça)', + 'pants_fem' => 'Calça feminina (tecidos diversos)', + 'pants_mas' => 'Calça masculina (tecidos diversos)', + 'shorts_skirt' => 'Shorts saias', + ]; + } } diff --git a/app/Process.php b/app/Process.php index 132d65b40c..afc7c8e464 100644 --- a/app/Process.php +++ b/app/Process.php @@ -75,4 +75,6 @@ class Process public const CONSULTAS = 9998890; public const ACTIVE_LOOKING = 9998921; + + public const ANNOUNCEMENT = 9999114; } diff --git a/config/assets.php b/config/assets.php index 1946cf0f25..3d98f84b29 100644 --- a/config/assets.php +++ b/config/assets.php @@ -14,7 +14,7 @@ | */ - 'version' => '0.1.91', + 'version' => '0.1.100', /* |-------------------------------------------------------------------------- diff --git a/database/migrations/2024_08_12_223334_create_announcements_table.php b/database/migrations/2024_08_12_223334_create_announcements_table.php new file mode 100644 index 0000000000..0b3eb84da7 --- /dev/null +++ b/database/migrations/2024_08_12_223334_create_announcements_table.php @@ -0,0 +1,57 @@ +smallIncrements('id'); + $table->string('name'); + $table->text('description')->nullable(); + $table->boolean('repeat_on_login')->default(false); + $table->boolean('show_confirmation')->default(false); + $table->boolean('show_vacancy')->default(false); + $table->unsignedInteger('created_by_user_id')->nullable(); + $table->foreign('created_by_user_id')->references('cod_usuario')->on('pmieducar.usuario')->onDelete('cascade')->onUpdate('cascade'); + $table->softDeletes(); + $table->timestamps(); + }); + + Schema::create('announcement_user_types', function (Blueprint $table) { + $table->id(); + $table->unsignedSmallInteger('announcement_id'); + $table->foreign('announcement_id')->references('id')->on('announcements')->onDelete('cascade')->onUpdate('cascade'); + $table->unsignedInteger('user_type_id'); + $table->foreign('user_type_id')->references('cod_tipo_usuario')->on('pmieducar.tipo_usuario')->onDelete('cascade')->onUpdate('cascade'); + $table->primary([ + 'user_type_id', + 'announcement_id', + ]); + }); + + Schema::create('announcement_users', function (Blueprint $table) { + $table->id(); + $table->unsignedSmallInteger('announcement_id'); + $table->foreign('announcement_id')->references('id')->on('announcements')->onDelete('cascade')->onUpdate('cascade'); + $table->unsignedInteger('user_id'); + $table->foreign('user_id')->references('cod_usuario')->on('pmieducar.usuario')->onDelete('cascade')->onUpdate('cascade'); + $table->timestamp('confirmed_at')->nullable(); + $table->timestamp('read_at')->nullable(); + $table->primary([ + 'user_id', + 'announcement_id', + ]); + }); + } + + public function down(): void + { + Schema::dropIfExists('announcement_users'); + Schema::dropIfExists('announcement_user_types'); + Schema::dropIfExists('announcements'); + } +}; diff --git a/database/migrations/2024_09_09_090701_add_fields_in_table_uniform_distributions.php b/database/migrations/2024_09_09_090701_add_fields_in_table_uniform_distributions.php new file mode 100644 index 0000000000..85f933ea05 --- /dev/null +++ b/database/migrations/2024_09_09_090701_add_fields_in_table_uniform_distributions.php @@ -0,0 +1,32 @@ +smallInteger('pants_fem_qty')->nullable(); + $table->string('pants_fem_tm', 20)->nullable(); + $table->smallInteger('pants_mas_qty')->nullable(); + $table->string('pants_mas_tm', 20)->nullable(); + $table->smallInteger('shorts_skirt_qty')->nullable(); + $table->string('shorts_skirt_tm', 20)->nullable(); + }); + } + + public function down(): void + { + Schema::table('uniform_distributions', function (Blueprint $table) { + $table->dropColumn('pants_fem_qty'); + $table->dropColumn('pants_fem_tm'); + $table->dropColumn('pants_mas_qty'); + $table->dropColumn('pants_mas_tm'); + $table->dropColumn('shorts_skirt_qty'); + $table->dropColumn('shorts_skirt_tm'); + }); + } +}; diff --git a/database/migrations/data/2024_08_13_223334_create_announcement_menu_table.php b/database/migrations/data/2024_08_13_223334_create_announcement_menu_table.php new file mode 100644 index 0000000000..e7bbdb2fbb --- /dev/null +++ b/database/migrations/data/2024_08_13_223334_create_announcement_menu_table.php @@ -0,0 +1,25 @@ +updateOrCreate(['old' => Process::ANNOUNCEMENT], [ + 'parent_id' => Menu::query()->where('old', Process::CONFIGURATIONS_TOOLS)->firstOrFail()->getKey(), + 'process' => Process::ANNOUNCEMENT, + 'title' => 'Publicação de avisos', + 'order' => 0, + 'parent_old' => Process::CONFIGURATIONS_TOOLS, + 'link' => '/avisos/publicacao', + ]); + } + + public function down(): void + { + Menu::query()->where('old', Process::ANNOUNCEMENT)->delete(); + } +}; diff --git a/database/migrations/data/2024_10_04_173800_create_config_matricula_permitir_cursando.php b/database/migrations/data/2024_10_04_173800_create_config_matricula_permitir_cursando.php new file mode 100644 index 0000000000..3fcc7b23db --- /dev/null +++ b/database/migrations/data/2024_10_04_173800_create_config_matricula_permitir_cursando.php @@ -0,0 +1,32 @@ +firstOrCreate([ + 'name' => 'Validações de sistema', + ]); + + Setting::query()->updateOrCreate([ + 'key' => 'legacy.app.rematricula.permitir_cursando', + ], [ + 'setting_category_id' => $category->getKey(), + 'value' => '0', + 'type' => 'boolean', + 'description' => 'Permitir rematrícula automática de alunos com situação cursando?', + 'hint' => null, + ]); + } + + public function down(): void + { + Setting::query()->where('key', 'legacy.app.rematricula.permitir_cursando')->delete(); + } +}; diff --git a/ieducar/intranet/educar_avancar_mod_cad.php b/ieducar/intranet/educar_avancar_mod_cad.php index 288d8f8602..5cbee61fac 100644 --- a/ieducar/intranet/educar_avancar_mod_cad.php +++ b/ieducar/intranet/educar_avancar_mod_cad.php @@ -2,6 +2,7 @@ use App\Models\LegacyInstitution; use App\Models\LegacySchoolAcademicYear; +use App\Models\RegistrationStatus; use Illuminate\Support\Facades\Session; return new class extends clsCadastro @@ -10,6 +11,16 @@ public $data_matricula; + public $permitir_cursando; + + public const SITUACOES_BASE = [ + RegistrationStatus::APPROVED, + RegistrationStatus::REPROVED, + RegistrationStatus::APPROVED_WITH_DEPENDENCY, + RegistrationStatus::APPROVED_BY_BOARD, + RegistrationStatus::REPROVED_BY_ABSENCE + ]; + public function Inicializar() { $retorno = 'Novo'; @@ -21,6 +32,8 @@ public function Inicializar() url(path: 'intranet/educar_index.php') => 'Escola', ]); + $this->permitir_cursando = config('legacy.app.rematricula.permitir_cursando'); + return $retorno; } @@ -33,14 +46,16 @@ public function Gerar() $this->inputsHelper()->dynamic(helperNames: 'turma', inputOptions: ['label' => 'Selecione a turma do ano anterior', 'required' => false]); $this->inputsHelper()->dynamic(helperNames: 'anoLetivo', inputOptions: ['label' => 'Ano destino'], helperOptions: $anoLetivoHelperOptions); $this->inputsHelper()->date(attrName: 'data_matricula', inputOptions: ['label' => 'Data da matricula', 'placeholder' => 'dd/mm/yyyy']); - Portabilis_View_Helper_Application::loadJavascript(viewInstance: $this, files: [ + $this->permitir_cursando ? '' : '/vendor/legacy/Cadastro/Assets/Javascripts/RematriculaAutomatica.js', '/vendor/legacy/Cadastro/Assets/Javascripts/RematriculaAutomaticaModal.js', ]); } public function Novo() { + $this->permitir_cursando = config('legacy.app.rematricula.permitir_cursando'); + $anoLetivo = request('ano_letivo'); $ano = request('ano'); @@ -128,9 +143,10 @@ protected function rematricularAlunos($escolaId, $cursoId, $serieId, $turmaId, $ " ); - if ($result && $situacao == 1 || $situacao == 12 || $situacao == 13) { + if ($result && $situacao == RegistrationStatus::APPROVED ||$situacao == RegistrationStatus::APPROVED_WITH_DEPENDENCY || + $situacao == RegistrationStatus::APPROVED_BY_BOARD ||($this->permitir_cursando && $situacao == RegistrationStatus::ONGOING)) { $result = $this->rematricularAlunoAprovado(escolaId: $escolaId, serieId: $serieId, ano: $this->ano_letivo, alunoId: $alunoId); - } elseif ($result && $situacao == 2 || $situacao == 14) { + } elseif ($result && $situacao == RegistrationStatus::REPROVED || $situacao == RegistrationStatus::REPROVED_BY_ABSENCE) { $result = $this->rematricularAlunoReprovado(escolaId: $escolaId, cursoId: $cursoId, serieId: $serieId, ano: $this->ano_letivo, alunoId: $alunoId); } @@ -221,6 +237,13 @@ protected function selectMatriculas($escolaId, $cursoId, $serieId, $turmaId, $an { $anoAnterior = $this->ano_letivo - 1; + $situacoesArray = $this->permitir_cursando + ? array_merge(self::SITUACOES_BASE, [RegistrationStatus::ONGOING]) + : self::SITUACOES_BASE; + + $situacoes = implode(', ', $situacoesArray); + + $sql = " SELECT cod_matricula, @@ -233,7 +256,7 @@ protected function selectMatriculas($escolaId, $cursoId, $serieId, $turmaId, $an AND aluno.cod_aluno = ref_cod_aluno ) as nome FROM pmieducar.matricula m, pmieducar.matricula_turma - WHERE aprovado in (1, 2, 12, 13, 14) + WHERE aprovado in ({$situacoes}) AND m.ativo = 1 AND ref_ref_cod_escola = $escolaId AND ref_ref_cod_serie = $serieId @@ -289,8 +312,12 @@ protected function existeMatriculasAprovadasReprovadas($escolaId, $cursoId, $ser $matriculas = $objMatricula->lista4(escolaId: $escolaId, cursoId: $cursoId, serieId: $serieId, turmaId: $turmaId, ano: $anoAnterior); $qtdMatriculasAprovadasReprovadas = 0; + $situacoesArray = $this->permitir_cursando + ? array_merge(self::SITUACOES_BASE, [RegistrationStatus::ONGOING]) + : self::SITUACOES_BASE; + foreach ($matriculas as $m) { - if (in_array(needle: $m['aprovado'], haystack: [1, 2, 12, 13, 14])) { + if (in_array(needle: $m['aprovado'], haystack: $situacoesArray)) { $qtdMatriculasAprovadasReprovadas++; } } diff --git a/ieducar/intranet/educar_distribuicao_uniforme_cad.php b/ieducar/intranet/educar_distribuicao_uniforme_cad.php index ddc374ad43..d411f482a0 100644 --- a/ieducar/intranet/educar_distribuicao_uniforme_cad.php +++ b/ieducar/intranet/educar_distribuicao_uniforme_cad.php @@ -11,6 +11,10 @@ */ public $pessoa_logada; + public $ref_cod_instituicao; + + public $ref_cod_escola; + public UniformDistribution $uniformDistribution; public function Inicializar() @@ -54,6 +58,7 @@ public function Inicializar() public function Gerar() { $this->uniformDistribution ?? $this->uniformDistribution = new UniformDistribution(); + $this->ref_cod_escola = $this->uniformDistribution->school_id; $objEscola = new clsPmieducarEscola(); $lista = $objEscola->lista(); @@ -214,6 +219,44 @@ public function Gerar() 'placeholder' => 'Tamanho', ]); + $this->inputsHelper()->integer(attrName: 'pants_fem_qty', inputOptions: [ + 'required' => false, + 'label' => 'Calça feminina (tecidos diversos)', + 'value' => request(key: 'pants_fem_qty', default: $this->uniformDistribution->pants_fem_qty), + 'max_length' => 2, + 'size' => 15, + 'inline' => true, + 'placeholder' => 'Quantidade', + ]); + + $this->inputsHelper()->text(attrNames: 'pants_fem_tm', inputOptions: [ + 'required' => false, + 'label' => '', + 'value' => request(key: 'pants_fem_tm', default: $this->uniformDistribution->pants_fem_tm), + 'max_length' => 10, + 'size' => 15, + 'placeholder' => 'Tamanho', + ]); + + $this->inputsHelper()->integer(attrName: 'pants_mas_qty', inputOptions: [ + 'required' => false, + 'label' => 'Calça masculina (tecidos diversos)', + 'value' => request(key: 'pants_mas_qty', default: $this->uniformDistribution->pants_mas_qty), + 'max_length' => 2, + 'size' => 15, + 'inline' => true, + 'placeholder' => 'Quantidade', + ]); + + $this->inputsHelper()->text(attrNames: 'pants_mas_tm', inputOptions: [ + 'required' => false, + 'label' => '', + 'value' => request(key: 'pants_mas_tm', default: $this->uniformDistribution->pants_mas_tm), + 'max_length' => 10, + 'size' => 15, + 'placeholder' => 'Tamanho', + ]); + $this->inputsHelper()->integer(attrName: 'socks_qty', inputOptions: [ 'required' => false, 'label' => 'Meias', @@ -252,6 +295,25 @@ public function Gerar() 'placeholder' => 'Tamanho', ]); + $this->inputsHelper()->integer(attrName: 'shorts_skirt_qty', inputOptions: [ + 'required' => false, + 'label' => 'Shorts saia', + 'value' => request(key: 'shorts_skirt_qty', default: $this->uniformDistribution->shorts_skirt_qty), + 'max_length' => 2, + 'size' => 15, + 'inline' => true, + 'placeholder' => 'Quantidade', + ]); + + $this->inputsHelper()->text(attrNames: 'shorts_skirt_tm', inputOptions: [ + 'required' => false, + 'label' => '', + 'value' => request(key: 'shorts_skirt_tm', default: $this->uniformDistribution->shorts_skirt_tm), + 'max_length' => 10, + 'size' => 15, + 'placeholder' => 'Tamanho', + ]); + $this->inputsHelper()->integer(attrName: 'shorts_tactel_qty', inputOptions: [ 'required' => false, 'label' => 'Bermuda masculina (tecidos diversos)', @@ -371,7 +433,9 @@ public function Editar() 'student_id' => request('ref_cod_aluno'), ]); - $uniformDistribution->update(request()->all()); + $uniformDistribution->update(array_merge([ + 'complete_kit' => request()->boolean('complete_kit'), + ], request()->all())); if ($uniformDistribution->save()) { $this->redirectIf(condition: true, url: 'educar_distribuicao_uniforme_lst.php?ref_cod_aluno='.request('ref_cod_aluno')); diff --git a/ieducar/intranet/educar_distribuicao_uniforme_det.php b/ieducar/intranet/educar_distribuicao_uniforme_det.php index f8c392ecda..f3302f2b43 100644 --- a/ieducar/intranet/educar_distribuicao_uniforme_det.php +++ b/ieducar/intranet/educar_distribuicao_uniforme_det.php @@ -91,14 +91,26 @@ public function Gerar() 'Quantidade de calça jeans', $uniformDistribution->pants_jeans_qty ?: '0', ]); + $this->addDetalhe(detalhe: [ + 'Quantidade de calça feminina (tecidos diversos)', + $uniformDistribution->pants_fem_qty ?: '0', + ]); + $this->addDetalhe(detalhe: [ + 'Quantidade de calça masculina (tecidos diversos)', + $uniformDistribution->pants_mas_qty ?: '0', + ]); $this->addDetalhe(detalhe: [ 'Quantidade de meias', - $uniformDistribution->meias_qtd ?: '0', + $uniformDistribution->socks_qty ?: '0', ]); $this->addDetalhe(detalhe: [ 'Quantidade de saias', $uniformDistribution->skirt_qty ?: '0', ]); + $this->addDetalhe(detalhe: [ + 'Quantidade de shorts saias', + $uniformDistribution->shorts_skirt_qty ?: '0', + ]); $this->addDetalhe(detalhe: [ 'Bermuda masculina (tecidos diversos)', $uniformDistribution->shorts_tactel_qty ?: '0', diff --git a/ieducar/intranet/include/pmieducar/clsPmieducarInstituicao.inc.php b/ieducar/intranet/include/pmieducar/clsPmieducarInstituicao.inc.php index a939204e13..50664166ba 100644 --- a/ieducar/intranet/include/pmieducar/clsPmieducarInstituicao.inc.php +++ b/ieducar/intranet/include/pmieducar/clsPmieducarInstituicao.inc.php @@ -755,6 +755,9 @@ public function cadastra() public function edita() { if (is_numeric($this->cod_instituicao)) { + + Cache::forget('instituicao_' . $this->cod_instituicao); + $db = new clsBanco(); $gruda = ''; $set = ''; @@ -1297,7 +1300,7 @@ public function primeiraAtiva() public function detalhe() { if (is_numeric($this->cod_instituicao)) { - return Cache::remember('instituicao_', now()->addMinutes(180), function () { + return Cache::remember('instituicao_' . $this->cod_instituicao, now()->addMinutes(180), function () { $db = new clsBanco(); $db->Consulta("SELECT {$this->_todos_campos},fcn_upper_nrm(nm_instituicao) as nm_instituicao_upper FROM {$this->_tabela} WHERE cod_instituicao = '{$this->cod_instituicao}'"); $db->ProximoRegistro(); @@ -1317,7 +1320,7 @@ public function detalhe() public function existe() { if (is_numeric($this->cod_instituicao)) { - $db = new clsBanco(); + $db = new clsBanco; $db->Consulta("SELECT 1 FROM {$this->_tabela} WHERE cod_instituicao = '{$this->cod_instituicao}'"); $db->ProximoRegistro(); diff --git a/ieducar/intranet/scripts/extra/educar-distribuicao-uniforme-cad.js b/ieducar/intranet/scripts/extra/educar-distribuicao-uniforme-cad.js index 211cedf27d..aa967c8ff9 100644 --- a/ieducar/intranet/scripts/extra/educar-distribuicao-uniforme-cad.js +++ b/ieducar/intranet/scripts/extra/educar-distribuicao-uniforme-cad.js @@ -10,6 +10,9 @@ function bloqueiaCamposQuantidade() { $j('#pants_jeans_qty').val('').attr('disabled', 'disabled'); $j('#skirt_qty').val('').attr('disabled', 'disabled'); $j('#coat_jacket_qty').val('').attr('disabled', 'disabled'); + $j('#pants_fem_qty').val('').attr('disabled', 'disabled'); + $j('#pants_mas_qty').val('').attr('disabled', 'disabled'); + $j('#shorts_skirt_qty').val('').attr('disabled', 'disabled'); return true; } @@ -25,6 +28,9 @@ function liberaCamposQuantidade() { $j('#pants_jeans_qty').val('').removeAttr('disabled'); $j('#skirt_qty').val('').removeAttr('disabled'); $j('#coat_jacket_qty').val('').removeAttr('disabled'); + $j('#pants_fem_qty').val('').removeAttr('disabled'); + $j('#pants_mas_qty').val('').removeAttr('disabled'); + $j('#shorts_skirt_qty').val('').removeAttr('disabled'); } $j(document).ready(function () { diff --git a/ieducar/lib/App/Model/IedFinder.php b/ieducar/lib/App/Model/IedFinder.php index b169ba3467..f8b00c9e01 100644 --- a/ieducar/lib/App/Model/IedFinder.php +++ b/ieducar/lib/App/Model/IedFinder.php @@ -7,6 +7,7 @@ use App\Models\LegacySchool; use App\Models\LegacySchoolClass; use App\Models\LegacySchoolClassStage; +use App\Models\LegacyUserType; use iEducar\Modules\AcademicYear\Exceptions\DisciplineNotLinkedToRegistrationException; use iEducar\Modules\Enrollments\Exceptions\StudentNotEnrolledInSchoolClass; use iEducar\Modules\EvaluationRules\Exceptions\EvaluationRuleNotDefinedInLevel; @@ -111,6 +112,19 @@ public static function getEscolasByUser($instituicaoId) return $query->get()->sortBy('name')->getKeyValueArray('name'); } + /** + * Retorna todos os tipo de usuários. + * + * @return array + */ + public static function getTiposUsuario(bool $hideAdmin = true) + { + return LegacyUserType::query() + ->when($hideAdmin, fn ($q) => $q->where('nivel', '<>', LegacyUserType::LEVEL_ADMIN)) + ->orderBy('nm_tipo') + ->pluck('nm_tipo', 'cod_tipo_usuario'); + } + /** * Retorna um nome de curso, procurando pelo seu código. * diff --git a/ieducar/modules/Api/Views/InstituicaoDocumentacaoController.php b/ieducar/modules/Api/Views/InstituicaoDocumentacaoController.php index 6d4911bc63..dc5ef1767d 100644 --- a/ieducar/modules/Api/Views/InstituicaoDocumentacaoController.php +++ b/ieducar/modules/Api/Views/InstituicaoDocumentacaoController.php @@ -1,42 +1,51 @@ getRequest()->instituicao_id; - $var2 = $this->getRequest()->titulo_documento; - $var3 = $this->getRequest()->url_documento; - $var4 = $this->getRequest()->ref_usuario_cad; - $var5 = $this->getRequest()->ref_cod_escola; - - $sql = "INSERT INTO pmieducar.instituicao_documentacao (instituicao_id, titulo_documento, url_documento, ref_usuario_cad, ref_cod_escola) VALUES ($var1, '$var2', '$var3', $var4, $var5)"; - $this->fetchPreparedQuery($sql); - - $sql = "SELECT MAX(id) FROM pmieducar.instituicao_documentacao WHERE instituicao_id = $var1"; - $novoId = $this->fetchPreparedQuery($sql); - - return ['id' => $novoId[0][0]]; + LegacyInstitutionDocument::create([ + 'instituicao_id' => request()->integer('instituicao_id'), + 'titulo_documento' => request()->string('titulo_documento'), + 'url_documento' => request()->string('url_documento'), + 'ref_usuario_cad' => request()->integer('ref_usuario_cad'), + 'ref_cod_escola' => request()->integer('ref_cod_escola'), + ]); + + return [ + 'id' => LegacyInstitutionDocument::query()->select('id')->max('id'), + ]; } protected function getDocuments() { - $var1 = $this->getRequest()->instituicao_id; - $sql = "SELECT * FROM pmieducar.instituicao_documentacao WHERE instituicao_id = $var1 ORDER BY id DESC"; - $instituicao = $this->fetchPreparedQuery($sql); - $attrs = ['id', 'titulo_documento', 'url_documento', 'ref_usuario_cad', 'ref_cod_escola']; - $instituicao = Portabilis_Array_Utils::filterSet($instituicao, $attrs); - - return ['documentos' => $instituicao]; + $instituitionId = request()->integer('instituicao_id'); + + $documents = LegacyInstitutionDocument::query() + ->select([ + 'id', + 'titulo_documento', + 'url_documento', + 'ref_usuario_cad', + 'ref_cod_escola', + ]) + ->where('instituicao_id', $instituitionId) + ->orderByDesc('id') + ->get() + ->toArray(); + + return ['documentos' => $documents]; } protected function deleteDocuments() { - $var1 = $this->getRequest()->id; - $sql = "DELETE FROM pmieducar.instituicao_documentacao WHERE id = $var1"; - $instituicao = $this->fetchPreparedQuery($sql); + $documentId = request()->integer('id'); - return $instituicao; + return LegacyInstitutionDocument::query() + ->whereKey($documentId) + ->delete(); } public function Gerar() diff --git a/ieducar/modules/Api/Views/TurmaController.php b/ieducar/modules/Api/Views/TurmaController.php index e25ee0b840..570512f44e 100644 --- a/ieducar/modules/Api/Views/TurmaController.php +++ b/ieducar/modules/Api/Views/TurmaController.php @@ -228,6 +228,7 @@ protected function getTurmasPorEscola() t.ref_ref_cod_escola as escola_id, t.turma_turno_id as turno_id, t.ref_cod_regente, + t.max_aluno, json_agg( json_build_object( 'serie_id', s.cod_serie, @@ -268,7 +269,7 @@ protected function getTurmasPorEscola() $turmas = $this->fetchPreparedQuery($sql, $params); - $attrs = ['id', 'nome', 'ano', 'escola_id', 'turno_id', 'curso_id', 'series_regras', 'ref_cod_regente', 'updated_at', 'deleted_at']; + $attrs = ['id', 'nome', 'ano', 'escola_id', 'turno_id', 'curso_id', 'series_regras', 'ref_cod_regente', 'max_aluno', 'updated_at', 'deleted_at']; $turmas = Portabilis_Array_Utils::filterSet($turmas, $attrs); foreach ($turmas as $key => $turma) { diff --git a/ieducar/modules/RegraAvaliacao/Views/EditController.php b/ieducar/modules/RegraAvaliacao/Views/EditController.php index 8f84c359ac..fb279a657e 100644 --- a/ieducar/modules/RegraAvaliacao/Views/EditController.php +++ b/ieducar/modules/RegraAvaliacao/Views/EditController.php @@ -1,5 +1,6 @@ isPresenceTypeCompatible($this->getRequest()->tipoPresenca, $this->getRequest()->regraDiferenciada)) { + $this->mensagem = 'A regra inclusiva selecionada possuí apuração de frequência incompatível, verifique a configuração e tente novamente.'; + + return false; + } + $data = []; if ($_POST['tipoNota'] == 3) { @@ -1043,4 +1050,24 @@ protected function _save() return true; } + + /** + * Valida se a regra a ser salva e a regra diferenciada possuem apuração de frequência compatível + * + * @return bool + */ + private function isPresenceTypeCompatible(int $presenceType, ?int $deficiencyEvaluationRuleId) + { + if (empty($deficiencyEvaluationRuleId)) { + return true; + } + + $deficiencyEvaluationRule = LegacyEvaluationRule::findOrFail($deficiencyEvaluationRuleId); + + if ($presenceType == $deficiencyEvaluationRule->tipo_presenca) { + return true; + } + + return false; + } } diff --git a/public/vendor/legacy/Cadastro/Assets/Javascripts/AlunoShow.js b/public/vendor/legacy/Cadastro/Assets/Javascripts/AlunoShow.js index 2261752959..8e7278bdd8 100644 --- a/public/vendor/legacy/Cadastro/Assets/Javascripts/AlunoShow.js +++ b/public/vendor/legacy/Cadastro/Assets/Javascripts/AlunoShow.js @@ -91,11 +91,11 @@ var handleGetMatriculas = function(dataResponse) { } - $j('').html(`${matricula.turma_nome ?? ''}`).appendTo($tr); - $j('').html(`${matricula.ultima_enturmacao}`).appendTo($tr); - $j('').html(`${matricula.serie_nome}`).appendTo($tr); - $j('').html(`${matricula.curso_nome}`).appendTo($tr); - $j('').html(`${matricula.escola_nome}`).appendTo($tr); + $j('').html(`${matricula.turma_nome ?? ''}`).appendTo($tr); + $j('').html(`${matricula.ultima_enturmacao}`).appendTo($tr); + $j('').html(`${matricula.serie_nome}`).appendTo($tr); + $j('').html(`${matricula.curso_nome}`).appendTo($tr); + $j('').html(`${matricula.escola_nome}`).appendTo($tr); if(matricula.data_entrada != ""){ if(matricula.user_can_access && matricula.user_can_change_date){ diff --git a/public/vendor/legacy/Cadastro/Assets/Javascripts/RematriculaAutomatica.js b/public/vendor/legacy/Cadastro/Assets/Javascripts/RematriculaAutomatica.js index aa6b9df4a3..2119894830 100644 --- a/public/vendor/legacy/Cadastro/Assets/Javascripts/RematriculaAutomatica.js +++ b/public/vendor/legacy/Cadastro/Assets/Javascripts/RematriculaAutomatica.js @@ -29,4 +29,4 @@ $j(document).ready(function(){ //Atualiza o ano letivo para usuários cuja escola já venha selecionada updateEscolaAnoLetivo(); -}); // ready \ No newline at end of file +}); // ready diff --git a/resources/views/announcement/publish/create.blade.php b/resources/views/announcement/publish/create.blade.php new file mode 100644 index 0000000000..14df837f25 --- /dev/null +++ b/resources/views/announcement/publish/create.blade.php @@ -0,0 +1,123 @@ +@extends('layout.default') + +@section('content') + + + + + + Publicação de avisos + + + + + Nome + * + + + + + + + + + + Conteúdo do aviso + * + + + + {{ old('description', $announcement->description) }} + + + + + + Repetir aviso a cada login do usuário? + + + + repeat_on_login)> + + + + + + Exigir que o usuário marque "Estou ciente" para poder fechar o aviso? + + + + show_confirmation)> + + + + + + Incluir aviso de vagas disponíveis na unidades escolares vinculadas ao usuário? + + + + + + show_vacancy)> + + + + + + Ativar aviso + + + deleted_at === null)> + + + + + Tipos de usuários que serão notificados + + @include('form.select-user-type-multiple') + + + + + + + Salvar + + + +@endsection + +@prepend('styles') + + +@endprepend + +@prepend('scripts') + + + + + + + + + +@endprepend diff --git a/resources/views/announcement/publish/index.blade.php b/resources/views/announcement/publish/index.blade.php new file mode 100644 index 0000000000..8527c361de --- /dev/null +++ b/resources/views/announcement/publish/index.blade.php @@ -0,0 +1,65 @@ +@extends('layout.default') + +@inject('presigner', App\Services\UrlPresigner::class) + +@push('styles') + +@endpush + +@section('content') + Avisos + + + + Nome + Tipos de Usuário + Data + Status + + + + @forelse($announcements as $announcement) + + @can('modify', \App\Process::ANNOUNCEMENT) + + {{ $announcement->name }} + + + {{ $announcement->userTypes->implode('nm_tipo', ', ') }} + + + {{ $announcement->created_at->format('d/m/Y H:i') }} + + + {{ $announcement->trashed() ? 'Desativado' : 'Ativado' }} + + @else + {{ $announcement->name }}/> + {{ $announcement->userTypes->implode('nm_tipo', ', ') }} + {{ $announcement->created_at->format('d/m/Y H:i') }} + {{ $announcement->trashed() ? 'Desativado' : 'Ativado' }} + @endcan + + + @empty + + Não existe nenhum aviso + + @endforelse + + + + + + + + {{ $announcements->links() }} + + + + @can('create', \App\Process::ANNOUNCEMENT) + + Novo + + @endcan +@endsection diff --git a/resources/views/announcement/user/show.blade.php b/resources/views/announcement/user/show.blade.php new file mode 100644 index 0000000000..187afcd659 --- /dev/null +++ b/resources/views/announcement/user/show.blade.php @@ -0,0 +1,143 @@ +@extends('layout.default') + +@push('styles') + + +@endpush + +@section('content') + + + + + Avisos + + + + + {!! $announcement->description !!} + + + + @if($announcement->show_vacancy) + + Vagas disponíveis nas unidades escolares + + + + + + @endif + + + @if($announcement->show_vacancy) + + + + ESCOLA + CURSO + SÉRIE + TURMA + VAGAS + + + + @forelse($schools as $schoolName => $courses) + @php + $row1 = 0; + foreach ($courses as $grades) { + foreach ($grades as $schoolClasses) { + foreach ($schoolClasses as $schoolClass) { + $row1++; + } + } + } + $isFirstSchool = true; + @endphp + + @foreach($courses as $courseName => $grades) + @php + $row2 = 0; + foreach ($grades as $schoolClasses) { + foreach ($schoolClasses as $schoolClass) { + $row2++; + } + } + $isFirstCourse = true; + @endphp + + @foreach($grades as $gradeName => $schoolClasses) + @php + $row3 = 0; + foreach ($schoolClasses as $schoolClass) { + $row3++; + } + @endphp + + @foreach($schoolClasses as $schoolClass) + + @if($isFirstSchool) + {{ $schoolName }} + @php + $isFirstSchool = false; + @endphp + @endif + @if($isFirstCourse) + {{ $courseName. '|'. $row2 }} + @php + $isFirstCourse = false; + @endphp + @endif + @if($loop->first) + {{ $gradeName }} + @endif + {{ $schoolClass->nm_turma }} + {{ $schoolClass->vagas }} + + @endforeach + @endforeach + @endforeach + @empty + + Nenhuma escola com vaga encontrada + + @endforelse + + + @endif + @if($announcement->show_confirmation) + + + Estou ciente + + @endif + +@endsection diff --git a/resources/views/form/select-user-type-multiple.blade.php b/resources/views/form/select-user-type-multiple.blade.php new file mode 100644 index 0000000000..7fcbc87a2f --- /dev/null +++ b/resources/views/form/select-user-type-multiple.blade.php @@ -0,0 +1,51 @@ + + + @foreach(App_Model_IedFinder::getTiposUsuario() as $id => $name) + {{ $name }} + @endforeach + + + +@push('scripts') + + + + +@endpush +@if($userTypes = old('tipo_usuario', $userTypes)) + + @php + $userTypes = collect($userTypes); + + if ($userTypes->isNotEmpty() && is_array($userTypes[0])){ + $userTypes = $userTypes->map(function ($value) { + return $value[0]; + }); + } + @endphp + + @push('scripts') + + @endpush +@endif diff --git a/routes/web.php b/routes/web.php index 37df3d376b..e766917cd9 100644 --- a/routes/web.php +++ b/routes/web.php @@ -5,6 +5,7 @@ use App\Http\Controllers\ExportController; use App\Http\Controllers\SchoolClassController; use App\Http\Controllers\WebController; +use App\Http\Middleware\AnnouncementMiddleware; use App\Process; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Route; @@ -121,7 +122,7 @@ Route::get('/abre-url-privada', 'OpenPrivateUrlController@open')->name('open_private_url.open'); Route::get('/notificacoes', 'NotificationController@index')->name('notifications.index'); - Route::get('/notificacoes/retorna-notificacoes-usuario', 'NotificationController@getByLoggedUser')->name('notifications.get-by-logged-user'); + Route::get('/notificacoes/retorna-notificacoes-usuario', 'NotificationController@getByLoggedUser')->withoutMiddleware(AnnouncementMiddleware::class)->name('notifications.get-by-logged-user'); Route::get('/notificacoes/quantidade-nao-lidas', 'NotificationController@getNotReadCount')->name('notifications.get-not-read-count'); Route::post('/notificacoes/marca-como-lida', 'NotificationController@markAsRead')->name('notifications.mark-as-read'); Route::post('/notificacoes/marca-todas-como-lidas', 'NotificationController@markAllRead')->name('notifications.mark-all-read'); @@ -134,6 +135,14 @@ Route::get('/arquivo/exportacoes/novo', 'FileExportController@create')->middleware('can:modify:' . Process::DOCUMENT_EXPORT)->name('file.export.create'); Route::post('/arquivo/exportacoes/novo', 'FileExportController@store')->middleware('can:modify:' . Process::DOCUMENT_EXPORT)->name('file.export.store'); + Route::get('/avisos/publicacao', 'AnnouncementPublishController@index')->middleware('can:view:' . Process::ANNOUNCEMENT)->name('announcement.publish.index'); + Route::get('/avisos/publicacao/criar', 'AnnouncementPublishController@create')->middleware('can:create:' . Process::ANNOUNCEMENT)->name('announcement.publish.create'); + Route::post('/avisos/publicacao/criar', 'AnnouncementPublishController@store')->middleware('can:create:' . Process::ANNOUNCEMENT)->name('announcement.publish.store'); + Route::get('/avisos/publicacao/{announcement}/editar', 'AnnouncementPublishController@edit')->middleware('can:modify:' . Process::ANNOUNCEMENT)->name('announcement.publish.edit'); + Route::post('/avisos/publicacao/{announcement}/editar', 'AnnouncementPublishController@update')->middleware('can:modify:' . Process::ANNOUNCEMENT)->name('announcement.publish.update'); + Route::get('/avisos', 'AnnouncementUserController@show')->withoutMiddleware(AnnouncementMiddleware::class)->name('announcement.user.show'); + Route::post('/avisos', 'AnnouncementUserController@confirm')->withoutMiddleware(AnnouncementMiddleware::class)->name('announcement.user.confirm'); + Route::get('/atualiza-data-entrada', 'UpdateRegistrationDateController@index')->middleware('can:view:' . Process::UPDATE_REGISTRATION_DATE)->name('update-registration-date.index'); Route::post('/atualiza-data-entrada', 'UpdateRegistrationDateController@updateStatus')->middleware('can:modify:' . Process::UPDATE_REGISTRATION_DATE)->name('update-registration-date.update-date');