2022-06-12 08:32:54 +00:00
|
|
|
@extends('adminlte::layouts.app')
|
|
|
|
|
|
|
|
@section('htmlheader_title')
|
|
|
|
Change Service #{{ $o->id }}
|
|
|
|
@endsection
|
2022-07-29 07:45:17 +00:00
|
|
|
@section('page_title')
|
|
|
|
{{ $o->sid }}
|
|
|
|
@endsection
|
2022-06-12 08:32:54 +00:00
|
|
|
|
|
|
|
@section('contentheader_title')
|
|
|
|
Change Service #{{ $o->id }} - WARNING - this is only for Broadband for now
|
|
|
|
@endsection
|
|
|
|
@section('contentheader_description')
|
|
|
|
{{ $o->sid }}
|
|
|
|
@endsection
|
|
|
|
|
2023-05-06 03:53:14 +00:00
|
|
|
<!-- $o = Service::class, $np = Product::class -->
|
2022-06-12 08:32:54 +00:00
|
|
|
@section('main-content')
|
|
|
|
<div class="row">
|
2023-05-05 12:05:42 +00:00
|
|
|
<div class="col-12 col-lg-4">
|
2022-06-12 08:32:54 +00:00
|
|
|
<form role="form" method="POST" enctype="multipart/form-data">
|
|
|
|
<div class="card card-dark">
|
|
|
|
{{ csrf_field() }}
|
|
|
|
|
|
|
|
<div class="card-header">
|
|
|
|
<h3 class="card-title">Service Information</h3>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="card-body">
|
|
|
|
<div class="row">
|
2022-07-25 13:24:45 +00:00
|
|
|
<div class="col-12">
|
2022-06-12 08:32:54 +00:00
|
|
|
<!-- SERVICE NUMBER -->
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="service_number" class="col-form-label text-right">Service Number</label>
|
|
|
|
|
|
|
|
<div class="input-group">
|
|
|
|
<div class="input-group-prepend">
|
|
|
|
<span class="input-group-text"><i class="fa fa-fw fa-phone"></i></span>
|
|
|
|
</div>
|
|
|
|
<input type="text" class="form-control" name="broadband[service_number]" value="{{ $o->name_short ?? '' }}" disabled>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="row">
|
2022-07-25 13:24:45 +00:00
|
|
|
<div class="col-12">
|
2022-06-12 08:32:54 +00:00
|
|
|
<!-- PRODUCT -->
|
|
|
|
<div class="form-group has-validation">
|
|
|
|
<label for="product_id">Type</label>
|
|
|
|
<div class="input-group">
|
|
|
|
<div class="input-group-prepend">
|
|
|
|
<span class="input-group-text"><i class="fas fa-fw fa-hashtag"></i></span>
|
|
|
|
</div>
|
|
|
|
<select class="form-control @error('broadband.product_id') is-invalid @enderror" id="product_id" name="broadband[product_id]" required>
|
|
|
|
<!-- @todo TO DO LIMIT THIS TO OF THE SAME OFFERING TYPE AND SORT BY NAME -->
|
|
|
|
@foreach (\App\Models\Product::get() as $po)
|
2023-05-03 08:09:29 +00:00
|
|
|
@if (! $po->category || ($po->category !== $o->product->category)) @continue @endif
|
2023-05-06 03:53:14 +00:00
|
|
|
<option value="{{ $po->id }}" {{ $po->id == old('broadband.product_id',$np->id) ? 'selected' : '' }}>{{ $po->name }}</option>
|
2022-06-12 08:32:54 +00:00
|
|
|
@endforeach
|
|
|
|
</select>
|
|
|
|
<span class="invalid-feedback" role="alert">
|
|
|
|
@error('broadband.product_id')
|
|
|
|
{{ $message }}
|
|
|
|
@else
|
|
|
|
Type is required.
|
|
|
|
@enderror
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<span class="input-helper">Product - {{ $o->product->category_name }}.</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="row">
|
2022-07-25 13:24:45 +00:00
|
|
|
<div class="col-12">
|
2022-06-12 08:32:54 +00:00
|
|
|
<!-- CHANGE DATE -->
|
|
|
|
<div class="form-group has-validation">
|
|
|
|
<label for="start_at" class="col-form-label text-right">Change Date</label>
|
|
|
|
<div class="input-group">
|
|
|
|
<div class="input-group-prepend">
|
|
|
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
|
|
|
</div>
|
2023-05-06 03:53:14 +00:00
|
|
|
<input type="date" class="form-control @error('broadband.start_at') is-invalid @enderror" id="start_at" name="broadband[start_at]" value="{{ $np->pivot->effective_at ?? $np->pivot->ordered_at }}" required>
|
2022-06-12 08:32:54 +00:00
|
|
|
<span class="invalid-feedback" role="alert">
|
|
|
|
@error('broadband.start_at')
|
|
|
|
{{ $message }}
|
|
|
|
@else
|
|
|
|
Type is required.
|
|
|
|
@enderror
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="row">
|
2022-07-25 13:24:45 +00:00
|
|
|
<div class="col-6">
|
2022-06-12 08:32:54 +00:00
|
|
|
<!-- CHANGE FEE -->
|
|
|
|
<div class="form-group has-validation">
|
|
|
|
<label for="change_fee" class="col-form-label text-right">Change Fee</label>
|
|
|
|
<div class="input-group">
|
|
|
|
<div class="input-group-prepend">
|
|
|
|
<span class="input-group-text"><i class="fa fa-fw fa-dollar-sign"></i></span>
|
|
|
|
</div>
|
|
|
|
<input type="text" class="form-control @error('broadband.change_fee') is-invalid @enderror" id="change_fee" name="broadband[change_fee]" value="0">
|
|
|
|
<span class="invalid-feedback" role="alert">
|
|
|
|
@error('broadband.change_fee')
|
|
|
|
{{ $message }}
|
|
|
|
@enderror
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-05-03 08:09:29 +00:00
|
|
|
|
|
|
|
<div class="col-6">
|
|
|
|
<!-- NEW PRICE -->
|
|
|
|
<div class="form-group has-validation">
|
|
|
|
<label for="price" class="col-form-label text-right">New Price <small>(Override)</small></label>
|
|
|
|
<div class="input-group">
|
|
|
|
<div class="input-group-prepend">
|
|
|
|
<span class="input-group-text"><i class="fa fa-fw fa-dollar-sign"></i></span>
|
|
|
|
</div>
|
2023-05-09 01:09:00 +00:00
|
|
|
<input type="text" class="form-control @error('broadband.price') is-invalid @enderror" id="price" name="broadband[price]" value="{{ $o->price }}">
|
2023-05-03 08:09:29 +00:00
|
|
|
<span class="invalid-feedback" role="alert">
|
|
|
|
@error('broadband.price')
|
|
|
|
{{ $message }}
|
|
|
|
@enderror
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-06-12 08:32:54 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-12">
|
2022-07-29 07:45:17 +00:00
|
|
|
<a href="{{ url('u/service',[$o->id]) }}" class="btn btn-danger">Cancel</a>
|
2022-06-12 08:32:54 +00:00
|
|
|
@can('wholesaler')
|
|
|
|
<button type="submit" name="submit" class="btn btn-success mr-0 float-right">@if ($site->exists)Save @else Add @endif</button>
|
|
|
|
@endcan
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
2023-05-03 08:09:29 +00:00
|
|
|
|
|
|
|
<!-- Current Plan -->
|
2023-05-05 12:05:42 +00:00
|
|
|
<div class="col-12 col-lg-8">
|
2023-05-03 08:09:29 +00:00
|
|
|
<div class="card card-dark">
|
2023-05-05 12:05:42 +00:00
|
|
|
<div class="card-header">
|
|
|
|
<h3 class="card-title">Plan Information</h3>
|
2023-05-03 08:09:29 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="card-body">
|
2023-05-06 03:53:14 +00:00
|
|
|
@include('service.widget.internal',['o'=>$o,'p'=>$np])
|
2023-05-03 08:09:29 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-06-12 08:32:54 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="transactions"></div>
|
|
|
|
@endsection
|
|
|
|
|
|
|
|
@section('page-scripts')
|
|
|
|
@css(select2)
|
|
|
|
@js(select2,autofocus)
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
function pendingtrans() {
|
|
|
|
var pid = $('#product_id').val();
|
|
|
|
var start = $('#start_at').val();
|
|
|
|
var fee = $('#change_fee').val();
|
2023-05-06 03:53:14 +00:00
|
|
|
var price = $('#price').val();
|
2022-06-12 08:32:54 +00:00
|
|
|
|
|
|
|
$("div[id=transactions]").empty();
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
type: 'POST',
|
|
|
|
dataType: 'html',
|
2023-05-06 03:53:14 +00:00
|
|
|
data: {broadband: {product_id: pid,start_at: start,change_fee: fee,price: price}},
|
2022-06-12 08:32:54 +00:00
|
|
|
cache: false,
|
|
|
|
url: '{{ url('r/service_change_charges',[$o->id]) }}',
|
|
|
|
timeout: 2000,
|
|
|
|
error: function(x) {
|
|
|
|
spinner.toggleClass('d-none').toggleClass('fa-spin');
|
|
|
|
alert('Failed to submit');
|
|
|
|
},
|
|
|
|
success: function(data) {
|
|
|
|
$("div[id=transactions]").append(data);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
$('#product_id')
|
|
|
|
.select2()
|
|
|
|
.on('change',function() {
|
|
|
|
pendingtrans();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#start_at').on('change',function() {
|
|
|
|
pendingtrans();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#change_fee').on('change',function() {
|
|
|
|
pendingtrans();
|
|
|
|
});
|
|
|
|
|
2023-05-06 03:53:14 +00:00
|
|
|
$('#price').on('change',function() {
|
|
|
|
pendingtrans();
|
|
|
|
});
|
|
|
|
|
2022-06-12 08:32:54 +00:00
|
|
|
pendingtrans();
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
@append
|