Add product info on broadband change requests

This commit is contained in:
Deon George 2021-10-08 12:18:39 +11:00
parent cc49692545
commit 17e7b47cdc
No known key found for this signature in database
GPG Key ID: 7670E8DC27415254
3 changed files with 62 additions and 3 deletions

View File

@ -183,6 +183,7 @@ class ServiceController extends Controller
$o->order_info->put('change_note',$request->notes);
$o->order_info->put('change_date',$request->change_date);
$o->order_info->put('change_product_id',$request->product_id);
$o->order_status = 'CHANGE-REQUEST';
$o->save();

View File

@ -43,9 +43,7 @@
</div>
</div>
{{--
@includeIf('u.service.widgets.'.$o->stype.'.order',['o'=>$o->type])
--}}
@includeIf('u.service.widgets.'.$o->stype.'.change',['o'=>$o->type])
<div class="form-group row">
<label for="notes" class="col-2 col-form-label text-right">Notes</label>
@ -63,6 +61,12 @@
</form>
</div>
</div>
<div class="col-6">
<div class="card">
<div id="product_info"></div>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,54 @@
<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 $item->type && (get_class($item->type) == 'App\Models\Product\Adsl'); })->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