<div class="form-group row">
	<label for="reference" class="col-sm-2 col-form-label text-right">Product</label>
	<div class="col-sm-6">
		<div class="input-group">
			<select class="form-control" id="product_id" name="product_id">
				<option value="">&nbsp;</option>
				@php
					$po = $selected = NULL;
				@endphp
				@foreach (\App\Models\Product::active()->get()->filter(function($item) { return get_class($item->type) === \App\Models\Product\Broadband::class; })->sortBy('name') as $o)
					@php
						if ($o->id == old('product_id')) {
							$selected = 'selected';
							$po = $o;
						} else {
							$selected = NULL;
						}
					@endphp
					<option value="{{ $o->id }}" {{ $selected }}>{{ $o->name }}</option>
				@endforeach
			</select>
		</div>
	</div>

	<div class="offset-2 col-10">
		<strong>NOTE</strong>: A plan setup fee is normally not applicable to Broadband changes, but a plan change fee normally is.
	</div>
</div>
@section('page-scripts')
	<script>
		$(document).ready(function() {
			$('select[name=product_id]').change(function() {
				// If we select a blank, then dont continue
				if (this.value == 0)
					return false;

				// Send the request and update sub category dropdown
				$.ajax({
					type: "GET",
					dataType: "html",
					cache: true,
					url: '{{ url('product_info') }}'+'/'+$(this).val(),
					timeout: 5000,
					error: function(x) {
						alert("Failed to submit");
					},
					success: function(data) {
						$("div[id=product_info]").empty().append(data);
					}
				});
			});
		});
	</script>
@append