Work in progress, initial dashboard
This commit is contained in:
@@ -44,4 +44,4 @@ class LoginController extends Controller
|
||||
{
|
||||
return view('adminlte::auth.login');
|
||||
}
|
||||
}
|
||||
}
|
102
app/Http/Controllers/SuppliersController.php
Normal file
102
app/Http/Controllers/SuppliersController.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Supplier;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SuppliersController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth ');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('r/supplier/index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('r/supplier/create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
// @todo Insure site index is included.
|
||||
$o = new Supplier;
|
||||
$o->name = $request->input('name');
|
||||
$o->active = 1;
|
||||
$o->account_mgr = '';
|
||||
$o->account_email = '';
|
||||
$o->email_provision = '';
|
||||
$o->email_support = '';
|
||||
$o->phone_provision = '';
|
||||
$o->phone_support = '';
|
||||
$o->save();
|
||||
|
||||
echo 'REDIRECT TO <a href="'.url('r/supplier/index').'">here</a>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\suppliers $suppliers
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(suppliers $suppliers)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\suppliers $suppliers
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(suppliers $suppliers)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\suppliers $suppliers
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, suppliers $suppliers)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\suppliers $suppliers
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(suppliers $suppliers)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
18
app/Http/Controllers/UserServicesController.php
Normal file
18
app/Http/Controllers/UserServicesController.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Auth;
|
||||
|
||||
class UserServicesController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
//$this->middleware('auth');
|
||||
}
|
||||
|
||||
public function services()
|
||||
{
|
||||
return ['data'=>Auth::user()->services_active->values()];
|
||||
}
|
||||
}
|
@@ -4,6 +4,11 @@ namespace App\Http\Controllers;
|
||||
|
||||
class WelcomeController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('demoMode');
|
||||
}
|
||||
|
||||
public function index() {
|
||||
return view('welcome');
|
||||
}
|
||||
|
@@ -38,6 +38,7 @@ class Kernel extends HttpKernel
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
\App\Http\Middleware\SetSite::class,
|
||||
\Laravel\Passport\Http\Middleware\CreateFreshApiToken::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
|
10
app/Models/ProductType.php
Normal file
10
app/Models/ProductType.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProductType extends Model
|
||||
{
|
||||
//
|
||||
}
|
@@ -35,6 +35,16 @@ class Service extends Model
|
||||
return $this->belongsTo(Product::class);
|
||||
}
|
||||
|
||||
public function getCategoryAttribute()
|
||||
{
|
||||
return $this->product->prod_plugin_file;
|
||||
}
|
||||
|
||||
public function getNextInvoiceAttribute()
|
||||
{
|
||||
return $this->date_next_invoice->format('Y-m-d');
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will return the associated service model for the product type
|
||||
*/
|
||||
@@ -55,11 +65,6 @@ class Service extends Model
|
||||
return 'TBA';
|
||||
}
|
||||
|
||||
public function getNextInvoiceAttribute()
|
||||
{
|
||||
return $this->date_next_invoice->format('Y-m-d');
|
||||
}
|
||||
|
||||
public function getServiceNameAttribute()
|
||||
{
|
||||
if (! isset($this->getServiceDetail()->name)) dd($this,$this->product,$this->getServiceDetail());
|
||||
|
10
app/Models/Supplier.php
Normal file
10
app/Models/Supplier.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Supplier extends Model
|
||||
{
|
||||
//
|
||||
}
|
10
app/Models/SupplierProduct.php
Normal file
10
app/Models/SupplierProduct.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SupplierProduct extends Model
|
||||
{
|
||||
//
|
||||
}
|
10
app/Models/SupplierProductType.php
Normal file
10
app/Models/SupplierProductType.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SupplierProductType extends Model
|
||||
{
|
||||
//
|
||||
}
|
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Laravel\Passport\Passport;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
|
||||
@@ -24,7 +25,7 @@ class AuthServiceProvider extends ServiceProvider
|
||||
public function boot()
|
||||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
//
|
||||
Passport::routes();
|
||||
// Passport::enableImplicitGrant();
|
||||
}
|
||||
}
|
||||
|
38
app/User.php
38
app/User.php
@@ -2,15 +2,17 @@
|
||||
|
||||
namespace App;
|
||||
|
||||
use Laravel\Passport\HasApiTokens;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
protected $table = 'ab_account';
|
||||
private $_currency;
|
||||
// @todo We cannot use timestamps - we should create the normal timestamps columns under laravel.
|
||||
public $timestamps = FALSE;
|
||||
|
||||
use Notifiable;
|
||||
use HasApiTokens, Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
@@ -43,17 +45,17 @@ class User extends Authenticatable
|
||||
*/
|
||||
public function invoices()
|
||||
{
|
||||
return $this->hasMany(Models\Invoice::class,'account_id');
|
||||
return $this->hasMany(Models\Invoice::class,'account_id');
|
||||
}
|
||||
|
||||
public function language()
|
||||
{
|
||||
return $this->belongsTo(Models\Language::class);
|
||||
return $this->belongsTo(Models\Language::class);
|
||||
}
|
||||
|
||||
public function payments()
|
||||
{
|
||||
return $this->hasMany(Models\Payment::class,'account_id');
|
||||
return $this->hasMany(Models\Payment::class,'account_id');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,7 +63,7 @@ class User extends Authenticatable
|
||||
*/
|
||||
public function services()
|
||||
{
|
||||
return $this->hasMany(Models\Service::class,'account_id');
|
||||
return $this->hasMany(Models\Service::class,'account_id');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,28 +84,30 @@ class User extends Authenticatable
|
||||
|
||||
public function getInvoicesDueAttribute()
|
||||
{
|
||||
return $this->invoices
|
||||
->where('active',TRUE)
|
||||
->sortBy('id')
|
||||
->transform(function ($item) { if ($item->due) return $item; })
|
||||
->reverse()
|
||||
->filter();
|
||||
return $this->invoices
|
||||
->where('active',TRUE)
|
||||
->sortBy('id')
|
||||
->transform(function ($item) { if ($item->due) return $item; })
|
||||
->reverse()
|
||||
->filter();
|
||||
}
|
||||
|
||||
public function getPaymentHistoryAttribute()
|
||||
{
|
||||
return $this->payments
|
||||
->sortBy('date_payment')
|
||||
->reverse();
|
||||
return $this->payments
|
||||
->sortBy('date_payment')
|
||||
->reverse();
|
||||
}
|
||||
|
||||
public function getNameAttribute()
|
||||
{
|
||||
return $this->full_name;
|
||||
return $this->full_name;
|
||||
}
|
||||
|
||||
public function getServicesActiveAttribute()
|
||||
{
|
||||
return $this->services->where('active',TRUE);
|
||||
return $this
|
||||
->services
|
||||
->where('active',TRUE);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user