Started work on SiteDetails and Setup
This commit is contained in:
parent
0ce640c283
commit
1cde2a888a
60
app/Http/Controllers/AdminHomeController.php
Normal file
60
app/Http/Controllers/AdminHomeController.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use App\Models\SiteDetails;
|
||||
|
||||
class AdminHomeController extends Controller
|
||||
{
|
||||
public function setup()
|
||||
{
|
||||
return view('a.setup');
|
||||
}
|
||||
|
||||
public function setup_update(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'site_name' => 'required|string|max:255',
|
||||
'site_email' => 'required|string|email|max:255',
|
||||
'site_address1' => 'required|string|max:255',
|
||||
'site_address2' => 'nullable|string|max:255',
|
||||
'site_city' => 'required|string|max:64',
|
||||
'site_state' => 'required|string|max:32',
|
||||
'site_postcode' => 'required|string|max:8',
|
||||
'site_phone' => 'nullable|regex:/[0-9 ]+/|min:6|max:12',
|
||||
'site_fax' => 'nullable|regex:/[0-9 ]+/|min:6|max:12',
|
||||
]);
|
||||
|
||||
// If we are more input that sample data, reject the update.
|
||||
if (config('SITE_SETUP')->allowed_keys(array_keys($request->except('_token'))))
|
||||
return redirect()->back()
|
||||
->withInput()
|
||||
->withErrors('Invalid configuration - values not expected.');
|
||||
|
||||
foreach ($request->except('_token') as $key => $value)
|
||||
{
|
||||
if (! $value) {
|
||||
SiteDetails::where('site_id',config('SITE_SETUP')->id)->where('key',$key)->delete();
|
||||
|
||||
} else {
|
||||
try {
|
||||
|
||||
// Update or create our config record.
|
||||
SiteDetails::updateOrCreate([
|
||||
'site_id'=>config('SITE_SETUP')->id,
|
||||
'key'=>$key,
|
||||
],[
|
||||
'value'=>$value,
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
dd($e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->back()
|
||||
->with('success','Setup Updated!');;
|
||||
}
|
||||
}
|
@ -14,17 +14,17 @@ class UserHomeController extends Controller
|
||||
public function home()
|
||||
{
|
||||
switch (Auth::user()->role()) {
|
||||
case 'Customer':
|
||||
case 'customer':
|
||||
return View('userhome',['o'=>Auth::user()]);
|
||||
|
||||
case 'Reseller':
|
||||
case 'reseller':
|
||||
return View('resellerhome',['o'=>Auth::user()]);
|
||||
|
||||
case 'Wholesaler':
|
||||
case 'wholesaler':
|
||||
return View('resellerhome',['o'=>Auth::user()]);
|
||||
|
||||
default:
|
||||
abort(500,'Unknown role: ',Auth::user()->role());
|
||||
abort(500,'Unknown role: '.Auth::user()->role());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,10 +6,6 @@ use Auth;
|
||||
|
||||
class UserServicesController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public function invoices()
|
||||
{
|
||||
return ['data'=>Auth::user()->invoices_due->values()];
|
||||
|
@ -61,7 +61,7 @@ class Kernel extends HttpKernel
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'demoMode' => \Spatie\DemoMode\DemoMode::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'reseller' => \App\Http\Middleware\Reseller::class,
|
||||
'role' => \App\Http\Middleware\Role::class,
|
||||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
||||
'theme' => \Igaster\LaravelTheme\Middleware\setTheme::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
|
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Closure;
|
||||
|
||||
class Reseller
|
||||
{
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (! in_array(Auth::user()->role(),['Wholesaler','Reseller']))
|
||||
{
|
||||
abort(303,'Not Reseller');
|
||||
|
||||
} else
|
||||
return $next($request);
|
||||
}
|
||||
}
|
31
app/Http/Middleware/Role.php
Normal file
31
app/Http/Middleware/Role.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Closure;
|
||||
|
||||
class Role
|
||||
{
|
||||
public function handle($request, Closure $next, $role)
|
||||
{
|
||||
if ($role AND ! Auth::user())
|
||||
return abort(303,'Not Authenticated');
|
||||
|
||||
switch ($role) {
|
||||
case 'wholesaler':
|
||||
if (Auth::user()->role() == $role)
|
||||
return $next($request);
|
||||
|
||||
break;
|
||||
|
||||
case 'reseller':
|
||||
if (in_array(Auth::user()->role(),['wholesaler','reseller']))
|
||||
return $next($request);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
abort(404,'User doesnt have role?');
|
||||
}
|
||||
}
|
@ -29,11 +29,9 @@ class SetSite
|
||||
// @todo Figure out how to know if this is an API call - and deny it if it's not in the database.
|
||||
$so = new Site;
|
||||
|
||||
if (Schema::hasTable('site'))
|
||||
if ($so->getTable() AND Schema::hasTable($so->getTable()))
|
||||
{
|
||||
$so = Site::where('url',$request->root())
|
||||
->orwhere('devurl',$request->root())
|
||||
// @todo With an API call, we would use ->firstorfail();
|
||||
->first();
|
||||
}
|
||||
|
||||
|
@ -3,16 +3,64 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class Site extends Model
|
||||
{
|
||||
protected $table = 'ab_setup';
|
||||
public $timestamps = FALSE;
|
||||
|
||||
protected $with = ['details'];
|
||||
|
||||
protected $casts = [
|
||||
'address'=>'array',
|
||||
];
|
||||
|
||||
public function details()
|
||||
{
|
||||
return $this->hasMany(SiteDetails::class);
|
||||
}
|
||||
|
||||
public function __get($key)
|
||||
{
|
||||
// @todo Not sure if this is functioning correctly?
|
||||
if ($parent = parent::__get($key))
|
||||
return $parent;
|
||||
|
||||
// Deprecated Items
|
||||
if (! in_array($key,array_keys($this->_sampledata())))
|
||||
{
|
||||
Log::alert('No sample data for Key:',['key'=>$key]);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
$detail = $this->details->where('key',$key)->first();
|
||||
|
||||
if ($detail) {
|
||||
return $detail->value;
|
||||
}
|
||||
|
||||
// Suppress some default values
|
||||
$optional = [
|
||||
'block_quotes',
|
||||
'clients',
|
||||
'page_tabs',
|
||||
'services',
|
||||
'site_description',
|
||||
'site_fax',
|
||||
'site_address2',
|
||||
'site_slider',
|
||||
'steps',
|
||||
'testimonials',
|
||||
];
|
||||
|
||||
if (in_array($key,$optional))
|
||||
return '';
|
||||
|
||||
Log::alert('Calling unknown Site Key:',['key'=>$key]);
|
||||
return array_get($this->_sampledata(),$key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre-load this model with Sample Data, if there is no database record
|
||||
*/
|
||||
@ -72,7 +120,26 @@ class Site extends Model
|
||||
],
|
||||
],
|
||||
'clients_intro'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore',
|
||||
'main_slider'=>[
|
||||
'page_tabs'=>[
|
||||
[
|
||||
'title'=>'Title 1',
|
||||
'image'=>'/image/generic/200/100/999',
|
||||
'text'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua',
|
||||
|
||||
],
|
||||
[
|
||||
'title'=>'Title 2',
|
||||
'image'=>'/image/generic/200/100/799',
|
||||
'text'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua',
|
||||
|
||||
],
|
||||
[
|
||||
'title'=>'Title 3',
|
||||
'image'=>'/image/generic/200/100/979',
|
||||
'text'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua',
|
||||
],
|
||||
],
|
||||
'site_slider'=>[
|
||||
[
|
||||
'title'=>'Header <br/><span class="carousel-title-normal">and Title</span>',
|
||||
'text'=>'This is what you were looking for',
|
||||
@ -97,40 +164,21 @@ class Site extends Model
|
||||
//'button'=>['text'=>'Purchase Now','url'=>'#'],
|
||||
],
|
||||
],
|
||||
'page_tabs'=>[
|
||||
[
|
||||
'title'=>'Title 1',
|
||||
'image'=>'/image/generic/200/100/999',
|
||||
'text'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua',
|
||||
|
||||
],
|
||||
[
|
||||
'title'=>'Title 2',
|
||||
'image'=>'/image/generic/200/100/799',
|
||||
'text'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua',
|
||||
|
||||
],
|
||||
[
|
||||
'title'=>'Title 3',
|
||||
'image'=>'/image/generic/200/100/979',
|
||||
'text'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua',
|
||||
],
|
||||
],
|
||||
'site'=>[
|
||||
'id'=>NULL,
|
||||
'address'=>json_decode('{"address1":"PO Box 149","address2":"7 Woodlands Court","city":"Bendigo","state":"VIC","postcode":"3550"}'),
|
||||
'address1'=>'Building Name',
|
||||
'address2'=>'123 Road Street',
|
||||
'city'=>'City',
|
||||
'description'=>'Example Site',
|
||||
'email'=>'nobody@example.com',
|
||||
'fax'=>'+0 1 2345 6789',
|
||||
'logo'=>route('image',['width'=>128,'height'=>32,'color'=>'eee']),
|
||||
'name'=>'Example',
|
||||
'postalcode'=>'123 456',
|
||||
'phone'=>'+0 1 2345 6789',
|
||||
'state'=>'State',
|
||||
],
|
||||
'site_address1'=>'Building Name',
|
||||
'site_address2'=>NULL,
|
||||
'site_city'=>'City',
|
||||
'site_description'=>'Example Site',
|
||||
'site_email'=>'nobody@example.com',
|
||||
'site_fax'=>'+0 1 2345 6789',
|
||||
'site_name'=>'Example',
|
||||
'site_phone'=>'+0 1 2345 6789',
|
||||
'site_postcode'=>'123 456',
|
||||
'site_state'=>'State',
|
||||
'site_tax'=>'12 123 123 123',
|
||||
'services'=>[
|
||||
['title'=>'Title 1','text'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.','icon'=>'fa fa-location-arrow blue','image'=>NULL],
|
||||
['title'=>'Title 2','text'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.','icon'=>'fa fa-compress green','image'=>NULL],
|
||||
@ -182,66 +230,6 @@ class Site extends Model
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitiesAttribute()
|
||||
{
|
||||
return array_get($this->_sampledata(),'activity');
|
||||
}
|
||||
|
||||
public function getActivityIntroAttribute()
|
||||
{
|
||||
return array_get($this->_sampledata(),'activity_intro');
|
||||
}
|
||||
|
||||
public function getClientsAttribute()
|
||||
{
|
||||
return array_get($this->_sampledata(),'clients');
|
||||
}
|
||||
|
||||
public function getCLientsIntoAttribute()
|
||||
{
|
||||
return array_get($this->_sampledata(),'clients_info');
|
||||
}
|
||||
|
||||
public function getServicesAttribute()
|
||||
{
|
||||
return array_get($this->_sampledata(),'services');
|
||||
}
|
||||
|
||||
public function getBlockQuotesAttribute()
|
||||
{
|
||||
return array_get($this->_sampledata(),'block_quotes');
|
||||
}
|
||||
|
||||
public function getPageTabsAttribute()
|
||||
{
|
||||
return array_get($this->_sampledata(),'page_tabs');
|
||||
}
|
||||
|
||||
public function getSiteSliderAttribute()
|
||||
{
|
||||
return array_get($this->_sampledata(),'main_slider');
|
||||
}
|
||||
|
||||
public function getSocialAttribute()
|
||||
{
|
||||
return array_get($this->_sampledata(),'social');
|
||||
}
|
||||
|
||||
public function getStepsAttribute()
|
||||
{
|
||||
return array_get($this->_sampledata(),'steps');
|
||||
}
|
||||
|
||||
public function getTestimonialsAttribute()
|
||||
{
|
||||
return array_get($this->_sampledata(),'testimonials');
|
||||
}
|
||||
|
||||
public function getTopMenuAttribute()
|
||||
{
|
||||
return array_get($this->_sampledata(),'top_menu');
|
||||
}
|
||||
|
||||
public function sample()
|
||||
{
|
||||
return $this->forceFill(array_get($this->_sampledata(),'site'));
|
||||
@ -257,12 +245,12 @@ class Site extends Model
|
||||
{
|
||||
$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->postalcode) ? ',' : ''),$this->state,$this->postalcode));
|
||||
if ($this->site_address1)
|
||||
array_push($return,$this->site_address1);
|
||||
if ($this->site_address2)
|
||||
array_push($return,$this->site_address2);
|
||||
if ($this->site_city)
|
||||
array_push($return,sprintf('%s %s %s',$this->site_city.(($this->site_state OR $this->site_postcode) ? ',' : ''),$this->site_state,$this->site_postcode));
|
||||
|
||||
if (! $return)
|
||||
$return = ['No Address'];
|
||||
@ -270,6 +258,11 @@ class Site extends Model
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function allowed_keys(array $keys=[])
|
||||
{
|
||||
return $keys ? array_diff($keys,array_keys($this->_sampledata())) : array_keys($this->_sampledata());
|
||||
}
|
||||
|
||||
public function address($type='plain')
|
||||
{
|
||||
switch ($type)
|
||||
@ -282,10 +275,6 @@ class Site extends Model
|
||||
}
|
||||
}
|
||||
|
||||
public function fax()
|
||||
{
|
||||
return '@todo';
|
||||
}
|
||||
public function logo_url()
|
||||
{
|
||||
return url($this->logo ? $this->logo : '/image/generic/150/20/fff');
|
||||
|
22
app/Models/SiteDetails.php
Normal file
22
app/Models/SiteDetails.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use Leenooks\Traits\CompositeKeys;
|
||||
|
||||
class SiteDetails extends Model
|
||||
{
|
||||
use CompositeKeys;
|
||||
|
||||
public $fillable = ['site_id','key','value'];
|
||||
public $incrementing = false;
|
||||
protected $primaryKey = ['site_id','key'];
|
||||
public $timestamps = FALSE;
|
||||
|
||||
public function site()
|
||||
{
|
||||
return $this->belongsTo(Site::class);
|
||||
}
|
||||
}
|
@ -213,14 +213,14 @@ class User extends Authenticatable
|
||||
{
|
||||
// If I have agents and no parent, I am the wholesaler
|
||||
if (is_null($this->parent_id) AND $this->all_agents()->count())
|
||||
return 'Wholesaler';
|
||||
return 'wholesaler';
|
||||
|
||||
// If I have agents and a parent, I am a reseller
|
||||
elseif ($this->parent_id AND $this->all_agents()->count())
|
||||
return 'Reseller';
|
||||
return 'reseller';
|
||||
|
||||
// If I have no agents and a parent, I am a customer
|
||||
elseif (! $this->all_agents()->count())
|
||||
return 'Customer';
|
||||
return 'customer';
|
||||
}
|
||||
}
|
6
composer.lock
generated
6
composer.lock
generated
@ -2369,11 +2369,11 @@
|
||||
},
|
||||
{
|
||||
"name": "leenooks/laravel",
|
||||
"version": "0.1.7",
|
||||
"version": "0.1.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://dev.leenooks.net/leenooks/laravel",
|
||||
"reference": "ac867a25265d07476967eef7d01516a92b9f2b73"
|
||||
"reference": "444c159ab911819e818a7f8a1f0aaf59dfdd58d1"
|
||||
},
|
||||
"require": {
|
||||
"igaster/laravel-theme": "2.0.6",
|
||||
@ -2409,7 +2409,7 @@
|
||||
"laravel",
|
||||
"leenooks"
|
||||
],
|
||||
"time": "2018-07-13T04:39:10+00:00"
|
||||
"time": "2018-07-31T02:56:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "maximebf/debugbar",
|
||||
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateSiteDetails extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('site_details', function (Blueprint $table) {
|
||||
$table->integer('site_id');
|
||||
$table->string('key');
|
||||
$table->json('value');
|
||||
|
||||
$table->foreign('site_id')->references('id')->on('ab_setup');
|
||||
$table->unique(['site_id','key']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('site_details');
|
||||
}
|
||||
}
|
912
public/js/jqBootstrapValidation.js
vendored
Normal file
912
public/js/jqBootstrapValidation.js
vendored
Normal file
@ -0,0 +1,912 @@
|
||||
/* jqBootstrapValidation
|
||||
* A plugin for automating validation on Twitter Bootstrap formatted forms.
|
||||
*
|
||||
* v1.3.6
|
||||
*
|
||||
* License: MIT <http://opensource.org/licenses/mit-license.php> - see LICENSE file
|
||||
*
|
||||
* http://ReactiveRaven.github.com/jqBootstrapValidation/
|
||||
*/
|
||||
|
||||
(function( $ ){
|
||||
|
||||
var createdElements = [];
|
||||
|
||||
var defaults = {
|
||||
options: {
|
||||
prependExistingHelpBlock: false,
|
||||
sniffHtml: true, // sniff for 'required', 'maxlength', etc
|
||||
preventSubmit: true, // stop the form submit event from firing if validation fails
|
||||
submitError: false, // function called if there is an error when trying to submit
|
||||
submitSuccess: false, // function called just before a successful submit event is sent to the server
|
||||
semanticallyStrict: false, // set to true to tidy up generated HTML output
|
||||
autoAdd: {
|
||||
helpBlocks: true
|
||||
},
|
||||
filter: function () {
|
||||
// return $(this).is(":visible"); // only validate elements you can see
|
||||
return true; // validate everything
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init : function( options ) {
|
||||
|
||||
var settings = $.extend(true, {}, defaults);
|
||||
|
||||
settings.options = $.extend(true, settings.options, options);
|
||||
|
||||
var $siblingElements = this;
|
||||
|
||||
var uniqueForms = $.unique(
|
||||
$siblingElements.map( function () {
|
||||
return $(this).parents("form")[0];
|
||||
}).toArray()
|
||||
);
|
||||
|
||||
$(uniqueForms).bind("submit", function (e) {
|
||||
var $form = $(this);
|
||||
var warningsFound = 0;
|
||||
var $inputs = $form.find("input,textarea,select").not("[type=submit],[type=image]").filter(settings.options.filter);
|
||||
$inputs.trigger("submit.validation").trigger("validationLostFocus.validation");
|
||||
|
||||
$inputs.each(function (i, el) {
|
||||
var $this = $(el),
|
||||
$controlGroup = $this.parents(".control-group").first();
|
||||
if (
|
||||
$controlGroup.hasClass("warning")
|
||||
) {
|
||||
$controlGroup.removeClass("warning").addClass("error");
|
||||
warningsFound++;
|
||||
}
|
||||
});
|
||||
|
||||
$inputs.trigger("validationLostFocus.validation");
|
||||
|
||||
if (warningsFound) {
|
||||
if (settings.options.preventSubmit) {
|
||||
e.preventDefault();
|
||||
}
|
||||
$form.addClass("error");
|
||||
if ($.isFunction(settings.options.submitError)) {
|
||||
settings.options.submitError($form, e, $inputs.jqBootstrapValidation("collectErrors", true));
|
||||
}
|
||||
} else {
|
||||
$form.removeClass("error");
|
||||
if ($.isFunction(settings.options.submitSuccess)) {
|
||||
settings.options.submitSuccess($form, e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return this.each(function(){
|
||||
|
||||
// Get references to everything we're interested in
|
||||
var $this = $(this),
|
||||
$controlGroup = $this.parents(".control-group").first(),
|
||||
$helpBlock = $controlGroup.find(".help-block").first(),
|
||||
$form = $this.parents("form").first(),
|
||||
validatorNames = [];
|
||||
|
||||
// create message container if not exists
|
||||
if (!$helpBlock.length && settings.options.autoAdd && settings.options.autoAdd.helpBlocks) {
|
||||
$helpBlock = $('<div class="help-block" />');
|
||||
$controlGroup.find('.controls').append($helpBlock);
|
||||
createdElements.push($helpBlock[0]);
|
||||
}
|
||||
|
||||
// =============================================================
|
||||
// SNIFF HTML FOR VALIDATORS
|
||||
// =============================================================
|
||||
|
||||
// *snort sniff snuffle*
|
||||
|
||||
if (settings.options.sniffHtml) {
|
||||
var message = "";
|
||||
// ---------------------------------------------------------
|
||||
// PATTERN
|
||||
// ---------------------------------------------------------
|
||||
if ($this.attr("pattern") !== undefined) {
|
||||
message = "Not in the expected format<!-- data-validation-pattern-message to override -->";
|
||||
if ($this.data("validationPatternMessage")) {
|
||||
message = $this.data("validationPatternMessage");
|
||||
}
|
||||
$this.data("validationPatternMessage", message);
|
||||
$this.data("validationPatternRegex", $this.attr("pattern"));
|
||||
}
|
||||
// ---------------------------------------------------------
|
||||
// MAX
|
||||
// ---------------------------------------------------------
|
||||
if ($this.attr("max") !== undefined || $this.attr("aria-valuemax") !== undefined) {
|
||||
var max = ($this.attr("max") !== undefined ? $this.attr("max") : $this.attr("aria-valuemax"));
|
||||
message = "Too high: Maximum of '" + max + "'<!-- data-validation-max-message to override -->";
|
||||
if ($this.data("validationMaxMessage")) {
|
||||
message = $this.data("validationMaxMessage");
|
||||
}
|
||||
$this.data("validationMaxMessage", message);
|
||||
$this.data("validationMaxMax", max);
|
||||
}
|
||||
// ---------------------------------------------------------
|
||||
// MIN
|
||||
// ---------------------------------------------------------
|
||||
if ($this.attr("min") !== undefined || $this.attr("aria-valuemin") !== undefined) {
|
||||
var min = ($this.attr("min") !== undefined ? $this.attr("min") : $this.attr("aria-valuemin"));
|
||||
message = "Too low: Minimum of '" + min + "'<!-- data-validation-min-message to override -->";
|
||||
if ($this.data("validationMinMessage")) {
|
||||
message = $this.data("validationMinMessage");
|
||||
}
|
||||
$this.data("validationMinMessage", message);
|
||||
$this.data("validationMinMin", min);
|
||||
}
|
||||
// ---------------------------------------------------------
|
||||
// MAXLENGTH
|
||||
// ---------------------------------------------------------
|
||||
if ($this.attr("maxlength") !== undefined) {
|
||||
message = "Too long: Maximum of '" + $this.attr("maxlength") + "' characters<!-- data-validation-maxlength-message to override -->";
|
||||
if ($this.data("validationMaxlengthMessage")) {
|
||||
message = $this.data("validationMaxlengthMessage");
|
||||
}
|
||||
$this.data("validationMaxlengthMessage", message);
|
||||
$this.data("validationMaxlengthMaxlength", $this.attr("maxlength"));
|
||||
}
|
||||
// ---------------------------------------------------------
|
||||
// MINLENGTH
|
||||
// ---------------------------------------------------------
|
||||
if ($this.attr("minlength") !== undefined) {
|
||||
message = "Too short: Minimum of '" + $this.attr("minlength") + "' characters<!-- data-validation-minlength-message to override -->";
|
||||
if ($this.data("validationMinlengthMessage")) {
|
||||
message = $this.data("validationMinlengthMessage");
|
||||
}
|
||||
$this.data("validationMinlengthMessage", message);
|
||||
$this.data("validationMinlengthMinlength", $this.attr("minlength"));
|
||||
}
|
||||
// ---------------------------------------------------------
|
||||
// REQUIRED
|
||||
// ---------------------------------------------------------
|
||||
if ($this.attr("required") !== undefined || $this.attr("aria-required") !== undefined) {
|
||||
message = settings.builtInValidators.required.message;
|
||||
if ($this.data("validationRequiredMessage")) {
|
||||
message = $this.data("validationRequiredMessage");
|
||||
}
|
||||
$this.data("validationRequiredMessage", message);
|
||||
}
|
||||
// ---------------------------------------------------------
|
||||
// NUMBER
|
||||
// ---------------------------------------------------------
|
||||
if ($this.attr("type") !== undefined && $this.attr("type").toLowerCase() === "number") {
|
||||
message = settings.builtInValidators.number.message;
|
||||
if ($this.data("validationNumberMessage")) {
|
||||
message = $this.data("validationNumberMessage");
|
||||
}
|
||||
$this.data("validationNumberMessage", message);
|
||||
}
|
||||
// ---------------------------------------------------------
|
||||
// EMAIL
|
||||
// ---------------------------------------------------------
|
||||
if ($this.attr("type") !== undefined && $this.attr("type").toLowerCase() === "email") {
|
||||
message = "Not a valid email address<!-- data-validator-validemail-message to override -->";
|
||||
if ($this.data("validationValidemailMessage")) {
|
||||
message = $this.data("validationValidemailMessage");
|
||||
} else if ($this.data("validationEmailMessage")) {
|
||||
message = $this.data("validationEmailMessage");
|
||||
}
|
||||
$this.data("validationValidemailMessage", message);
|
||||
}
|
||||
// ---------------------------------------------------------
|
||||
// MINCHECKED
|
||||
// ---------------------------------------------------------
|
||||
if ($this.attr("minchecked") !== undefined) {
|
||||
message = "Not enough options checked; Minimum of '" + $this.attr("minchecked") + "' required<!-- data-validation-minchecked-message to override -->";
|
||||
if ($this.data("validationMincheckedMessage")) {
|
||||
message = $this.data("validationMincheckedMessage");
|
||||
}
|
||||
$this.data("validationMincheckedMessage", message);
|
||||
$this.data("validationMincheckedMinchecked", $this.attr("minchecked"));
|
||||
}
|
||||
// ---------------------------------------------------------
|
||||
// MAXCHECKED
|
||||
// ---------------------------------------------------------
|
||||
if ($this.attr("maxchecked") !== undefined) {
|
||||
message = "Too many options checked; Maximum of '" + $this.attr("maxchecked") + "' required<!-- data-validation-maxchecked-message to override -->";
|
||||
if ($this.data("validationMaxcheckedMessage")) {
|
||||
message = $this.data("validationMaxcheckedMessage");
|
||||
}
|
||||
$this.data("validationMaxcheckedMessage", message);
|
||||
$this.data("validationMaxcheckedMaxchecked", $this.attr("maxchecked"));
|
||||
}
|
||||
}
|
||||
|
||||
// =============================================================
|
||||
// COLLECT VALIDATOR NAMES
|
||||
// =============================================================
|
||||
|
||||
// Get named validators
|
||||
if ($this.data("validation") !== undefined) {
|
||||
validatorNames = $this.data("validation").split(",");
|
||||
}
|
||||
|
||||
// Get extra ones defined on the element's data attributes
|
||||
$.each($this.data(), function (i, el) {
|
||||
var parts = i.replace(/([A-Z])/g, ",$1").split(",");
|
||||
if (parts[0] === "validation" && parts[1]) {
|
||||
validatorNames.push(parts[1]);
|
||||
}
|
||||
});
|
||||
|
||||
// =============================================================
|
||||
// NORMALISE VALIDATOR NAMES
|
||||
// =============================================================
|
||||
|
||||
var validatorNamesToInspect = validatorNames;
|
||||
var newValidatorNamesToInspect = [];
|
||||
|
||||
do // repeatedly expand 'shortcut' validators into their real validators
|
||||
{
|
||||
// Uppercase only the first letter of each name
|
||||
$.each(validatorNames, function (i, el) {
|
||||
validatorNames[i] = formatValidatorName(el);
|
||||
});
|
||||
|
||||
// Remove duplicate validator names
|
||||
validatorNames = $.unique(validatorNames);
|
||||
|
||||
// Pull out the new validator names from each shortcut
|
||||
newValidatorNamesToInspect = [];
|
||||
$.each(validatorNamesToInspect, function(i, el) {
|
||||
if ($this.data("validation" + el + "Shortcut") !== undefined) {
|
||||
// Are these custom validators?
|
||||
// Pull them out!
|
||||
$.each($this.data("validation" + el + "Shortcut").split(","), function(i2, el2) {
|
||||
newValidatorNamesToInspect.push(el2);
|
||||
});
|
||||
} else if (settings.builtInValidators[el.toLowerCase()]) {
|
||||
// Is this a recognised built-in?
|
||||
// Pull it out!
|
||||
var validator = settings.builtInValidators[el.toLowerCase()];
|
||||
if (validator.type.toLowerCase() === "shortcut") {
|
||||
$.each(validator.shortcut.split(","), function (i, el) {
|
||||
el = formatValidatorName(el);
|
||||
newValidatorNamesToInspect.push(el);
|
||||
validatorNames.push(el);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
validatorNamesToInspect = newValidatorNamesToInspect;
|
||||
|
||||
} while (validatorNamesToInspect.length > 0)
|
||||
|
||||
// =============================================================
|
||||
// SET UP VALIDATOR ARRAYS
|
||||
// =============================================================
|
||||
|
||||
var validators = {};
|
||||
|
||||
$.each(validatorNames, function (i, el) {
|
||||
// Set up the 'override' message
|
||||
var message = $this.data("validation" + el + "Message");
|
||||
var hasOverrideMessage = (message !== undefined);
|
||||
var foundValidator = false;
|
||||
message =
|
||||
(
|
||||
message
|
||||
? message
|
||||
: "'" + el + "' validation failed <!-- Add attribute 'data-validation-" + el.toLowerCase() + "-message' to input to change this message -->"
|
||||
)
|
||||
;
|
||||
|
||||
$.each(
|
||||
settings.validatorTypes,
|
||||
function (validatorType, validatorTemplate) {
|
||||
if (validators[validatorType] === undefined) {
|
||||
validators[validatorType] = [];
|
||||
}
|
||||
if (!foundValidator && $this.data("validation" + el + formatValidatorName(validatorTemplate.name)) !== undefined) {
|
||||
validators[validatorType].push(
|
||||
$.extend(
|
||||
true,
|
||||
{
|
||||
name: formatValidatorName(validatorTemplate.name),
|
||||
message: message
|
||||
},
|
||||
validatorTemplate.init($this, el)
|
||||
)
|
||||
);
|
||||
foundValidator = true;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if (!foundValidator && settings.builtInValidators[el.toLowerCase()]) {
|
||||
|
||||
var validator = $.extend(true, {}, settings.builtInValidators[el.toLowerCase()]);
|
||||
if (hasOverrideMessage) {
|
||||
validator.message = message;
|
||||
}
|
||||
var validatorType = validator.type.toLowerCase();
|
||||
|
||||
if (validatorType === "shortcut") {
|
||||
foundValidator = true;
|
||||
} else {
|
||||
$.each(
|
||||
settings.validatorTypes,
|
||||
function (validatorTemplateType, validatorTemplate) {
|
||||
if (validators[validatorTemplateType] === undefined) {
|
||||
validators[validatorTemplateType] = [];
|
||||
}
|
||||
if (!foundValidator && validatorType === validatorTemplateType.toLowerCase()) {
|
||||
$this.data("validation" + el + formatValidatorName(validatorTemplate.name), validator[validatorTemplate.name.toLowerCase()]);
|
||||
validators[validatorType].push(
|
||||
$.extend(
|
||||
validator,
|
||||
validatorTemplate.init($this, el)
|
||||
)
|
||||
);
|
||||
foundValidator = true;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (! foundValidator) {
|
||||
$.error("Cannot find validation info for '" + el + "'");
|
||||
}
|
||||
});
|
||||
|
||||
// =============================================================
|
||||
// STORE FALLBACK VALUES
|
||||
// =============================================================
|
||||
|
||||
$helpBlock.data(
|
||||
"original-contents",
|
||||
(
|
||||
$helpBlock.data("original-contents")
|
||||
? $helpBlock.data("original-contents")
|
||||
: $helpBlock.html()
|
||||
)
|
||||
);
|
||||
|
||||
$helpBlock.data(
|
||||
"original-role",
|
||||
(
|
||||
$helpBlock.data("original-role")
|
||||
? $helpBlock.data("original-role")
|
||||
: $helpBlock.attr("role")
|
||||
)
|
||||
);
|
||||
|
||||
$controlGroup.data(
|
||||
"original-classes",
|
||||
(
|
||||
$controlGroup.data("original-clases")
|
||||
? $controlGroup.data("original-classes")
|
||||
: $controlGroup.attr("class")
|
||||
)
|
||||
);
|
||||
|
||||
$this.data(
|
||||
"original-aria-invalid",
|
||||
(
|
||||
$this.data("original-aria-invalid")
|
||||
? $this.data("original-aria-invalid")
|
||||
: $this.attr("aria-invalid")
|
||||
)
|
||||
);
|
||||
|
||||
// =============================================================
|
||||
// VALIDATION
|
||||
// =============================================================
|
||||
|
||||
$this.bind(
|
||||
"validation.validation",
|
||||
function (event, params) {
|
||||
|
||||
var value = getValue($this);
|
||||
|
||||
// Get a list of the errors to apply
|
||||
var errorsFound = [];
|
||||
|
||||
$.each(validators, function (validatorType, validatorTypeArray) {
|
||||
if (value || value.length || (params && params.includeEmpty) || (!!settings.validatorTypes[validatorType].blockSubmit && params && !!params.submitting)) {
|
||||
$.each(validatorTypeArray, function (i, validator) {
|
||||
if (settings.validatorTypes[validatorType].validate($this, value, validator)) {
|
||||
errorsFound.push(validator.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return errorsFound;
|
||||
}
|
||||
);
|
||||
|
||||
$this.bind(
|
||||
"getValidators.validation",
|
||||
function () {
|
||||
return validators;
|
||||
}
|
||||
);
|
||||
|
||||
// =============================================================
|
||||
// WATCH FOR CHANGES
|
||||
// =============================================================
|
||||
$this.bind(
|
||||
"submit.validation",
|
||||
function () {
|
||||
return $this.triggerHandler("change.validation", {submitting: true});
|
||||
}
|
||||
);
|
||||
$this.bind(
|
||||
[
|
||||
"keyup",
|
||||
"focus",
|
||||
"blur",
|
||||
"click",
|
||||
"keydown",
|
||||
"keypress",
|
||||
"change"
|
||||
].join(".validation ") + ".validation",
|
||||
function (e, params) {
|
||||
|
||||
var value = getValue($this);
|
||||
|
||||
var errorsFound = [];
|
||||
|
||||
$controlGroup.find("input,textarea,select").each(function (i, el) {
|
||||
var oldCount = errorsFound.length;
|
||||
$.each($(el).triggerHandler("validation.validation", params), function (j, message) {
|
||||
errorsFound.push(message);
|
||||
});
|
||||
if (errorsFound.length > oldCount) {
|
||||
$(el).attr("aria-invalid", "true");
|
||||
} else {
|
||||
var original = $this.data("original-aria-invalid");
|
||||
$(el).attr("aria-invalid", (original !== undefined ? original : false));
|
||||
}
|
||||
});
|
||||
|
||||
$form.find("input,select,textarea").not($this).not("[name=\"" + $this.attr("name") + "\"]").trigger("validationLostFocus.validation");
|
||||
|
||||
errorsFound = $.unique(errorsFound.sort());
|
||||
|
||||
// Were there any errors?
|
||||
if (errorsFound.length) {
|
||||
// Better flag it up as a warning.
|
||||
$controlGroup.removeClass("success error").addClass("warning");
|
||||
|
||||
// How many errors did we find?
|
||||
if (settings.options.semanticallyStrict && errorsFound.length === 1) {
|
||||
// Only one? Being strict? Just output it.
|
||||
$helpBlock.html(errorsFound[0] +
|
||||
( settings.options.prependExistingHelpBlock ? $helpBlock.data("original-contents") : "" ));
|
||||
} else {
|
||||
// Multiple? Being sloppy? Glue them together into an UL.
|
||||
$helpBlock.html("<ul role=\"alert\"><li>" + errorsFound.join("</li><li>") + "</li></ul>" +
|
||||
( settings.options.prependExistingHelpBlock ? $helpBlock.data("original-contents") : "" ));
|
||||
}
|
||||
} else {
|
||||
$controlGroup.removeClass("warning error success");
|
||||
if (value.length > 0) {
|
||||
$controlGroup.addClass("success");
|
||||
}
|
||||
$helpBlock.html($helpBlock.data("original-contents"));
|
||||
}
|
||||
|
||||
if (e.type === "blur") {
|
||||
$controlGroup.removeClass("success");
|
||||
}
|
||||
}
|
||||
);
|
||||
$this.bind("validationLostFocus.validation", function () {
|
||||
$controlGroup.removeClass("success");
|
||||
});
|
||||
});
|
||||
},
|
||||
destroy : function( ) {
|
||||
|
||||
return this.each(
|
||||
function() {
|
||||
|
||||
var
|
||||
$this = $(this),
|
||||
$controlGroup = $this.parents(".control-group").first(),
|
||||
$helpBlock = $controlGroup.find(".help-block").first();
|
||||
|
||||
// remove our events
|
||||
$this.unbind('.validation'); // events are namespaced.
|
||||
// reset help text
|
||||
$helpBlock.html($helpBlock.data("original-contents"));
|
||||
// reset classes
|
||||
$controlGroup.attr("class", $controlGroup.data("original-classes"));
|
||||
// reset aria
|
||||
$this.attr("aria-invalid", $this.data("original-aria-invalid"));
|
||||
// reset role
|
||||
$helpBlock.attr("role", $this.data("original-role"));
|
||||
// remove all elements we created
|
||||
if (createdElements.indexOf($helpBlock[0]) > -1) {
|
||||
$helpBlock.remove();
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
},
|
||||
collectErrors : function(includeEmpty) {
|
||||
|
||||
var errorMessages = {};
|
||||
this.each(function (i, el) {
|
||||
var $el = $(el);
|
||||
var name = $el.attr("name");
|
||||
var errors = $el.triggerHandler("validation.validation", {includeEmpty: true});
|
||||
errorMessages[name] = $.extend(true, errors, errorMessages[name]);
|
||||
});
|
||||
|
||||
$.each(errorMessages, function (i, el) {
|
||||
if (el.length === 0) {
|
||||
delete errorMessages[i];
|
||||
}
|
||||
});
|
||||
|
||||
return errorMessages;
|
||||
|
||||
},
|
||||
hasErrors: function() {
|
||||
|
||||
var errorMessages = [];
|
||||
|
||||
this.each(function (i, el) {
|
||||
errorMessages = errorMessages.concat(
|
||||
$(el).triggerHandler("getValidators.validation") ? $(el).triggerHandler("validation.validation", {submitting: true}) : []
|
||||
);
|
||||
});
|
||||
|
||||
return (errorMessages.length > 0);
|
||||
},
|
||||
override : function (newDefaults) {
|
||||
defaults = $.extend(true, defaults, newDefaults);
|
||||
}
|
||||
},
|
||||
validatorTypes: {
|
||||
callback: {
|
||||
name: "callback",
|
||||
init: function ($this, name) {
|
||||
return {
|
||||
validatorName: name,
|
||||
callback: $this.data("validation" + name + "Callback"),
|
||||
lastValue: $this.val(),
|
||||
lastValid: true,
|
||||
lastFinished: true
|
||||
};
|
||||
},
|
||||
validate: function ($this, value, validator) {
|
||||
if (validator.lastValue === value && validator.lastFinished) {
|
||||
return !validator.lastValid;
|
||||
}
|
||||
|
||||
if (validator.lastFinished === true)
|
||||
{
|
||||
validator.lastValue = value;
|
||||
validator.lastValid = true;
|
||||
validator.lastFinished = false;
|
||||
|
||||
var rrjqbvValidator = validator;
|
||||
var rrjqbvThis = $this;
|
||||
executeFunctionByName(
|
||||
validator.callback,
|
||||
window,
|
||||
$this,
|
||||
value,
|
||||
function (data) {
|
||||
if (rrjqbvValidator.lastValue === data.value) {
|
||||
rrjqbvValidator.lastValid = data.valid;
|
||||
if (data.message) {
|
||||
rrjqbvValidator.message = data.message;
|
||||
}
|
||||
rrjqbvValidator.lastFinished = true;
|
||||
rrjqbvThis.data("validation" + rrjqbvValidator.validatorName + "Message", rrjqbvValidator.message);
|
||||
// Timeout is set to avoid problems with the events being considered 'already fired'
|
||||
setTimeout(function () {
|
||||
rrjqbvThis.trigger("change.validation");
|
||||
}, 1); // doesn't need a long timeout, just long enough for the event bubble to burst
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
},
|
||||
ajax: {
|
||||
name: "ajax",
|
||||
init: function ($this, name) {
|
||||
return {
|
||||
validatorName: name,
|
||||
url: $this.data("validation" + name + "Ajax"),
|
||||
lastValue: $this.val(),
|
||||
lastValid: true,
|
||||
lastFinished: true
|
||||
};
|
||||
},
|
||||
validate: function ($this, value, validator) {
|
||||
if (""+validator.lastValue === ""+value && validator.lastFinished === true) {
|
||||
return validator.lastValid === false;
|
||||
}
|
||||
|
||||
if (validator.lastFinished === true)
|
||||
{
|
||||
validator.lastValue = value;
|
||||
validator.lastValid = true;
|
||||
validator.lastFinished = false;
|
||||
$.ajax({
|
||||
url: validator.url,
|
||||
data: "value=" + value + "&field=" + $this.attr("name"),
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (""+validator.lastValue === ""+data.value) {
|
||||
validator.lastValid = !!(data.valid);
|
||||
if (data.message) {
|
||||
validator.message = data.message;
|
||||
}
|
||||
validator.lastFinished = true;
|
||||
$this.data("validation" + validator.validatorName + "Message", validator.message);
|
||||
// Timeout is set to avoid problems with the events being considered 'already fired'
|
||||
setTimeout(function () {
|
||||
$this.trigger("change.validation");
|
||||
}, 1); // doesn't need a long timeout, just long enough for the event bubble to burst
|
||||
}
|
||||
},
|
||||
failure: function () {
|
||||
validator.lastValid = true;
|
||||
validator.message = "ajax call failed";
|
||||
validator.lastFinished = true;
|
||||
$this.data("validation" + validator.validatorName + "Message", validator.message);
|
||||
// Timeout is set to avoid problems with the events being considered 'already fired'
|
||||
setTimeout(function () {
|
||||
$this.trigger("change.validation");
|
||||
}, 1); // doesn't need a long timeout, just long enough for the event bubble to burst
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
},
|
||||
regex: {
|
||||
name: "regex",
|
||||
init: function ($this, name) {
|
||||
return {regex: regexFromString($this.data("validation" + name + "Regex"))};
|
||||
},
|
||||
validate: function ($this, value, validator) {
|
||||
return (!validator.regex.test(value) && ! validator.negative)
|
||||
|| (validator.regex.test(value) && validator.negative);
|
||||
}
|
||||
},
|
||||
required: {
|
||||
name: "required",
|
||||
init: function ($this, name) {
|
||||
return {};
|
||||
},
|
||||
validate: function ($this, value, validator) {
|
||||
return !!(value.length === 0 && ! validator.negative)
|
||||
|| !!(value.length > 0 && validator.negative);
|
||||
},
|
||||
blockSubmit: true
|
||||
},
|
||||
match: {
|
||||
name: "match",
|
||||
init: function ($this, name) {
|
||||
var element = $this.parents("form").first().find("[name=\"" + $this.data("validation" + name + "Match") + "\"]").first();
|
||||
element.bind("validation.validation", function () {
|
||||
$this.trigger("change.validation", {submitting: true});
|
||||
});
|
||||
return {"element": element};
|
||||
},
|
||||
validate: function ($this, value, validator) {
|
||||
return (value !== validator.element.val() && ! validator.negative)
|
||||
|| (value === validator.element.val() && validator.negative);
|
||||
},
|
||||
blockSubmit: true
|
||||
},
|
||||
max: {
|
||||
name: "max",
|
||||
init: function ($this, name) {
|
||||
return {max: $this.data("validation" + name + "Max")};
|
||||
},
|
||||
validate: function ($this, value, validator) {
|
||||
return (parseFloat(value, 10) > parseFloat(validator.max, 10) && ! validator.negative)
|
||||
|| (parseFloat(value, 10) <= parseFloat(validator.max, 10) && validator.negative);
|
||||
}
|
||||
},
|
||||
min: {
|
||||
name: "min",
|
||||
init: function ($this, name) {
|
||||
return {min: $this.data("validation" + name + "Min")};
|
||||
},
|
||||
validate: function ($this, value, validator) {
|
||||
return (parseFloat(value) < parseFloat(validator.min) && ! validator.negative)
|
||||
|| (parseFloat(value) >= parseFloat(validator.min) && validator.negative);
|
||||
}
|
||||
},
|
||||
maxlength: {
|
||||
name: "maxlength",
|
||||
init: function ($this, name) {
|
||||
return {maxlength: $this.data("validation" + name + "Maxlength")};
|
||||
},
|
||||
validate: function ($this, value, validator) {
|
||||
return ((value.length > validator.maxlength) && ! validator.negative)
|
||||
|| ((value.length <= validator.maxlength) && validator.negative);
|
||||
}
|
||||
},
|
||||
minlength: {
|
||||
name: "minlength",
|
||||
init: function ($this, name) {
|
||||
return {minlength: $this.data("validation" + name + "Minlength")};
|
||||
},
|
||||
validate: function ($this, value, validator) {
|
||||
return ((value.length < validator.minlength) && ! validator.negative)
|
||||
|| ((value.length >= validator.minlength) && validator.negative);
|
||||
}
|
||||
},
|
||||
maxchecked: {
|
||||
name: "maxchecked",
|
||||
init: function ($this, name) {
|
||||
var elements = $this.parents("form").first().find("[name=\"" + $this.attr("name") + "\"]");
|
||||
elements.bind("click.validation", function () {
|
||||
$this.trigger("change.validation", {includeEmpty: true});
|
||||
});
|
||||
return {maxchecked: $this.data("validation" + name + "Maxchecked"), elements: elements};
|
||||
},
|
||||
validate: function ($this, value, validator) {
|
||||
return (validator.elements.filter(":checked").length > validator.maxchecked && ! validator.negative)
|
||||
|| (validator.elements.filter(":checked").length <= validator.maxchecked && validator.negative);
|
||||
},
|
||||
blockSubmit: true
|
||||
},
|
||||
minchecked: {
|
||||
name: "minchecked",
|
||||
init: function ($this, name) {
|
||||
var elements = $this.parents("form").first().find("[name=\"" + $this.attr("name") + "\"]");
|
||||
elements.bind("click.validation", function () {
|
||||
$this.trigger("change.validation", {includeEmpty: true});
|
||||
});
|
||||
return {minchecked: $this.data("validation" + name + "Minchecked"), elements: elements};
|
||||
},
|
||||
validate: function ($this, value, validator) {
|
||||
return (validator.elements.filter(":checked").length < validator.minchecked && ! validator.negative)
|
||||
|| (validator.elements.filter(":checked").length >= validator.minchecked && validator.negative);
|
||||
},
|
||||
blockSubmit: true
|
||||
}
|
||||
},
|
||||
builtInValidators: {
|
||||
email: {
|
||||
name: "Email",
|
||||
type: "shortcut",
|
||||
shortcut: "validemail"
|
||||
},
|
||||
validemail: {
|
||||
name: "Validemail",
|
||||
type: "regex",
|
||||
regex: "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\\.[A-Za-z]{2,4}",
|
||||
message: "Not a valid email address<!-- data-validator-validemail-message to override -->"
|
||||
},
|
||||
passwordagain: {
|
||||
name: "Passwordagain",
|
||||
type: "match",
|
||||
match: "password",
|
||||
message: "Does not match the given password<!-- data-validator-paswordagain-message to override -->"
|
||||
},
|
||||
positive: {
|
||||
name: "Positive",
|
||||
type: "shortcut",
|
||||
shortcut: "number,positivenumber"
|
||||
},
|
||||
negative: {
|
||||
name: "Negative",
|
||||
type: "shortcut",
|
||||
shortcut: "number,negativenumber"
|
||||
},
|
||||
number: {
|
||||
name: "Number",
|
||||
type: "regex",
|
||||
regex: "([+-]?\\\d+(\\\.\\\d*)?([eE][+-]?[0-9]+)?)?",
|
||||
message: "Must be a number<!-- data-validator-number-message to override -->"
|
||||
},
|
||||
integer: {
|
||||
name: "Integer",
|
||||
type: "regex",
|
||||
regex: "[+-]?\\\d+",
|
||||
message: "No decimal places allowed<!-- data-validator-integer-message to override -->"
|
||||
},
|
||||
positivenumber: {
|
||||
name: "Positivenumber",
|
||||
type: "min",
|
||||
min: 0,
|
||||
message: "Must be a positive number<!-- data-validator-positivenumber-message to override -->"
|
||||
},
|
||||
negativenumber: {
|
||||
name: "Negativenumber",
|
||||
type: "max",
|
||||
max: 0,
|
||||
message: "Must be a negative number<!-- data-validator-negativenumber-message to override -->"
|
||||
},
|
||||
required: {
|
||||
name: "Required",
|
||||
type: "required",
|
||||
message: "This is required<!-- data-validator-required-message to override -->"
|
||||
},
|
||||
checkone: {
|
||||
name: "Checkone",
|
||||
type: "minchecked",
|
||||
minchecked: 1,
|
||||
message: "Check at least one option<!-- data-validation-checkone-message to override -->"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var formatValidatorName = function (name) {
|
||||
return name
|
||||
.toLowerCase()
|
||||
.replace(
|
||||
/(^|\s)([a-z])/g ,
|
||||
function(m,p1,p2) {
|
||||
return p1+p2.toUpperCase();
|
||||
}
|
||||
)
|
||||
;
|
||||
};
|
||||
|
||||
var getValue = function ($this) {
|
||||
// Extract the value we're talking about
|
||||
var value = $this.val();
|
||||
var type = $this.attr("type");
|
||||
if (type === "checkbox") {
|
||||
value = ($this.is(":checked") ? value : "");
|
||||
}
|
||||
if (type === "radio") {
|
||||
value = ($('input[name="' + $this.attr("name") + '"]:checked').length > 0 ? value : "");
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
function regexFromString(inputstring) {
|
||||
return new RegExp("^" + inputstring + "$");
|
||||
}
|
||||
|
||||
/**
|
||||
* Thanks to Jason Bunting via StackOverflow.com
|
||||
*
|
||||
* http://stackoverflow.com/questions/359788/how-to-execute-a-javascript-function-when-i-have-its-name-as-a-string#answer-359910
|
||||
* Short link: http://tinyurl.com/executeFunctionByName
|
||||
**/
|
||||
function executeFunctionByName(functionName, context /*, args*/) {
|
||||
var args = Array.prototype.slice.call(arguments).splice(2);
|
||||
var namespaces = functionName.split(".");
|
||||
var func = namespaces.pop();
|
||||
for(var i = 0; i < namespaces.length; i++) {
|
||||
context = context[namespaces[i]];
|
||||
}
|
||||
return context[func].apply(this, args);
|
||||
}
|
||||
|
||||
$.fn.jqBootstrapValidation = function( method ) {
|
||||
|
||||
if ( defaults.methods[method] ) {
|
||||
return defaults.methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
|
||||
} else if ( typeof method === 'object' || ! method ) {
|
||||
return defaults.methods.init.apply( this, arguments );
|
||||
} else {
|
||||
$.error( 'Method ' + method + ' does not exist on jQuery.jqBootstrapValidation' );
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$.jqBootstrapValidation = function (options) {
|
||||
$(":input").not("[type=image],[type=submit]").jqBootstrapValidation.apply(this,arguments);
|
||||
};
|
||||
|
||||
})( jQuery );
|
87
resources/theme/backend/adminlte/a/setup.blade.php
Normal file
87
resources/theme/backend/adminlte/a/setup.blade.php
Normal file
@ -0,0 +1,87 @@
|
||||
@extends('adminlte::layouts.app')
|
||||
|
||||
@section('htmlheader_title')
|
||||
Setup
|
||||
@endsection
|
||||
|
||||
@section('contentheader_title')
|
||||
{{ $so->site_name }}
|
||||
@endsection
|
||||
@section('contentheader_description')
|
||||
Setup
|
||||
@endsection
|
||||
|
||||
@section('main-content')
|
||||
<div class="col-md-9">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Setup Configuration</h3>
|
||||
</div>
|
||||
|
||||
<form role="form" method="POST">
|
||||
{{ csrf_field() }}
|
||||
|
||||
@if(session()->has('success'))
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-md-offset-3">
|
||||
<div class="callout callout-success">
|
||||
<p>{{ session()->get('success') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if($errors->any())
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-md-offset-3">
|
||||
<div class="callout callout-danger">
|
||||
<p>Some validation errors to look at.</p>
|
||||
<ul>
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="nav-tabs-custom">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="#tab-site" data-toggle="tab">Site Details</a></li>
|
||||
<li><a href="#tab-other" data-toggle="tab">Other</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="box-body">
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tab-site">
|
||||
@include('a.widgets.setup_site_details')
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="tab-other">
|
||||
Other Details
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<button type="submit" class="btn btn-info">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('page-scripts')
|
||||
@js('/js/jqBootstrapValidation.js','jq-validation','jquery')
|
||||
<script>
|
||||
$(function () { $("input,select,textarea").not("[type=submit]").jqBootstrapValidation(); } );
|
||||
</script>
|
||||
<style>
|
||||
span.help-block > ul {
|
||||
color: #9d0000;
|
||||
padding-left: 5px;
|
||||
list-style-type: none;
|
||||
}
|
||||
</style>
|
||||
@append
|
@ -0,0 +1,61 @@
|
||||
<div class="form-group col-sm-12 {{ $errors->has('site_name') ? 'has-error' : '' }}">
|
||||
<label for="site_name">Site Name</label>
|
||||
<input type="text" class="form-control" id="site_name" name="site_name" placeholder="Site Name" value="{{ old('site_name',$so->site_name) }}">
|
||||
<span class="help-block">{{ $errors->first('site_name') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-12 {{ $errors->has('site_description') ? 'has-error' : '' }}">
|
||||
<label for="site_description">Site Description</label>
|
||||
<textarea class="form-control" id="site_description" name="site_description" placeholder="Site Description" rows="3">{{ old('site_description',$so->site_description) }}</textarea>
|
||||
<span class="help-block">{{ $errors->first('site_description') }}</span>
|
||||
</div>
|
||||
|
||||
<fieldset class="form-group col-sm-12">
|
||||
<label>Site Address</label>
|
||||
|
||||
<div class="form-group col-sm-12 {{ $errors->has('site_address1') ? 'has-error' : '' }}">
|
||||
<label for="site_address">Site Address Lines</label>
|
||||
<input type="text" class="form-control" id="site_address1" name="site_address1" placeholder="Address1" value="{{ old('site_address1',$so->site_address1) }}">
|
||||
<input type="text" class="form-control" id="site_address2" name="site_address2" placeholder="Address2" value="{{ old('site_address2',$so->site_address2) }}">
|
||||
<span class="help-block">{{ $errors->first('site_address1') }} {{ $errors->first('site_address2') }}</span>
|
||||
</div>
|
||||
<div class="form-group col-sm-6 {{ $errors->has('site_city') ? 'has-error' : '' }}">
|
||||
<label for="site_address">Site City</label>
|
||||
<input type="text" class="form-control" id="site_city" name="site_city" placeholder="City" value="{{ old('site_city',$so->site_city) }}">
|
||||
<span class="help-block">{{ $errors->first('site_city') }}</span>
|
||||
</div>
|
||||
<div class="form-group col-sm-3 {{ $errors->has('site_state') ? 'has-error' : '' }}">
|
||||
<label for="site_address">Site State</label>
|
||||
<input type="text" class="form-control col-sm-3" id="site_state" name="site_state" placeholder="State" value="{{ old('site_state',$so->site_state) }}">
|
||||
<span class="help-block">{{ $errors->first('site_state') }}</span>
|
||||
</div>
|
||||
<div class="form-group col-sm-3 {{ $errors->has('site_postcode') ? 'has-error' : '' }}">
|
||||
<label for="site_address">Site Post Code</label>
|
||||
<input type="text" class="form-control col-sm-3" id="site_postcode" name="site_postcode" placeholder="Post Code" value="{{ old('site_postcode',$so->site_postcode) }}">
|
||||
<span class="help-block">{{ $errors->first('site_postcode') }}</span>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div class="form-group col-sm-6 {{ $errors->has('site_phone') ? 'has-error' : '' }}">
|
||||
<label for="site_phone">Site Phone</label>
|
||||
<input class="form-control" id="site_phone" name="site_phone" placeholder="Site Phone" value="{{ old('site_phone',$so->site_phone) }}">
|
||||
<span class="help-block">{{ $errors->first('site_phone') }}</span>
|
||||
</div>
|
||||
<div class="form-group col-sm-6 {{ $errors->has('site_fax') ? 'has-error' : '' }}">
|
||||
<label for="site_fax">Site Fax</label>
|
||||
<input class="form-control" id="site_fax" name="site_fax" placeholder="Site Fax" value="{{ old('site_fax',$so->site_fax) }}">
|
||||
<span class="help-block">{{ $errors->first('site_fax') }}</span>
|
||||
</div>
|
||||
<div class="control-group form-group col-sm-6 {{ $errors->has('site_email') ? 'has-error' : '' }}">
|
||||
<label for="site_email">Site Email</label>
|
||||
<input type="email" class="form-control" id="site_email" name="site_email" placeholder="Site Email" value="{{ old('site_email',$so->site_email) }}">
|
||||
<span class="help-block">{{ $errors->first('site_email') }}</span>
|
||||
</div>
|
||||
<div class="control-group form-group col-sm-6 {{ $errors->has('site_tax') ? 'has-error' : '' }}">
|
||||
<label for="site_tax">Site Tax Number</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">ABN</span>
|
||||
<input type="number" class="form-control" id="site_tax" name="site_tax" minlength="10" maxlength="10" placeholder="Site Tax" value="{{ old('site_tax',$so->site_tax) }}">
|
||||
</div>
|
||||
<span class="help-block">{{ $errors->first('site_tax') }}</span>
|
||||
</div>
|
@ -12,14 +12,10 @@
|
||||
@endsection
|
||||
|
||||
@section('main-content')
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
@include('r.agents')
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
@include('r.accounts')
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
@include('r.agents')
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
@include('r.accounts')
|
||||
</div>
|
||||
@endsection
|
@ -49,4 +49,4 @@
|
||||
|
||||
</body>
|
||||
<!-- BODY End-->
|
||||
</html>
|
||||
</html>
|
@ -24,12 +24,11 @@
|
||||
<h2>Our Contacts</h2>
|
||||
<address class="margin-bottom-40">
|
||||
<table>
|
||||
<tr><th style="vertical-align:top; padding-right: 5px;">Address</th><td>{!! join('<br>',[$so->address['address1'],$so->address['address2'],sprintf('%s, %s %s',$so->address['city'],$so->address['state'],$so->address['postcode'])]) !!}</td></tr>
|
||||
<tr><th>Phone</th><td>{!! $so->phone !!}</tr>
|
||||
@if($so->fax)
|
||||
<tr><th>Fax</th><td>{!! $so->fax !!}</tr>
|
||||
<tr><th style="vertical-align:top; padding-right: 5px;">Address</th><td>{!! $so->address('html') !!}</td></tr>
|
||||
@if($so->site_fax)
|
||||
<tr><th>Fax</th><td>{{ $so->site_fax }}</tr>
|
||||
@endif
|
||||
<tr><th>Email</th><td> <a href="mailto:{!! $so->email !!}">{!! $so->email !!}</a></tr>
|
||||
<tr><th>Email</th><td> <a href="mailto:{{ $so->site_email }}">{{ $so->site_email }}</a></tr>
|
||||
</table>
|
||||
</address>
|
||||
<!--
|
||||
|
@ -1,6 +1,6 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{ config('app.name') }} - {{ $so->name }}</title>
|
||||
<title>{{ config('app.name') }} - {{ $so->site_name }}</title>
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
||||
|
||||
<!-- CSRF Token -->
|
||||
@ -9,7 +9,7 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
|
||||
<meta property="og:site_name" content="{{ config('app.name') }}" />
|
||||
<meta property="og:title" content="{{ $so->name }}" />
|
||||
<meta property="og:title" content="{{ $so->site_name }}" />
|
||||
<meta property="og:description" content="{{ $so->site_description }}" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:image" content="{{ $so->site_logo }}" />
|
||||
|
@ -5,8 +5,8 @@
|
||||
<!-- BEGIN TOP BAR LEFT PART -->
|
||||
<div class="col-md-6 col-sm-6 additional-shop-info">
|
||||
<ul class="list-unstyled list-inline">
|
||||
<li><i class="fa fa-phone"></i><span>{!! $so->phone !!}</span></li>
|
||||
<li><i class="fa fa-envelope-o"></i><span>{!! $so->email !!}</span></li>
|
||||
<li><i class="fa fa-phone"></i><span>{!! $so->site_phone !!}</span></li>
|
||||
<li><i class="fa fa-envelope-o"></i><span>{!! $so->site_email !!}</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- END TOP BAR LEFT PART -->
|
||||
@ -27,7 +27,7 @@
|
||||
<!-- BEGIN HEADER -->
|
||||
<div class="header">
|
||||
<div class="container">
|
||||
<a class="site-logo" href="{{ url('/') }}"><img src="{{ $so->logo_url() }}" alt="{{ config('app.name') }}" height="32"></a>
|
||||
<a class="site-logo" href="{{ url('/') }}"><img src="{{ $so->logo_url() }}" alt="{{ $so->site_description }}" height="32"></a>
|
||||
<a href="javascript:void(0);" class="mobi-toggler"><i class="fa fa-bars"></i></a>
|
||||
|
||||
<!-- BEGIN NAVIGATION -->
|
||||
|
@ -1,3 +1,5 @@
|
||||
{{-- This is not working unless site_slider is running. Might be a problem with the carousel --}}
|
||||
|
||||
<!-- BEGIN CLIENTS -->
|
||||
<div class="row margin-bottom-40 our-clients">
|
||||
<div class="col-md-3">
|
||||
@ -20,4 +22,17 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END CLIENTS -->
|
||||
<!-- END CLIENTS -->
|
||||
|
||||
@section('scripts')
|
||||
<!-- END SLIDER -->
|
||||
@css('/site/js/jquery/plugins/owl.carousel/2.0.0/css/owl.carousel.css')
|
||||
@css('/site/css/animate.css')
|
||||
@js('/site/js/jquery/plugins/owl.carousel/2.0.0/js/owl.carousel.min.js','jq-owl-carousel','jquery')
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
// Layout.initOWL();
|
||||
});
|
||||
</script>
|
||||
@append
|
@ -67,16 +67,16 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- END SLIDER -->
|
||||
@css('/site/js/jquery/plugins/owl.carousel/2.0.0/css/owl.carousel.css')
|
||||
@css('/site/css/animate.css')
|
||||
@js('/site/js/jquery/plugins/owl.carousel/2.0.0/js/owl.carousel.min.js','jq-owl-carousel','jquery')<!-- slider for products -->
|
||||
@js('/pages/js/bs-carousel.js','bs-carousel','jq-owl-carousel')
|
||||
|
||||
@section('scripts')
|
||||
<!-- END SLIDER -->
|
||||
@css('/site/js/jquery/plugins/owl.carousel/2.0.0/css/owl.carousel.css')
|
||||
@css('/site/css/animate.css')
|
||||
@js('/site/js/jquery/plugins/owl.carousel/2.0.0/js/owl.carousel.min.js','jq-owl-carousel','jquery')<!-- slider for products -->
|
||||
@js('/pages/js/bs-carousel.js','bs-carousel','jq-owl-carousel')
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
Layout.initOWL();
|
||||
});
|
||||
</script>
|
||||
@append
|
||||
@append
|
@ -19,7 +19,7 @@ Route::middleware('auth:api')->get('/user', function (Request $request) {
|
||||
});
|
||||
*/
|
||||
|
||||
Route::group(['middleware'=>['auth:api','reseller']], function() {
|
||||
Route::group(['middleware'=>['auth:api','role:reseller']], function() {
|
||||
Route::get('/r/agents','ResellerServicesController@agents');
|
||||
Route::get('/r/accounts','ResellerServicesController@accounts');
|
||||
});
|
||||
|
@ -11,27 +11,41 @@
|
||||
|
|
||||
*/
|
||||
|
||||
Route::get('/','WelcomeController@index');
|
||||
Auth::routes();
|
||||
Route::get('/logout','Auth\LoginController@logout');
|
||||
|
||||
// Generic Image Renderer - Render images that we dont have with a generic image
|
||||
Route::get('image/generic/{width}/{height}/{color}/{name?}','MediaController@image')->name('image');
|
||||
|
||||
Route::get('admin/switch/start/{id}','\Leenooks\Controllers\AdminController@user_switch_start')->name('switch.user.stop');
|
||||
Route::get('admin/switch/stop','\Leenooks\Controllers\AdminController@user_switch_stop')->name('switch.user.start');
|
||||
// Our Admin Routes
|
||||
Route::group(['middleware'=>['theme:adminlte-be','auth','role:wholesaler'],'prefix'=>'a'], function() {
|
||||
Route::get('setup','AdminHomeController@setup');
|
||||
Route::post('setup','AdminHomeController@setup_update');
|
||||
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::group(['middleware'=>['theme:adminlte-be']], function() {
|
||||
Auth::routes();
|
||||
Route::get('/logout','Auth\LoginController@logout');
|
||||
Route::get('/r/supplier/index', 'SuppliersController@index');
|
||||
Route::get('/r/supplier/create', 'SuppliersController@create');
|
||||
Route::post('/r/supplier/store', 'SuppliersController@store');
|
||||
Route::get('/home', 'UserHomeController@home');
|
||||
Route::get('accounting/connect', 'AccountingController@connect');
|
||||
});
|
||||
|
||||
// Our Reseller Routes
|
||||
Route::group(['middleware'=>['theme:adminlte-be','auth','role:reseller'],'prefix'=>'r'], function() {
|
||||
Route::get('supplier/index', 'SuppliersController@index');
|
||||
Route::get('supplier/create', 'SuppliersController@create');
|
||||
Route::post('supplier/store', 'SuppliersController@store');
|
||||
Route::get('home', 'UserHomeController@home');
|
||||
});
|
||||
|
||||
// Our User Routes
|
||||
Route::group(['middleware'=>['theme:adminlte-be','auth'],'prefix'=>'u'], function() {
|
||||
Route::get('home', 'UserHomeController@home');
|
||||
});
|
||||
|
||||
// Frontend Routes (Non-Authed Users)
|
||||
Route::group(['middleware'=>['theme:metronic-fe']], function() {
|
||||
Route::get('/', 'WelcomeController@index');
|
||||
});
|
||||
|
||||
Route::redirect('/home','/u/home');
|
||||
Route::demoAccess('/uc-access');
|
||||
Route::redirect('/under-construction','http://www.graytech.net.au');
|
||||
Route::get('/u/{type}/{action}/{id}','UserHomeController@oldsite');
|
Loading…
Reference in New Issue
Block a user