@extends('layouts.meeting') @section('content-meeting') @php $resolveClosedVotingStatus = function ($voting, $meetingPauta) { if (!$voting || !isset($voting->closed_at)) { return null; } $resultValue = null; if (\App\Models\MeetingPauta::hasCompletedSessionResult($meetingPauta)) { $resultValue = $meetingPauta->session_result; } elseif (!empty($voting->session_result)) { $resultValue = $voting->session_result; } if ($resultValue) { return [ 'label' => \App\Models\MeetingPauta::sessionResultLabel($resultValue) ?? 'Votação encerrada', 'class' => $resultValue === \App\Models\MeetingPauta::RESULT_REJECTED ? 'text-danger' : 'text-primary', ]; } $approved = $voting->situation($voting); return [ 'label' => $approved ? 'Votação aprovada' : 'Votação reprovada', 'class' => $approved ? 'text-primary' : 'text-danger', ]; }; $buildSessionResultSelectOptions = function ($currentResult, $hasVoting) { $placeholderLabel = $hasVoting ? 'Selecione o resultado final' : 'Selecione o andamento inicial'; $stage = $hasVoting ? \App\Models\MeetingPauta::STAGE_FINAL_RESULT : \App\Models\MeetingPauta::STAGE_INITIAL_READING; $primaryOptions = \App\Models\MeetingPauta::sessionResultSelectableOptions([$currentResult], $stage); $html = ''; if (!empty($primaryOptions)) { $groupLabel = \App\Models\MeetingPauta::sessionResultStageLabel($stage) ?: 'Opções disponíveis'; $html .= ''; foreach ($primaryOptions as $value => $label) { $selected = $currentResult === $value ? ' selected' : ''; $html .= ''; } $html .= ''; } if ($currentResult) { $currentStage = \App\Models\MeetingPauta::sessionResultStage($currentResult); $currentLabel = \App\Models\MeetingPauta::sessionResultLabel($currentResult) ?? $currentResult; $currentIncludedInPrimary = array_key_exists($currentResult, $primaryOptions); if (!$currentIncludedInPrimary) { $historicalGroupLabel = 'Status atual preservado'; if ($currentStage) { $historicalGroupLabel .= ' - ' . (\App\Models\MeetingPauta::sessionResultStageLabel($currentStage) ?: $currentStage); } $html .= ''; $html .= ''; $html .= ''; } } return $html; }; $buildSessionResultHelpText = function ($currentResult, $hasVoting, $votingClosed) { if ($votingClosed) { return 'Resultado bloqueado após o encerramento da votação.'; } if (!$hasVoting) { return 'Sem votação aberta. Aqui você registra apenas o andamento inicial da sessão.'; } $currentStage = \App\Models\MeetingPauta::sessionResultStage($currentResult); if ($currentResult && $currentStage === \App\Models\MeetingPauta::STAGE_INITIAL_READING) { return 'Votação aberta. O andamento inicial anterior foi preservado no histórico; agora selecione apenas o resultado final.'; } return 'Votação aberta. Aqui você registra apenas o resultado final da sessão.'; }; @endphp
ENCERRAR SESSÃO @if ($hasOpenVoting)
Atenção! Não é possível encerrar a sessão enquanto existir votação em andamento.
@endif
Info! Defina o status de cada item da pauta para separar corretamente o que foi apenas lido do que foi efetivamente aprovado em votação.
    @forelse($summaryVotings as $voting)
  • @php $summaryStatus = $summaryVotingStatuses[$voting->id] ?? [ 'label' => 'Em votação', 'class' => 'text-warning', ]; @endphp @if (isset($blockVotingLabels[$voting->id])) {{ $blockVotingLabels[$voting->id] }} @elseif ($voting->ata_id > 0) ATA Nº - {{ $voting->getAta() }} @else @if ($voting->advice_id == 0) {{ $voting->getName()[0] }} @else {{ $voting->advice->commission->name }} - {{ $voting->getNameAdvice()[0] }} @endif @endif {{ $summaryStatus['label'] }}
  • @empty
  • Não existe votação encerrada
  • @endforelse

VOTAÇÃO

@if ($meeting)
@if ($last_voting != null) @php $lastAtaVoting = $meeting->voting()->where('ata_id', $last_voting->id)->first(); $lastAtaPauta = $ataPautas->get($last_voting->id); $lastAtaHasVoting = $ataVotingStarted->has((int) $last_voting->id); $lastAtaVotingClosed = isset($lastAtaVoting->closed_at); $lastAtaStatus = $resolveClosedVotingStatus($lastAtaVoting, $lastAtaPauta); @endphp ATA Nº - {{ $last_voting->number }}/{{ Carbon\Carbon::createFromFormat('d/m/Y H:i', $last_voting->date_start)->year }} @if ($lastAtaStatus)
{{ $lastAtaStatus['label'] }} @endif @if ($lastAtaPauta)
{{ $buildSessionResultHelpText($lastAtaPauta->session_result, $lastAtaHasVoting, $lastAtaVotingClosed) }}
@endif @endif
voting()->where('meeting_id', $meeting->id)->whereNotNull('deleted_at')->first()->closed_at)) style="margin-top: 10px;" @endif> @if ($ata_voting && $last_voting != null) @if (isset($meeting->voting()->where('ata_id', $last_voting->id)->first()->closed_at)) @else @if ($meeting->voting()->where('ata_id', $last_voting->id)->first()) @else @endif @endif @endif
@else Sessão anterior não possui ATA @endif
@if ($meeting) @php $atas = \App\Models\MeetingPauta::where('meeting_id', $meeting->id)->get(); @endphp @foreach ($atas as $atas) @if ($atas->ata_id) @php $meetingAta = \App\Models\Meeting::find($atas->ata_id); $votingAta = \App\Models\Voting::where('meeting_id', $meeting->id) ->where('ata_id', $atas->ata_id) ->first(); @endphp @if ($meetingAta) @php $ataPauta = $ataPautas->get($atas->ata_id); $ataHasVoting = $ataVotingStarted->has((int) $atas->ata_id); $ataVotingClosed = isset($votingAta->closed_at); $meetingAtaStatus = $resolveClosedVotingStatus($votingAta, $ataPautas->get($atas->ata_id)); @endphp
@if (!$votingAta && $ata_voting)
@endif
ATA Nº {{ $meetingAta->number }} / {{ \Carbon\Carbon::createFromFormat('d/m/Y H:i', $meetingAta->date_end)->year }} @if ($meetingAtaStatus)
{{ $meetingAtaStatus['label'] }} @endif @if ($ataPauta)
{{ $buildSessionResultHelpText($ataPauta->session_result, $ataHasVoting, $ataVotingClosed) }}
@endif
@if ($votingAta) @if ($votingAta->closed_at) @else @endif @else @endif
@endif @endif @endforeach @else
Sessão anterior não possui ATA
@endif
    @foreach ($advices as $item) @php $adviceVoting = $item->voting()->where('meeting_id', $meeting->id)->first(); $adviceStatus = $resolveClosedVotingStatus($adviceVoting, $advicePautas->get($item->id)); @endphp
  • @if ($advice_voting && !$adviceVoting)
    @endif
    {!! $item->commission->name . ' - ' !!} @if ($item->document_id > 0) @if ($item->document->document_type->parent_id) {{ $item->document->document_type->parent->name }} :: @endif {!! $item->document->document_type->name !!} - @if ($item->document->number == 0) @else {!! $item->document->number . '/' . $item->document->getYear($item->date) !!} @endif
    @if ($adviceStatus) {{ $adviceStatus['label'] }} @endif @endif @if ($item->laws_projects_id > 0) @if (!$item->project->law_type) {{ $item->project->law_type_id }} @else {!! mb_strtoupper($item->project->law_type->name, 'UTF-8') !!} @endif {!! $item->project->project_number . '/' . $item->project->getYearLawPublish($item->project->law_date) !!}
    @if ($adviceStatus) {{ $adviceStatus['label'] }} @endif @endif
    closed_at)) style="margin-top: 10px;" @endif> @if ($advice_voting) @if (isset($adviceVoting->closed_at)) @if ($item->document_id > 0) @endif @if ($item->laws_projects_id > 0) @endif @else @if (!$adviceVoting) @else @endif @endif @endif
  • @endforeach
@if ($doc_voting || $law_voting || $ata_voting || $advice_voting)
Votação em bloco
Nenhum item adicionado ao bloco.
Selecione documentos, projetos, atas ou pareceres abaixo e use "Adicionar ao bloco". O fluxo unitário continua funcionando normalmente.
A votação em bloco só funciona com 2 arquivos ou mais.
@endif
    @foreach ($docs as $item) @php $documentVoting = $item->voting()->where('meeting_id', $meeting->id)->first(); $documentAuthor = \App\Models\Assemblyman::where('id', $item->owner_id)->pluck('short_name')->first(); $documentPauta = $documentPautas->get($item->id); $documentHasVoting = $documentVotingStarted->has((int) $item->id); $documentVotingClosed = isset($documentVoting->closed_at); $documentIsNonVotingResult = $documentPauta && in_array($documentPauta->session_result, \App\Models\MeetingPauta::nonVotingResultValues(), true); $documentIsReadInExpediente = $documentPauta && $documentPauta->session_result === \App\Models\MeetingPauta::RESULT_READ_IN_EXPEDIENTE; $documentReadingCompleted = $documentPauta && (bool) $documentPauta->session_result_completed; $documentActionLabels = \App\Models\MeetingPauta::sessionResultActionLabels( $documentPauta ? $documentPauta->session_result : null ); $documentStatus = $resolveClosedVotingStatus($documentVoting, $documentPauta); $documentIsReadApproved = $item->isIndicacao() && $item->read && $item->approved; $documentLabel = ($item->document_type->parent_id ? $item->document_type->parent->name . ' :: ' : '') . $item->document_type->name . ($item->number == 0 ? '' : ' - ' . $item->number . '/' . $item->getYear($item->date)); @endphp
  • @if ($doc_voting && !$documentVoting)
    @endif
    {{ $documentAuthor }} - Documento : @if ($item->document_type->parent_id) {{ $item->document_type->parent->name }} :: @endif {!! $item->document_type->name !!} - @if ($item->number == 0) @else {!! $item->number . '/' . $item->getYear($item->date) !!} @endif
    @if ($documentStatus) {{ $documentStatus['label'] }} @elseif ($documentIsReadApproved) Lido e aprovado @endif @if ($documentPauta)
    {{ $buildSessionResultHelpText($documentPauta->session_result, $documentHasVoting, $documentVotingClosed) }}
    @endif
    closed_at)) style="margin-top: 10px;" @endif> @if ($doc_voting) @if (isset($documentVoting->closed_at)) @else @if (!$documentVoting) @else @endif @endif @endif
  • @endforeach
    @foreach ($laws as $item) @php $lawVoting = $item->voting()->where('meeting_id', $meeting->id)->first(); $lawPauta = $lawPautas->get($item->id); $lawHasVoting = $lawVotingStarted->has((int) $item->id); $lawVotingClosed = isset($lawVoting->closed_at); $lawIsNonVotingResult = $lawPauta && in_array($lawPauta->session_result, \App\Models\MeetingPauta::nonVotingResultValues(), true); $lawIsReadInExpediente = $lawPauta && $lawPauta->session_result === \App\Models\MeetingPauta::RESULT_READ_IN_EXPEDIENTE; $lawReadingCompleted = $lawPauta && (bool) $lawPauta->session_result_completed; $lawActionLabels = \App\Models\MeetingPauta::sessionResultActionLabels( $lawPauta ? $lawPauta->session_result : null ); $lawStatus = $resolveClosedVotingStatus($lawVoting, $lawPauta); @endphp
  • @if ($law_voting && !$lawVoting)
    @endif
    {!! \App\Models\Assemblyman::where('id', $item->assemblyman_id)->pluck('short_name')->first() !!} - Projeto de lei : @if (!$item->law_type) {{ $item->law_type_id }} @else {!! mb_strtoupper($item->law_type->name, 'UTF-8') !!} @endif {!! $item->project_number . '/' . $item->getYearLawPublish($item->law_date) !!}
    @if ($lawStatus) {{ $lawStatus['label'] }} @endif @if ($lawPauta)
    {{ $buildSessionResultHelpText($lawPauta->session_result, $lawHasVoting, $lawVotingClosed) }}
    @endif
    voting->closed_at)) style="margin-top: 30px;" @else style="margin-top: 10px;" @endif> @if ($law_voting) @if (isset($lawVoting->closed_at)) @else @if (!$lawVoting) @else @endif @endif @endif
  • @endforeach
@if ($last_voting != null) @endif @endsection