Files
compras/resources/views/sgf-invoices/index.blade.php
T
nala 976271f948
tests / ci (push) Canceled after 0s
commit melhorias1
2026-11-10 12:58:19 +02:00

10 lines
2.3 KiB
PHP

@extends('sgf-invoices.layout')
@section('content')
<section><h2>Escolher ligação e mapeamento aprovados</h2><form method="get"><label>Mapeamento<select id="mapping-choice" required><option value="">Escolher explicitamente</option>@foreach($options as $m)<option data-connection="{{ $m['connection'] }}" data-mapping="{{ $m['id'] }}" @selected($selection&&$selection['connection']===$m['connection']&&$selection['id']===$m['id'])>{{ $m['label'] }} · ordem #{{ $m['mapping']['order_id'] }}</option>@endforeach</select></label><input id="connection" type="hidden" name="connection"><input id="mapping" type="hidden" name="mapping"><button>Usar este mapeamento</button></form>
@if(!$options)<p>Não existem mapeamentos aprovados para esta empresa. Nenhum é escolhido automaticamente.</p>@endif</section>
@if($selection)<section><h2>Guardar novo rascunho</h2><form method="post" action="/facturas/envio-sgf">@csrf @include('sgf-invoices.document-form')<button>Guardar rascunho sem enviar</button></form></section>@endif
<section><h2>Rascunhos e resultados</h2><form method="get"><label>Estado<select name="phase"><option value="">Todos</option>@foreach(['draft'=>'Rascunho','previewed'=>'Conferido','sending'=>'Confirmação em curso','uncertain'=>'Resultado incerto','received_pending'=>'Recebido pendente','blocked'=>'Acesso bloqueado','review_required'=>'Nova conferência','not_sent'=>'Envio não confirmado','previewing'=>'Prévia em curso'] as $key=>$label)<option value="{{ $key }}" @selected(request('phase')===$key)>{{ $label }}</option>@endforeach</select></label><button>Filtrar</button></form>
<div class="scroll"><table><thead><tr><th>Referência</th><th>Documento</th><th>Estado</th><th>Versão</th></tr></thead><tbody>@forelse($rows as $r)<tr><td><a href="/facturas/envio-sgf/{{ $r->id }}">{{ $r->reference }}</a></td><td>{{ $r->number }}</td><td>{{ $r->phase }}</td><td>{{ $r->version }}</td></tr>@empty<tr><td colspan="4">Sem rascunhos neste filtro.</td></tr>@endforelse</tbody></table></div>{{ $rows->links() }}</section>
<script>const select=document.getElementById('mapping-choice');const fill=()=>{const o=select.selectedOptions[0];document.getElementById('connection').value=o?.dataset.connection??'';document.getElementById('mapping').value=o?.dataset.mapping??''};select.addEventListener('change',fill);fill();</script>
@endsection