<!-- $o=Product::class -->
@use(App\Models\Product)
<div class="card card-dark">
	<div class="card-header">
		<h1 class="card-title">Product Configuration</h1>
	</div>

	<div class="card-body">
		<form method="POST">
			@csrf

			<div class="row">
				<div class="col-12 col-sm-9 col-md-6 col-xl-5">
					<x-leenooks::form.select name="product_id" icon="fa-list" label="Product" choose="true" groupby="active" :value="$pdo?->id ?? ''" :options="Product::get()->sortBy(fn($item)=>($item->active ? '0' : '1').$item->name)->map(fn($item)=>['id'=>$item->id,'value'=>$item->name,'active'=>$item->active])"/>
				</div>
			</div>
		</form>
	</div>
</div>

@section('page-scripts')
	<script type="text/javascript">
		$(document).ready(function() {
			$('#product_id').on('change',function(item) {
				window.location.href = '{{ url('a/product') }}/'+item.target.value;
			});
		});
	</script>
@append