Consolidate service resources into a top level services/ directory

This commit is contained in:
Deon George 2022-07-29 17:45:17 +10:00
parent 7f6df8d032
commit 97f5c84f23
36 changed files with 66 additions and 64 deletions

View File

@ -4,7 +4,6 @@ namespace App\Http\Controllers;
use Clarkeash\Doorman\Exceptions\{DoormanException,ExpiredInviteCode};
use Clarkeash\Doorman\Facades\Doorman;
use Illuminate\Contracts\View\Factory;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Illuminate\View\View;
@ -24,7 +23,8 @@ class HomeController extends Controller
/**
* Logged in users home page
*
* @return Factory|View
* @param User $o
* @return View
*/
public function home(User $o): View
{
@ -33,7 +33,7 @@ class HomeController extends Controller
$o->load(['services.invoice_items','services.type']);
return View('u.home',['o'=>$o]);
return View('home',['o'=>$o]);
}
/**
@ -62,22 +62,6 @@ class HomeController extends Controller
return $this->invoice($o);
}
/**
* Return details on the users service
*
* @param Service $o
* @return View
*/
public function service(Service $o): View
{
$breadcrumb = collect();
$breadcrumb->put($o->account->user->full_name,url('u/home',$o->account->user_id));
return View('u.service.home')
->with('breadcrumb',$breadcrumb)
->with('o',$o);
}
/**
* Progress the order to the next stage
*

View File

@ -84,7 +84,8 @@ class ServiceController extends Controller
return redirect()->to(url('u/service',[$o->id]));
}
return view('a.service.change_pending')
return view('service.change_pending')
->with('breadcrumb',collect()->merge($o->account->breadcrumb))
->with('o',$o);
}
@ -117,7 +118,7 @@ class ServiceController extends Controller
return redirect('u/service/'.$o->id)->with('success','Cancellation lodged');
}
return view('u.service.cancel_request')
return view('service.cancel_request')
->with('o',$o);
}
@ -220,7 +221,8 @@ class ServiceController extends Controller
switch (get_class($o->type)) {
default:
return view('u.service.change_request')
return view('service.change_request')
->with('breadcrumb',collect()->merge($o->account->breadcrumb))
->with('o',$o);
}
}
@ -275,7 +277,7 @@ class ServiceController extends Controller
->with(['service.account','registrar'])
->get();
return view('r.service.domain.list')
return view('service.domain.list')
->with('o',$o);
}
@ -289,7 +291,20 @@ class ServiceController extends Controller
->with(['service.account','service.product.type.supplied.supplier_detail.supplier','tld'])
->get();
return view('r.service.email.list')
return view('service.email.list')
->with('o',$o);
}
/**
* Return details on the users service
*
* @param Service $o
* @return View
*/
public function home(Service $o): View
{
return View('service.home')
->with('breadcrumb',collect()->merge($o->account->breadcrumb))
->with('o',$o);
}
@ -303,7 +318,7 @@ class ServiceController extends Controller
->with(['service.account','service.product.type.supplied.supplier_detail.supplier','tld'])
->get();
return view('r.service.host.list')
return view('service.host.list')
->with('o',$o);
}

View File

@ -139,6 +139,16 @@ class Account extends Model implements IDs
];
}
/**
* Account breadcrumb to render on pages
*
* @return array
*/
public function getBreadcrumbAttribute(): array
{
return [$this->name => url('u/home',$this->user_id)];
}
/**
* Return the account name
*

View File

@ -1,5 +1,5 @@
body {
font-size: 0.85em;
font-size: 0.75em;
}
/* Fixes for data tables */

View File

@ -1,12 +0,0 @@
<!-- Errors -->
<div class="col-12">
<div class="alert alert-danger alert-dismissible mb-0">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<h5><i class="icon fa fa-ban"></i> Whoops!</h5>
<ul>
@foreach ($errors->all() as $error)
<li>{!! $error !!}</li>
@endforeach
</ul>
</div>
</div>

View File

@ -44,7 +44,7 @@
<div class="active tab-pane" id="tab-services">
<div class="row">
<div class="col-12 col-xl-7">
@include('u.service.widgets.active')
@include('service.widget.active')
</div>
<div class="col-12 col-xl-5">

View File

@ -3,7 +3,7 @@
@include('r.account.widgets.list')
</div>
<div class="col-8">
@include('r.service.widgets.movement')
@include('service.widget.movement')
@include('r.invoice.widgets.due')
</div>

View File

@ -15,6 +15,12 @@
@endsection
@section('main-content')
<div class="row">
<div class="col-12">
@include('adminlte::widget.status')
</div>
</div>
<div class="row">
<div class="col-6">
<div class="card">
@ -22,11 +28,6 @@
<div class="card-title">Cancelling Service</div>
</div>
<!-- Errors -->
@if ($errors->any())
@include('common.service.widget.error')
@endif
<form class="form-horizontal" method="POST">
{{ csrf_field() }}
@ -44,7 +45,7 @@
</div>
{{--
@includeIf('u.service.widgets.'.$o->product->category.'.order',['o'=>$o->type])
@includeIf('service.widget.'.$o->product->category.'.order',['o'=>$o->type])
--}}
<div class="form-group row">

View File

@ -3,6 +3,9 @@
@section('htmlheader_title')
Change Service #{{ $o->id }}
@endsection
@section('page_title')
{{ $o->sid }}
@endsection
@section('contentheader_title')
Change Service #{{ $o->id }} - WARNING - this is only for Broadband for now
@ -113,7 +116,7 @@
<div class="row">
<div class="col-12">
<a href="{{ url('/home') }}" class="btn btn-danger">Cancel</a>
<a href="{{ url('u/service',[$o->id]) }}" class="btn btn-danger">Cancel</a>
@can('wholesaler')
<button type="submit" name="submit" class="btn btn-success mr-0 float-right">@if ($site->exists)Save @else Add @endif</button>
@endcan
@ -124,7 +127,7 @@
</form>
</div>
<div class="col-4">
@include('a.service.widgets.internal')
@include('service.widget.internal')
</div>
</div>
<div id="transactions"></div>

View File

@ -15,6 +15,12 @@
@endsection
@section('main-content')
<div class="row">
<div class="col-12">
@include('adminlte::widget.status')
</div>
</div>
<div class="row">
<div class="col-6">
<div class="card">
@ -22,11 +28,6 @@
<div class="card-title">Change Service</div>
</div>
<!-- Errors -->
@if ($errors->any())
@include('common.service.widget.error')
@endif
<form class="form-horizontal" method="POST">
{{ csrf_field() }}
@ -43,7 +44,7 @@
</div>
</div>
@includeIf('u.service.widgets.'.$o->product->category.'.change',['o'=>$o->type])
@includeIf('service.widget.'.$o->product->category.'.change',['o'=>$o->type])
<div class="form-group row">
<label for="notes" class="col-2 col-form-label text-right">Notes</label>

View File

@ -19,8 +19,8 @@
<!-- Service Details -->
<div class="col-5">
@includeIf('u.service.widgets.'.$o->product->category.'.details',['o'=>$o->type])
@include('u.service.widgets.information')
@includeIf('service.widget.'.$o->product->category.'.details',['o'=>$o->type])
@include('service.widget.information')
</div>
<div class="col-7">
@ -72,13 +72,13 @@
</div>
@if (! $o->suspend_billing AND ! $o->external_billing)
<div class="tab-pane fade {{ (! session()->has('service_update')) ? 'active show' : '' }}" id="pending_items" role="tabpanel">
@include('common.service.widget.invoice')
@include('service.widget.invoice')
</div>
@endif
@if ($o->hasUsage())
<div class="tab-pane fade {{ (! $o->isBilled() && (! session()->has('service_update'))) ? 'active show' : '' }}" id="traffic" role="tabpanel">
@if ($o->type->usage(30)->count())
@include('u.service.widgets.'.$o->product->category.'.usagegraph',['o'=>$o->type])
@include('service.widget.'.$o->product->category.'.usagegraph',['o'=>$o->type])
@endif
</div>
@endif
@ -90,11 +90,11 @@
</div>
@can('wholesaler')
<div class="tab-pane fade" id="internal" role="tabpanel">
@include('a.service.widgets.internal')
@include('service.widget.internal')
</div>
<div class="tab-pane fade {{ session()->has('service_update') ? 'active show' : '' }}" id="update" role="tabpanel">
@include('a.service.widgets.update')
@include('service.widget.update')
</div>
@endcan
</div>

View File

@ -38,7 +38,7 @@
</div>
</div>
@includeIf('u.service.widgets.'.$o->product->category.'.order',['o'=>$o->type])
@includeIf('service.widget.'.$o->product->category.'.order',['o'=>$o->type])
<div class="form-group row">
<label for="notes" class="col-sm-2 col-form-label text-right">Notes</label>

View File

@ -38,7 +38,7 @@
</div>
</div>
@includeIf('u.service.widgets.'.$o->product->category.'.order',['o'=>$o->type])
@includeIf('service.widget.'.$o->product->category.'.order',['o'=>$o->type])
<div class="form-group row">
<label for="notes" class="col-sm-2 col-form-label text-right">Notes</label>

View File

@ -5,7 +5,7 @@
<form class="g-0 needs-validation" method="POST" action="{{ url('a/service/edit',[$o->id]) }}">
@csrf
@includeIf('a.service.widgets.'.$o->product->category.'.update',['o'=>$o->type])
@includeIf('service.widget.'.$o->product->category.'.update',['o'=>$o->type])
<div class="row">
<div class="col-12">

View File

@ -158,7 +158,7 @@ Route::group(['middleware'=>['theme:adminlte-be','auth'],'prefix'=>'u'],function
Route::get('invoice/cart/{o}',[CheckoutController::class,'cart_invoice'])
->where('o','[0-9]+')
->middleware('can:view,o');
Route::get('service/{o}',[HomeController::class,'service'])
Route::get('service/{o}',[ServiceController::class,'home'])
->where('o','[0-9]+')
->middleware('can:view,o');
Route::match(['get','post'],'service/{o}/cancel-request',[ServiceController::class,'cancel_request'])