@extends('layouts.app')
@section('title','New Weighbridge Ticket')
@section('crumbs', '<a href="'.route('weighbridge-tickets.index').'">Weighbridge</a> · <b>New ticket</b>')
@section('content')
<div class="card" style="max-width:980px"><div class="card-h"><h2>First weighing (opens ticket)</h2><div class="sp"><span class="bdg b-info">{{ $docNo }}</span></div></div>
<div class="card-b"><form method="POST" action="{{ route('weighbridge-tickets.store') }}">@csrf
<div class="frow">
<div class="fld c3"><label>Date *</label><input type="date" name="ticket_date" value="{{ date('Y-m-d') }}" required></div>
<div class="fld c3"><label>Type *</label><select name="transaction_type"><option value="sales-dispatch">Sales dispatch</option><option value="purchase-receipt">Purchase receipt</option><option value="internal-transfer">Internal transfer</option></select></div>
<div class="fld c3"><label>Vehicle no. *</label><input type="text" name="vehicle_no" required placeholder="GR 1234-22" style="text-transform:uppercase"></div>
<div class="fld c3"><label>Driver</label><input type="text" name="driver_name"></div>
<div class="fld c4"><label>Customer</label><select name="customer_id"><option value="">—</option>@foreach($customers as $c)<option value="{{ $c->id }}">{{ $c->display_name }}</option>@endforeach</select></div>
<div class="fld c4"><label>Supplier</label><select name="supplier_id"><option value="">—</option>@foreach($suppliers as $s)<option value="{{ $s->id }}">{{ $s->display_name }}</option>@endforeach</select></div>
<div class="fld c4"><label>Transporter</label><select name="transporter_id"><option value="">—</option>@foreach($transporters as $t)<option value="{{ $t->id }}">{{ $t->name }}</option>@endforeach</select></div>
<div class="fld c4"><label>Product / material</label><select name="product_id"><option value="">—</option>@foreach($products as $p)<option value="{{ $p->id }}">{{ $p->display_name }}</option>@endforeach</select></div>
<div class="fld c4"><label>Sales order</label><select name="sales_order_id"><option value="">—</option>@foreach($orders as $o)<option value="{{ $o->id }}">{{ $o->order_no }} — {{ $o->customer->name ?? '' }}</option>@endforeach</select></div>
<div class="fld c2"><label>First weight (t) *</label><input type="number" step="0.001" name="first_weight" required></div>
<div class="fld c2"><label>First is *</label><select name="first_is"><option value="tare">TARE (empty in)</option><option value="gross">GROSS (loaded in)</option></select></div>
<div class="fld c12"><label>Remarks</label><input type="text" name="remarks"></div>
</div>
<button class="btn btn-pri">Open ticket</button> <a class="btn btn-ghost" href="{{ route('weighbridge-tickets.index') }}">Cancel</a>
</form></div></div>
@endsection
