<div class="card" style="margin-top:18px"><div class="card-head"><strong>Workflow</strong></div><div class="card-body"><div class="actions">@if(in_array($status,['draft','rejected'])&&auth()->user()->hasPermission($permissionPrefix.'.submit'))<form method="post" action="{{ route($routePrefix.'.submit',$document) }}">@csrf<button class="btn btn-warning">Submit for Approval</button></form>@endif @if($status==='pending_approval'&&auth()->user()->hasPermission($permissionPrefix.'.approve'))<form method="post" action="{{ route($routePrefix.'.approve',$document) }}">@csrf<button class="btn btn-success">Approve</button></form>@endif @if($status==='pending_approval'&&auth()->user()->hasPermission($permissionPrefix.'.reject'))<form method="post" action="{{ route($routePrefix.'.reject',$document) }}" style="display:flex;gap:8px"><input class="control" name="reason" placeholder="Rejection reason" required><button class="btn btn-danger">Reject</button></form>@endif @if($status==='approved'&&auth()->user()->hasPermission($permissionPrefix.'.post'))<form method="post" action="{{ route($routePrefix.'.post',$document) }}">@csrf<button class="btn btn-primary" data-confirm="Post this document to the ledger?">{{ $postLabel }}</button></form>@endif @if(in_array($status,['draft','rejected'])&&auth()->user()->hasPermission($permissionPrefix.'.delete_draft'))<form method="post" action="{{ route($routePrefix.'.destroy',$document) }}">@csrf @method('delete')<button class="btn btn-danger" data-confirm="Delete this draft?">Delete Draft</button></form>@endif</div>@if($document->journal)<div class="divider"></div><strong>Posted Journal: {{ $document->journal->journal_number }}</strong><div class="table-wrap"><table class="table"><thead><tr><th>Account</th><th>Description</th><th>Debit</th><th>Credit</th></tr></thead><tbody>@foreach($document->journal->lines as $line)<tr><td>{{ $line->account->code }} - {{ $line->account->name }}</td><td>{{ $line->description }}</td><td>{{ number_format((float)$line->debit,2) }}</td><td>{{ number_format((float)$line->credit,2) }}</td></tr>@endforeach</tbody></table></div>@endif</div></div>
