Initial invoice rendering

This commit is contained in:
Deon George 2018-08-01 17:09:38 +10:00
parent 1cde2a888a
commit c444e1d218
No known key found for this signature in database
GPG Key ID: 7670E8DC27415254
16 changed files with 500 additions and 28 deletions

View File

@ -3,7 +3,7 @@ APP_NAME_HTML_LONG="<b>Laravel</b>Application"
APP_NAME_HTML_SHORT="<b>L</b>A" APP_NAME_HTML_SHORT="<b>L</b>A"
APP_ENV=local APP_ENV=local
APP_KEY= APP_KEY=
APP_DEBUG=true APP_DEBUG=false
APP_URL=http://localhost APP_URL=http://localhost
LOG_CHANNEL=stack LOG_CHANNEL=stack

View File

@ -3,6 +3,8 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use App\Models\Invoice;
use App\User;
class UserHomeController extends Controller class UserHomeController extends Controller
{ {
@ -11,6 +13,11 @@ class UserHomeController extends Controller
$this->middleware('auth'); $this->middleware('auth');
} }
public function invoice(Invoice $o)
{
return View('invoice',['o'=>$o]);
}
public function home() public function home()
{ {
switch (Auth::user()->role()) { switch (Auth::user()->role()) {
@ -41,4 +48,10 @@ class UserHomeController extends Controller
{ {
abort(307,sprintf('http://www.graytech.net.au/u/%s/%s/%s',$type,$action,$id)); abort(307,sprintf('http://www.graytech.net.au/u/%s/%s/%s',$type,$action,$id));
} }
public function User(User $o)
{
// @todo Check authorised to see this account.
return View('userhome',['o'=>$o]);
}
} }

View File

@ -4,10 +4,10 @@ namespace App\Http\Middleware;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Closure; use Closure;
use App\Models\{Site};
use Config; use Config;
use View; use View;
use Theme;
use App\Models\Site;
/** /**
* Class SetSite * Class SetSite
@ -40,8 +40,6 @@ class SetSite
$so = (new Site)->sample(); $so = (new Site)->sample();
} }
Theme::set($so->theme);
// Set who we are in SETUP. // Set who we are in SETUP.
Config::set('SITE_SETUP',$so); Config::set('SITE_SETUP',$so);
View::share('so',$so); View::share('so',$so);

View File

@ -36,13 +36,52 @@ class Account extends Model
return $this->belongsTo(\App\User::class); return $this->belongsTo(\App\User::class);
} }
public function getActiveDisplayAttribute($value)
{
return sprintf('<span class="btn-sm btn-block btn-%s text-center">%s</span>',$this->active ? 'primary' : 'danger',$this->active ? 'Active' : 'Inactive');
}
public function getCompanyAttribute($value) public function getCompanyAttribute($value)
{ {
return $value ? $value : $this->user->SurFirstName; return $value ? $value : $this->user->SurFirstName;
} }
public function getActiveDisplayAttribute($value) public function getAccountIdAttribute()
{ {
return sprintf('<span class="btn-sm btn-block btn-%s text-center">%s</span>',$this->active ? 'primary' : 'danger',$this->active ? 'Active' : 'Inactive'); return sprintf('%02s-%04s',$this->site_id,$this->id);
}
public function getAccountIdUrlAttribute()
{
return sprintf('<a href="/r/account/view/%s">%s</a>',$this->id,$this->account_id);
}
private function _address()
{
$return = [];
if ($this->address1)
array_push($return,$this->address1);
if ($this->address2)
array_push($return,$this->address2);
if ($this->city)
array_push($return,sprintf('%s %s %s',$this->city.(($this->state OR $this->zip) ? ',' : ''),$this->state,$this->zip));
if (! $return)
$return = ['No Address'];
return $return;
}
public function address($type='plain')
{
switch ($type)
{
case 'html' : return join('<br>',$this->_address());
case 'newline': return join("\m",$this->_address());
default:
return join("\n",$this->_address());
}
} }
} }

15
app/Models/Charge.php Normal file
View File

@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Charge extends Model
{
protected $table = 'ab_charge';
public function getNameAttribute()
{
return sprintf('%s %s',$this->description,join('|',unserialize($this->getAttribute('attributes'))));
}
}

View File

@ -7,8 +7,8 @@ use Illuminate\Database\Eloquent\Model;
class Invoice extends Model class Invoice extends Model
{ {
protected $table = 'ab_invoice'; protected $table = 'ab_invoice';
protected $dates = ['due_date']; protected $dates = ['date_orig','due_date'];
protected $with = ['items.taxes','account.country.currency','paymentitems']; protected $with = ['items.taxes','items.product','items.service','account.country.currency','paymentitems'];
protected $appends = [ protected $appends = [
'date_due', 'date_due',
@ -26,6 +26,7 @@ class Invoice extends Model
]; ];
private $_total = 0; private $_total = 0;
private $_total_tax = 0;
public function account() public function account()
{ {
@ -52,14 +53,29 @@ class Invoice extends Model
return $this->due_date->format('Y-m-d'); return $this->due_date->format('Y-m-d');
} }
public function getInvoiceDateAttribute()
{
return $this->date_orig->format('Y-m-d');
}
public function getInvoiceIdAttribute() public function getInvoiceIdAttribute()
{ {
return sprintf('%02s-%04s-%04s',$this->site_id,$this->account_id,$this->id); return sprintf('%06s',$this->id);
}
public function getInvoiceAccountIdAttribute()
{
return sprintf('%02s-%04s-%06s',$this->site_id,$this->account_id,$this->invoice_id);
} }
public function getInvoiceIdUrlAttribute() public function getInvoiceIdUrlAttribute()
{ {
return sprintf('<a href="/u/invoice/view/%s">%s</a>',$this->id,$this->invoice_id); return sprintf('<a href="/u/invoice/%s">%s</a>',$this->id,$this->invoice_account_id);
}
public function getInvoiceTextAttribute()
{
return sprintf('Thank you for using %s for your Internet Services.',config('SITE_SETUP')->site_name);
} }
public function getPaidAttribute() public function getPaidAttribute()
@ -67,6 +83,25 @@ class Invoice extends Model
return $this->currency()->round($this->paymentitems->sum('alloc_amt')); return $this->currency()->round($this->paymentitems->sum('alloc_amt'));
} }
public function getSubTotalAttribute()
{
return sprintf('%3.'.$this->currency()->rounding.'f',$this->total-$this->tax_total);
}
public function getTaxTotalAttribute()
{
if (! $this->_total_tax)
{
foreach ($this->items as $o)
{
if ($o->active)
$this->_total_tax += $this->currency()->round($o->tax);
}
}
return sprintf('%3.'.$this->currency()->rounding.'f',$this->_total_tax);
}
public function getTotalAttribute() public function getTotalAttribute()
{ {
if (! $this->_total) if (! $this->_total)
@ -85,4 +120,44 @@ class Invoice extends Model
{ {
return $this->account->country->currency; return $this->account->country->currency;
} }
public function products()
{
$return = collect();
foreach ($this->items->groupBy('product_id') as $o)
{
$po = $o->first()->product;
$po->count = count($o->pluck('service_id')->unique());
$return->push($po);
}
$lo = $this->account->user->language;
return $return->sortBy(function ($item) use ($lo) {
return $item->name($lo);
});
}
public function product_services(Product $po)
{
$return = collect();
foreach ($this->items->filter(function ($item) use ($po) {
return $item->product_id == $po->id;
}) as $o)
{
$so = $o->service;
$return->push($so);
};
return $return->unique()->sortBy('name');
}
public function product_service_items(Product $po,Service $so)
{
return $this->items->filter(function ($item) use ($po,$so) {
return $item->product_id == $po->id AND $item->service_id == $so->id;
})->filter()->sortBy('item_type');
}
} }

View File

@ -6,21 +6,80 @@ use Illuminate\Database\Eloquent\Model;
class InvoiceItem extends Model class InvoiceItem extends Model
{ {
protected $dates = ['date_start','date_stop'];
protected $table = 'ab_invoice_item'; protected $table = 'ab_invoice_item';
protected $with = ['taxes']; protected $with = ['taxes'];
private $_tax = 0; private $_tax = 0;
public function product()
{
return $this->belongsTo(Product::class);
}
public function invoice() public function invoice()
{ {
return $this->belongsTo(Invoice::class); return $this->belongsTo(Invoice::class);
} }
public function service()
{
return $this->belongsTo(Service::class);
}
public function taxes() public function taxes()
{ {
return $this->hasMany(InvoiceItemTax::class); return $this->hasMany(InvoiceItemTax::class);
} }
public function getItemTypeNameAttribute()
{
$types = [
1=>'Hardware', // *
2=>'Service Relocation Fee', // * Must have corresponding SERVICE_ID
3=>'Service Change', // * Must have corresponding SERVICE_ID
4=>'Service Connection', // * Must have corresponding SERVICE_ID
6=>'Service Cancellation', // * Must have corresponding SERVICE_ID
7=>'Extra Product/Service Charge', // * Service Billing in advance, Must have corresponding SERVICE_ID
8=>'Product Addition', // * Additional Product Customisation, Must have corresponding SERVICE_ID
120=>'Credit/Debit Transfer', // * SERVICE_ID is NULL, MODULE_ID is NULL, MODULE_REF is NULL : INVOICE_ID is NOT NULL
123=>'Shipping',
124=>'Late Payment Fee', // * SERVICE_ID is NULL, MODULE_ID = CHECKOUT MODULE,
125=>'Payment Fee', // * SERVICE_ID is NULL, MODULE_ID = CHECKOUT MODULE, MODULE_REF = CHECKOUT NAME
126=>'Other', // * MODEL_ID should be a module
127=>'Rounding', // * SERVICE_ID is NULL, MODULE_ID is NULL, MODULE_REF is NULL
];
switch ($this->item_type)
{
// * Line Charge Topic on Invoice.
case 0:
return sprintf('%s [%s]','Product/Service',
$this->date_start == $this->date_stop ? $this->date_start->format('Y-m-d') : sprintf('%s -> %s',$this->date_start->format('Y-m-d'),$this->date_stop->format('Y-m-d')));
// * Excess Service Item, of item 0, must have corresponding SERVICE_ID
case 5:
return sprintf('%s [%s] (%s)','Excess Usage',
$this->date_start == $this->date_stop ? $this->date_start->format('Y-m-d') : sprintf('%s -> %s',$this->date_start->format('Y-m-d'),$this->date_stop->format('Y-m-d')),
$this->module_text()
);
default:
return array_get($types,$this->item_type,'Unknown');
}
}
public function module_text()
{
switch ($this->module_id)
{
// Charges Module
case 30: return Charge::findOrFail($this->module_ref)->name;
default: abort(500,'Unable to handle '.$this->module_id);
}
}
public function getSubTotalAttribute() public function getSubTotalAttribute()
{ {
return $this->quantity * $this->price_base; return $this->quantity * $this->price_base;

View File

@ -19,10 +19,16 @@ class Product extends Model
return $this->hasMany(Service::class); return $this->hasMany(Service::class);
} }
public function getProductIdAttribute()
{
return sprintf('#%04s',$this->id);
}
/** /**
* Get the language name * Get the language name
* *
* @param Language $lo * @param Language $lo
* @return string Product Name
*/ */
public function name(Language $lo) public function name(Language $lo)
{ {

View File

@ -12,11 +12,11 @@ class Service extends Model
protected $appends = [ protected $appends = [
'category', 'category',
'name',
'next_invoice', 'next_invoice',
'product_name', 'product_name',
'service_id', 'service_id',
'service_id_url', 'service_id_url',
'service_name',
'status', 'status',
]; ];
protected $visible = [ protected $visible = [
@ -24,11 +24,11 @@ class Service extends Model
'category', 'category',
'data_orig', 'data_orig',
'id', 'id',
'name',
'next_invoice', 'next_invoice',
'product_name', 'product_name',
'service_id', 'service_id',
'service_id_url', 'service_id_url',
'service_name',
'status', 'status',
]; ];
@ -80,6 +80,14 @@ class Service extends Model
return $this->product->prod_plugin_file; return $this->product->prod_plugin_file;
} }
public function getNameAttribute()
{
if (! isset($this->getServiceDetail()->name))
return 'Unknown';
return $this->getServiceDetail()->name;
}
public function getNextInvoiceAttribute() public function getNextInvoiceAttribute()
{ {
return $this->date_next_invoice ? $this->date_next_invoice->format('Y-m-d') : NULL; return $this->date_next_invoice ? $this->date_next_invoice->format('Y-m-d') : NULL;
@ -127,14 +135,6 @@ class Service extends Model
return sprintf('<a href="/u/service/view/%s">%s</a>',$this->id,$this->service_id); return sprintf('<a href="/u/service/view/%s">%s</a>',$this->id,$this->service_id);
} }
public function getServiceNameAttribute()
{
if (! isset($this->getServiceDetail()->name))
return 'Unknown';
return $this->getServiceDetail()->name;
}
public function getServiceNumberAttribute() public function getServiceNumberAttribute()
{ {
return sprintf('%02s.%04s.%04s',$this->site_id,$this->account_id,$this->id); return sprintf('%02s.%04s.%04s',$this->site_id,$this->account_id,$this->id);

View File

@ -21,6 +21,11 @@ class Site extends Model
return $this->hasMany(SiteDetails::class); return $this->hasMany(SiteDetails::class);
} }
public function language()
{
return $this->belongsTo(Language::class);
}
public function __get($key) public function __get($key)
{ {
// @todo Not sure if this is functioning correctly? // @todo Not sure if this is functioning correctly?

View File

@ -58,6 +58,11 @@ class User extends Authenticatable
return $this->hasMany(static::class,'parent_id','id')->with('clients'); return $this->hasMany(static::class,'parent_id','id')->with('clients');
} }
public function language()
{
return $this->belongsTo(Models\Language::class);
}
public function invoices() public function invoices()
{ {
return $this->hasManyThrough(Models\Invoice::class,Models\Account::class); return $this->hasManyThrough(Models\Invoice::class,Models\Account::class);
@ -120,6 +125,13 @@ class User extends Authenticatable
->filter(); ->filter();
} }
public function getLanguageAttribute($value)
{
if (is_null($this->language_id))
return config('SITE_SETUP')->language;
dd(__METHOD__,$value,config('SITE_SETUP')->language);
}
public function getPaymentHistoryAttribute() public function getPaymentHistoryAttribute()
{ {
return $this->payments return $this->payments
@ -152,6 +164,11 @@ class User extends Authenticatable
return sprintf('<a href="/u/account/view/%s">%s</a>',$this->id,$this->user_id); return sprintf('<a href="/u/account/view/%s">%s</a>',$this->id,$this->user_id);
} }
public function isAdmin($id)
{
return $id AND in_array($this->role(),['wholesaler','reseller']) AND in_array($id,$this->all_accounts()->pluck('id')->toArray());
}
public function scopeActive() public function scopeActive()
{ {
return $this->where('active',TRUE); return $this->where('active',TRUE);

6
composer.lock generated
View File

@ -2369,11 +2369,11 @@
}, },
{ {
"name": "leenooks/laravel", "name": "leenooks/laravel",
"version": "0.1.9", "version": "0.1.10",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://dev.leenooks.net/leenooks/laravel", "url": "https://dev.leenooks.net/leenooks/laravel",
"reference": "444c159ab911819e818a7f8a1f0aaf59dfdd58d1" "reference": "0bd32aab4a53a7f74d76a77165f973026ce90444"
}, },
"require": { "require": {
"igaster/laravel-theme": "2.0.6", "igaster/laravel-theme": "2.0.6",
@ -2409,7 +2409,7 @@
"laravel", "laravel",
"leenooks" "leenooks"
], ],
"time": "2018-07-31T02:56:29+00:00" "time": "2018-08-01T06:28:10+00:00"
}, },
{ {
"name": "maximebf/debugbar", "name": "maximebf/debugbar",

View File

@ -67,7 +67,7 @@ return [
| |
*/ */
'timezone' => 'UTC', 'timezone' => 'Australia/Melbourne',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@ -0,0 +1,243 @@
@extends('adminlte::layouts.app')
@section('htmlheader_title')
Invoice #{{ $o->id }}
@endsection
@section('contentheader_title')
Invoice #
@endsection
@section('contentheader_description')
{{ $o->invoice_id }}
@endsection
@section('main-content')
<!-- Main content -->
<section class="invoice">
<!-- title row -->
<div class="row">
<div class="col-xs-12">
<h2 class="page-header">
<i class="fa fa-globe"></i> {{ $so->site_name }}
<small class="pull-right">Date: {{ $o->invoice_date}}</small>
</h2>
</div>
<!-- /.col -->
</div>
<!-- info row -->
<div class="row invoice-info">
<div class="col-sm-3 invoice-col">
<table class="table-condensed">
<tr>
<th>FROM:</th>
<td><strong>{{ $so->site_name }}</strong></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>{!! $so->address('html') !!}</td>
</tr>
<tr>
<th>Phone</th>
<td>{{ $so->site_phone }}</td>
</tr>
<tr>
<th>Email</th>
<td>{{ $so->site_email }}</td>
</tr>
</table>
</div>
<div class="col-md-offset-1 col-sm-3 invoice-col">
<table class="table table-condensed">
<tr>
<th>TO:</th>
<td><strong>{{ $o->account->company }}</strong></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>{!! $o->account->address('html') !!}</td>
</tr>
<tr>
@if ($o->account->phone)
<th>Phone</th>
<td>{{ $so->site_phone }}</td>
@else
<td colspan="2>">&nbsp;</td>
@endif
</tr>
<tr>
<th>Email</th>
<td>{{ $o->account->email }}</td>
</tr>
<tr>
<th>Account</th>
<td>{{ $o->account->account_id }}</td>
</tr>
</table>
</div>
<div class="col-md-offset-2 col-sm-3 invoice-col">
<table class="table table-condensed">
<tr>
<th class="lead">Invoice #</th>
<td class="lead text-right"><strong>{{ $o->invoice_id }}</strong></td>
</tr>
<tr>
<th class="lead">Payment Due</th>
<td class="lead text-right"><strong>{{ $o->due_date->format('Y-m-d') }}</strong></td>
</tr>
<tr>
<th class="lead">Total</th>
<td class="lead text-right"><strong>${{ number_format($o->total,$o->currency()->rounding) }}</strong></td>
</tr>
</table>
</div>
</div>
<!-- /.row -->
<!-- Table row -->
<div class="row">
<div class="col-xs-12 table-responsive">
<table id="restripe" class="table table-bordered table-striped" width="100%">
<thead>
<tr>
<th class="col-sm-1 text-right">Qty</th>
<th class="col-sm-1">Product</th>
<th class="col-sm-8" colspan="2">Description</th>
<th class="col-sm-2 text-right" colspan="3">Subtotal</th>
</tr>
</thead>
<tbody>
@foreach ($o->products() as $po)
<tr id="invoice-services">
<td class="text-right">{{ $po->count }}</td>
<td>{{ $po->product_id }}</td>
<td colspan="2">{{ $po->name($o->account->user->language) }}</td>
<td colspan="2">&nbsp;</td>
<td class="text-right">${{ number_format($o->items->filter(function($item) use ($po) {return $item->product_id == $po->id; })->sum('total'),$o->currency()->rounding) }}</td>
</tr>
@foreach ($o->product_services($po) as $so)
<tr id="invoice-service-items" class="invoice-services @if($o->products()->count() > 1) visible-print @endif">
<td colspan="2">&nbsp;</td>
<td colspan="2">Service: <strong>{{ $so->service_id }}: {{ $so->name }}</strong></td>
<td>&nbsp;</td>
<td class="text-right">${{ number_format($o->product_service_items($po,$so)->sum('total'),$o->currency()->rounding) }}</td>
<td>&nbsp;</td>
</tr>
@foreach ($o->product_service_items($po,$so) as $io)
<tr class="invoice-service-items visible-print">
<td colspan="2">&nbsp;</td>
<td width="5%">&nbsp;</td>
<td>{{ $io->item_type_name }}</td>
<td class="text-right">${{ number_format($io->total,$o->currency()->rounding) }}</td>
<td colspan="2">&nbsp;</td>
</tr>
@endforeach
@endforeach
@endforeach
</tbody>
</table>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
<div class="row">
<!-- accepted payments column -->
<div class="col-xs-6">
<p class="lead">Payment Methods:</p>
{{--
<img src="../../dist/img/credit/visa.png" alt="Visa">
<img src="../../dist/img/credit/mastercard.png" alt="Mastercard">
<img src="../../dist/img/credit/american-express.png" alt="American Express">
<img src="../../dist/img/credit/paypal2.png" alt="Paypal">
--}}
<p class="text-muted well well-sm no-shadow" style="margin-top: 10px;">
{{ $o->invoice_text }}
</p>
</div>
<!-- /.col -->
<div class="col-xs-offset-2 col-xs-4">
<div class="table-responsive">
<table class="table">
<tr>
<th colspan="2" style="width:50%">Subtotal:</th>
<td class="text-right">${{ number_format($o->sub_total,$o->currency()->rounding) }}</td>
</tr>
<tr>
<th>&nbsp;</th>
<th>Tax (GST 10%)</th>
<td class="text-right">${{ number_format($o->tax_total,$o->currency()->rounding) }}</td>
</tr>
<tr>
<th>&nbsp;</th>
<th>Other Charges:</th>
<td class="text-right">$0.00</td>
</tr>
<tr>
<th colspan="2">Total:</th>
<td class="text-right">${{ number_format($o->total,$o->currency()->rounding) }}</td>
</tr>
<tr>
<th>&nbsp;</th>
<th>Payments:</th>
<td class="text-right">${{ number_format($o->paid,$o->currency()->rounding) }}</td>
</tr>
<tr>
<th colspan="2">Account Due:</th>
<td class="text-right">${{ number_format($o->due,$o->currency()->rounding) }}</td>
</tr>
</table>
</div>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
<!-- this row will not appear when printing -->
<div class="row no-print">
<div class="col-xs-12">
<a href="javascript:window.print();" target="_blank" class="btn btn-default"><i class="fa fa-print"></i> Print</a>
<button type="button" class="btn btn-success pull-right"><i class="fa fa-credit-card"></i> Submit Payment</button>
<button type="button" class="btn btn-primary pull-right" style="margin-right: 5px;">
<i class="fa fa-download"></i> Generate PDF
</button>
</div>
</div>
</section>
<!-- /.content -->
<div class="clearfix"></div>
@endsection
@section('page-scripts')
<style>
.stripe-odd {
background-color: #f9f9f9;
}
.stripe-even {
background-color: #e9e9e9;
}
</style>
<script>
$(document).ready(function() {
$("table#restripe").removeClass("table-striped");
$("table#restripe tr:not(.visible-print)").each(function (index) {
$(this).toggleClass("stripe-odd", (index & 1));
$(this).toggleClass("stripe-even", !!(index & 1));
});
$('tr[id="invoice-services"]').click(function() {
$(".invoice-services").toggleClass("visible-print");
});
$('tr[id="invoice-service-items"]').click(function() {
$(".invoice-service-items").toggleClass("visible-print");
});
})
</script>
@append

View File

@ -64,7 +64,7 @@
columns: [ columns: [
{ data: "service_id_url" }, { data: "service_id_url" },
{ data: "category" }, { data: "category" },
{ data: "service_name" }, { data: "name" },
{ data: "product_name" }, { data: "product_name" },
{ data: "status" }, { data: "status" },
{ data: "next_invoice" } { data: "next_invoice" }

View File

@ -22,22 +22,24 @@ Route::group(['middleware'=>['theme:adminlte-be','auth','role:wholesaler'],'pref
Route::get('setup','AdminHomeController@setup'); Route::get('setup','AdminHomeController@setup');
Route::post('setup','AdminHomeController@setup_update'); Route::post('setup','AdminHomeController@setup_update');
Route::get('switch/start/{id}','\Leenooks\Controllers\AdminController@user_switch_start')->name('switch.user.stop'); Route::get('switch/start/{id}','\Leenooks\Controllers\AdminController@user_switch_start')->name('switch.user.stop');
Route::get('switch/stop','\Leenooks\Controllers\AdminController@user_switch_stop')->name('switch.user.start');
Route::get('accounting/connect', 'AccountingController@connect'); Route::get('accounting/connect', 'AccountingController@connect');
}); });
Route::get('admin/switch/stop','\Leenooks\Controllers\AdminController@user_switch_stop')->name('switch.user.start')->middleware('auth');
// Our Reseller Routes // Our Reseller Routes
Route::group(['middleware'=>['theme:adminlte-be','auth','role:reseller'],'prefix'=>'r'], function() { Route::group(['middleware'=>['theme:adminlte-be','auth','role:reseller'],'prefix'=>'r'], function() {
Route::get('supplier/index', 'SuppliersController@index'); Route::get('supplier/index', 'SuppliersController@index');
Route::get('supplier/create', 'SuppliersController@create'); Route::get('supplier/create', 'SuppliersController@create');
Route::post('supplier/store', 'SuppliersController@store'); Route::post('supplier/store', 'SuppliersController@store');
Route::get('home', 'UserHomeController@home'); Route::get('home/{o}', 'UserHomeController@user');
}); });
// Our User Routes // Our User Routes
Route::group(['middleware'=>['theme:adminlte-be','auth'],'prefix'=>'u'], function() { Route::group(['middleware'=>['theme:adminlte-be','auth'],'prefix'=>'u'], function() {
Route::get('home', 'UserHomeController@home'); Route::get('home', 'UserHomeController@home');
Route::get('invoice/{o}', 'UserHomeController@invoice');
}); });
// Frontend Routes (Non-Authed Users) // Frontend Routes (Non-Authed Users)