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\Exceptions\{DoormanException,ExpiredInviteCode};
use Clarkeash\Doorman\Facades\Doorman; use Clarkeash\Doorman\Facades\Doorman;
use Illuminate\Contracts\View\Factory;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\View\View; use Illuminate\View\View;
@ -24,7 +23,8 @@ class HomeController extends Controller
/** /**
* Logged in users home page * Logged in users home page
* *
* @return Factory|View * @param User $o
* @return View
*/ */
public function home(User $o): View public function home(User $o): View
{ {
@ -33,7 +33,7 @@ class HomeController extends Controller
$o->load(['services.invoice_items','services.type']); $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 $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 * 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 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); ->with('o',$o);
} }
@ -117,7 +118,7 @@ class ServiceController extends Controller
return redirect('u/service/'.$o->id)->with('success','Cancellation lodged'); return redirect('u/service/'.$o->id)->with('success','Cancellation lodged');
} }
return view('u.service.cancel_request') return view('service.cancel_request')
->with('o',$o); ->with('o',$o);
} }
@ -220,7 +221,8 @@ class ServiceController extends Controller
switch (get_class($o->type)) { switch (get_class($o->type)) {
default: default:
return view('u.service.change_request') return view('service.change_request')
->with('breadcrumb',collect()->merge($o->account->breadcrumb))
->with('o',$o); ->with('o',$o);
} }
} }
@ -275,7 +277,7 @@ class ServiceController extends Controller
->with(['service.account','registrar']) ->with(['service.account','registrar'])
->get(); ->get();
return view('r.service.domain.list') return view('service.domain.list')
->with('o',$o); ->with('o',$o);
} }
@ -289,7 +291,20 @@ class ServiceController extends Controller
->with(['service.account','service.product.type.supplied.supplier_detail.supplier','tld']) ->with(['service.account','service.product.type.supplied.supplier_detail.supplier','tld'])
->get(); ->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); ->with('o',$o);
} }
@ -303,7 +318,7 @@ class ServiceController extends Controller
->with(['service.account','service.product.type.supplied.supplier_detail.supplier','tld']) ->with(['service.account','service.product.type.supplied.supplier_detail.supplier','tld'])
->get(); ->get();
return view('r.service.host.list') return view('service.host.list')
->with('o',$o); ->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 * Return the account name
* *

View File

@ -1,5 +1,5 @@
body { body {
font-size: 0.85em; font-size: 0.75em;
} }
/* Fixes for data tables */ /* 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="active tab-pane" id="tab-services">
<div class="row"> <div class="row">
<div class="col-12 col-xl-7"> <div class="col-12 col-xl-7">
@include('u.service.widgets.active') @include('service.widget.active')
</div> </div>
<div class="col-12 col-xl-5"> <div class="col-12 col-xl-5">

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -38,7 +38,7 @@
</div> </div>
</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"> <div class="form-group row">
<label for="notes" class="col-sm-2 col-form-label text-right">Notes</label> <label for="notes" class="col-sm-2 col-form-label text-right">Notes</label>

View File

@ -38,7 +38,7 @@
</div> </div>
</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"> <div class="form-group row">
<label for="notes" class="col-sm-2 col-form-label text-right">Notes</label> <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]) }}"> <form class="g-0 needs-validation" method="POST" action="{{ url('a/service/edit',[$o->id]) }}">
@csrf @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="row">
<div class="col-12"> <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']) Route::get('invoice/cart/{o}',[CheckoutController::class,'cart_invoice'])
->where('o','[0-9]+') ->where('o','[0-9]+')
->middleware('can:view,o'); ->middleware('can:view,o');
Route::get('service/{o}',[HomeController::class,'service']) Route::get('service/{o}',[ServiceController::class,'home'])
->where('o','[0-9]+') ->where('o','[0-9]+')
->middleware('can:view,o'); ->middleware('can:view,o');
Route::match(['get','post'],'service/{o}/cancel-request',[ServiceController::class,'cancel_request']) Route::match(['get','post'],'service/{o}/cancel-request',[ServiceController::class,'cancel_request'])