@php use Leantime\Domain\Logicmodelcanvas\Repositories\Logicmodelcanvas; $canvasName = 'logicmodel'; $canvasItem = $tpl->get('canvasItem') ?? []; $canvasItem = array_merge([ 'id' => '', 'box' => '', 'description' => '', 'conclusion' => '', 'assumptions' => '', 'data' => '', 'status' => '', 'relates' => '', 'impact' => '', 'milestoneId' => '', 'author' => '', 'authorFirstname' => '', 'authorLastname' => '', ], is_array($canvasItem) ? $canvasItem : []); $canvasTypes = $tpl->get('canvasTypes'); $hiddenStatusLabels = $tpl->get('statusLabels'); $statusLabels = $statusLabels ?? $hiddenStatusLabels; $hiddenRelatesLabels = $tpl->get('relatesLabels'); $relatesLabels = $relatesLabels ?? $hiddenRelatesLabels; $dataLabels = $tpl->get('dataLabels'); $id = ($canvasItem['id'] ?? '') !== '' ? $canvasItem['id'] : ''; // Resolve stage color for the pill $stages = Logicmodelcanvas::STAGES; $boxKey = $canvasItem['box'] ?? ''; $stageColor = '#888'; $stageBg = '#f0f0f0'; foreach ($stages as $stage) { if ('lm_' . $stage['key'] === $boxKey) { $stageColor = $stage['color']; $stageBg = $stage['bg']; break; } } $currentImpact = (string) ($canvasItem['impact'] ?? ''); @endphp
{{-- Header: stage pill --}}
{{ isset($canvasTypes[$canvasItem['box']]) ? $tpl->__($canvasTypes[$canvasItem['box']]['title']) : '' }}
{!! $tpl->displayNotification() !!}
{{-- ═══ Left Column: Content ═══ --}}
{{-- Title --}}

@if ($dataLabels[1]['active'])
@else @endif @if ($dataLabels[2]['active'])
@else @endif {{-- Comments section moved outside the form to avoid nested forms --}}
{{-- ═══ Right Column: Details Panel ═══ --}}
{{ $tpl->__('label.details') }}
{{-- Status --}} @if (! empty($statusLabels))
{{ $tpl->__('label.status') }}
@else @endif {{-- Priority --}}
{{ $tpl->__('logicmodel.priority.label') }}
{{-- Stage --}}
{{ $tpl->__('logicmodel.stage.label') }}
@if (! empty($relatesLabels))
{{ $tpl->__('label.relates') }}
@else @endif {{-- Author (read-only) --}} @if ($id !== '' && ($canvasItem['author'] ?? '') !== '')
{{ $tpl->__('label.author') }} {{ $canvasItem['authorFirstname'] ?? '' }} {{ $canvasItem['authorLastname'] ?? '' }}
@endif
{{-- Plugin hook for additional right-panel content (e.g. project links) --}} @if ($id !== '') @dispatchEvent('canvas.dialog.afterDetails', [ 'canvasItem' => $canvasItem, 'canvasName' => $canvasName, 'canvasId' => (int) session('currentLOGICMODELCanvas'), ]) @endif
{{-- ═══ Bottom: Actions ═══ --}}
@if ($login::userIsAtLeast($roles::$editor)) {!! $tpl->__('buttons.save_and_close') !!} @endif @if ($id != '') {{ $tpl->__('links.delete') }} @endif
{{-- Comments section rendered OUTSIDE the main form to avoid nested forms. The comments submodule has its own
which would break the outer form. --}} @if ($id !== '')

{{ $tpl->__('subtitles.discussion') }}

@include('comments::submodules.generalComment', ['formUrl' => '/' . $canvasName . 'canvas/editCanvasItem/' . $id])
@endif