Fixes for ordering, the themes are in frontend.metronic, not backend.adminlte
This commit is contained in:
parent
b4c7c3ad20
commit
5f66987a3e
@ -9,40 +9,36 @@ use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use App\Mail\OrderRequest;
|
||||
use App\Models\{Account,Product,Service,User};
|
||||
use App\Models\{Account,Product,Rtm,Service,User};
|
||||
|
||||
class OrderController extends Controller
|
||||
{
|
||||
// @todo To check
|
||||
public function product_order(Product $o)
|
||||
{
|
||||
return view('theme.backend.adminlte.order.widget.order')
|
||||
->with('o',$o);
|
||||
}
|
||||
|
||||
// @todo To check
|
||||
public function product_info(Product $o)
|
||||
{
|
||||
return view('theme.backend.adminlte.order.widget.info')
|
||||
->with('o',$o);
|
||||
}
|
||||
|
||||
// @todo To check
|
||||
public function submit(Request $request)
|
||||
{
|
||||
Validator::make($request->all(),['product_id'=>'required|exists:products,id'])
|
||||
Validator::make($request->all(),
|
||||
[
|
||||
'product_id'=>'required|exists:products,id'
|
||||
]
|
||||
)
|
||||
// Reseller
|
||||
->sometimes('account_id','required|email',function($input) use ($request) {
|
||||
return is_null($input->account_id) AND is_null($input->order_email_manual);
|
||||
})
|
||||
->sometimes(
|
||||
'account_id',
|
||||
'required|email',
|
||||
fn($input)=>is_null($input->account_id) && is_null($input->order_email_manual)
|
||||
)
|
||||
// Un-Authed User
|
||||
->sometimes('order_email_manual','required|email|unique:users,email,NULL,id',function($input) use ($request) {
|
||||
return (is_null($input->order_email_manual) AND ! isset($input->account_id)) OR $input->order_email_manual;
|
||||
})
|
||||
->sometimes(
|
||||
'order_email_manual',
|
||||
'required|email|unique:users,email,NULL,id',
|
||||
fn($input)=>(is_null($input->order_email_manual) && (! isset($input->account_id))) || $input->order_email_manual
|
||||
)
|
||||
// Authed User
|
||||
->sometimes('account_id','required|email',function($input) use ($request) {
|
||||
return is_null($input->account_id) AND ! isset($input->order_email_manual);
|
||||
})
|
||||
->sometimes(
|
||||
'account_id',
|
||||
'required|email',
|
||||
fn($input)=>is_null($input->account_id) && (! isset($input->order_email_manual))
|
||||
)
|
||||
->validate();
|
||||
|
||||
// Check the plugin details.
|
||||
@ -72,7 +68,6 @@ class OrderController extends Controller
|
||||
// If we have a new account.
|
||||
if (is_null($request->input('account_id'))) {
|
||||
$ao = new Account;
|
||||
//$ao->id = Account::NextId();
|
||||
// @todo Make this automatic
|
||||
$ao->site_id = config('site')->site_id;
|
||||
$ao->country_id = config('site')->country_id; // @todo This might be wrong
|
||||
@ -107,11 +102,12 @@ class OrderController extends Controller
|
||||
$order->save();
|
||||
}
|
||||
|
||||
// @todo Move this email to a config item
|
||||
Mail::to('help@graytech.net.au')
|
||||
$ro = Rtm::where('parent_id',NULL)->sole();
|
||||
|
||||
Mail::to($ro->owner->email)
|
||||
->queue((new OrderRequest($so,$request->input('options.notes') ?: ''))->onQueue('email')); //@todo Get email from DB.
|
||||
|
||||
return view('theme.backend.adminlte.order_received')
|
||||
return view('theme.frontend.metronic.order_received')
|
||||
->with('o',$so);
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@ use Leenooks\Casts\LeenooksCarbon;
|
||||
|
||||
use App\Models\Product\Type;
|
||||
use App\Interfaces\IDs;
|
||||
use App\Traits\{ScopeAccountUserAuthorised,ScopeServiceActive};
|
||||
use App\Traits\{ScopeAccountUserAuthorised,ScopeServiceActive,SiteID};
|
||||
|
||||
/**
|
||||
* Class Service
|
||||
@ -52,7 +52,7 @@ use App\Traits\{ScopeAccountUserAuthorised,ScopeServiceActive};
|
||||
*/
|
||||
class Service extends Model implements IDs
|
||||
{
|
||||
use HasFactory,ScopeAccountUserAuthorised,ScopeServiceActive;
|
||||
use HasFactory,ScopeAccountUserAuthorised,ScopeServiceActive,SiteID;
|
||||
|
||||
protected $casts = [
|
||||
'order_info' => AsCollection::class,
|
||||
|
@ -1,115 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Root path where theme Views will be located.
|
||||
| Can be outside default views path e.g.: resources/themes
|
||||
| Leave it null if you will put your themes in the default views folder
|
||||
| (as defined in config\views.php)
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
'themes_path' => realpath(base_path('resources/views/theme')), // eg: base_path('resources/themes')
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Set behavior if an asset is not found in a Theme hierarchy.
|
||||
| Available options: THROW_EXCEPTION | LOG_ERROR | IGNORE
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
'asset_not_found' => 'THROW_EXCEPTION',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Do we want a theme activated by default? Can be set at runtime with:
|
||||
| Theme::set('theme-name');
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
'default' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache theme.json configuration files that are located in each theme's folder
|
||||
| in order to avoid searching theme settings in the filesystem for each request
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
'cache' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Define available themes. Format:
|
||||
|
|
||||
| 'theme-name' => [
|
||||
| 'extends' => 'theme-to-extend', // optional
|
||||
| 'views-path' => 'path-to-views', // defaults to: resources/views/theme-name
|
||||
| 'asset-path' => 'path-to-assets', // defaults to: public/theme-name
|
||||
|
|
||||
| // You can add your own custom keys
|
||||
| // Use Theme::getSetting('key') & Theme::setSetting('key', 'value') to access them
|
||||
| 'key' => 'value',
|
||||
| ],
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
'themes' => [
|
||||
|
||||
// Add your themes here. These settings will overide theme.json settings defined for each theme
|
||||
|
||||
/*
|
||||
|---------------------------[ Example Structure ]--------------------------
|
||||
|
|
||||
| // Full theme Syntax:
|
||||
|
|
||||
| 'example1' => [
|
||||
| 'extends' => null, // doesn't extend any theme
|
||||
| 'views-path' => example, // = resources/views/example_theme
|
||||
| 'asset-path' => example, // = public/example_theme
|
||||
| ],
|
||||
|
|
||||
| // Use all Defaults:
|
||||
|
|
||||
| 'example2', // Assets =\public\example2, Views =\resources\views\example2
|
||||
| // Note that if you use all default values, you can ommit decleration completely.
|
||||
| // i.e. defaults will be used when you call Theme::set('undefined-theme')
|
||||
|
|
||||
|
|
||||
| // This theme shares the views with example2 but defines its own assets in \public\example3
|
||||
|
|
||||
| 'example3' => [
|
||||
| 'views-path' => 'example',
|
||||
| ],
|
||||
|
|
||||
| // This theme extends example1 and may override SOME views\assets in its own paths
|
||||
|
|
||||
| 'example4' => [
|
||||
| 'extends' => 'example1',
|
||||
| ],
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
'metronic-fe' => [
|
||||
'extends' => null,
|
||||
'views-path' => 'frontend/metronic',
|
||||
'asset-path' => 'theme/frontend/metronic',
|
||||
],
|
||||
|
||||
'metronic-be' => [
|
||||
'extends' => null,
|
||||
'views-path' => 'backend/metronic',
|
||||
'asset-path' => 'theme/backend/metronic',
|
||||
],
|
||||
|
||||
'adminlte-be' => [
|
||||
'extends' => null,
|
||||
'views-path' => 'backend/adminlte',
|
||||
'asset-path' => 'theme/backend/adminlte',
|
||||
],
|
||||
],
|
||||
];
|
@ -1,3 +1,5 @@
|
||||
@use(App\Models\Product)
|
||||
|
||||
@extends('metronic::layouts.app')
|
||||
|
||||
@section('htmlheader_title')
|
||||
@ -184,13 +186,13 @@
|
||||
<select class="form-control" id="product_id" name="product_id">
|
||||
<option value=""> </option>
|
||||
@php
|
||||
$po = $selected = NULL;
|
||||
$pdo = $selected = NULL;
|
||||
@endphp
|
||||
@foreach (\App\Models\Product::active()->get()->sortBy('name') as $o)
|
||||
@foreach (Product::active()->get()->sortBy('name') as $o)
|
||||
@php
|
||||
if ($o->id == old('product_id')) {
|
||||
$selected = 'selected';
|
||||
$po = $o;
|
||||
$pdo = $o;
|
||||
} else {
|
||||
$selected = NULL;
|
||||
}
|
||||
@ -204,7 +206,7 @@
|
||||
|
||||
<div class="col-sm-6" id="product_info">
|
||||
@if(old('product_id'))
|
||||
@include('theme.frontend.metronic.order.widget.info',['o'=>$po])
|
||||
@include('theme.frontend.metronic.order.widget.info',['pdo'=>$pdo])
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@ -212,7 +214,7 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-12" id="product_order">
|
||||
@if(old('product_id'))
|
||||
@include('theme.frontend.metronic.order.widget.order',['o'=>$po])
|
||||
@include('theme.frontend.metronic.order.widget.order',['pdo'=>$pdo])
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,9 +1,9 @@
|
||||
<!-- $o = Product::class [{{$o->category}}]-->
|
||||
@if(View::exists('order.widget.info.'.$o->category))
|
||||
<!-- $pdo=Product::class [{{$pdo->category}}]-->
|
||||
@if(View::exists('theme.frontend.metronic.order.widget.info.'.$pdo->category))
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
{{-- Return Category Requirements --}}
|
||||
@include('theme.frontend.metronic.order.widget.info.'.$o->category)
|
||||
@include('theme.frontend.metronic.order.widget.info.'.$pdo->category)
|
||||
|
||||
{{-- Return Supplier Requirements --}}
|
||||
{{-- Return Product Requirements --}}
|
||||
|
@ -1,37 +1,37 @@
|
||||
<!-- $o = Product::class -->
|
||||
<!-- $pdo=Product::class -->
|
||||
<div class="col-md-12">
|
||||
<p>{!! $o->name !!}</p>
|
||||
<p>{!! $pdo->name !!}</p>
|
||||
</div>
|
||||
|
||||
<table class="table table-condensed">
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<td class="text-right">{{ $o->category_name }}</td>
|
||||
<td class="text-right">{{ $pdo->category_name }}</td>
|
||||
</tr>
|
||||
@if ($o->setup_charge)
|
||||
@if ($pdo->setup_charge)
|
||||
<tr>
|
||||
<th>Setup Charges <sup>*</sup></th>
|
||||
{{-- @todo this should use account::taxed() when the user is known --}}
|
||||
<td class="text-right">${{ number_format($user->exists ? Config::get('site')->taxed($o->setup_charge) : Config::get('site')->taxed($o->setup_charge),2) }}</td>
|
||||
<td class="text-right">${{ number_format($user->exists ? Config::get('site')->taxed($pdo->setup_charge) : Config::get('site')->taxed($pdo->setup_charge),2) }}</td>
|
||||
</tr>
|
||||
@endif
|
||||
<tr>
|
||||
<th>Cost <sup>+</sup></th>
|
||||
{{-- @todo this should use account::taxed() when the user is known --}}
|
||||
<td class="text-right">${{ number_format($user->exists ? Config::get('site')->taxed($o->base_charge) : Config::get('site')->taxed($o->base_charge),2) }}</td>
|
||||
<td class="text-right">${{ number_format($user->exists ? Config::get('site')->taxed($pdo->base_charge) : Config::get('site')->taxed($pdo->base_charge),2) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Default Billing</th>
|
||||
<td class="text-right">{{ $o->billing_interval_string }}</td>
|
||||
<td class="text-right">{{ $pdo->billing_interval_string }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Contract Term</th>
|
||||
<td class="text-right">{{ $o->contract_term }} mths</td>
|
||||
<td class="text-right">{{ $pdo->contract_term }} mths</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Minimum Costs <sup>+*</sup></th>
|
||||
{{-- @todo this should use account::taxed() when the user is known --}}
|
||||
<td class="text-right">${{ number_format($user->exists ? Config::get('site')->taxed($o->min_charge) : Config::get('site')->taxed($o->min_charge),2) }}</td>
|
||||
<td class="text-right">${{ number_format($user->exists ? Config::get('site')->taxed($pdo->min_charge) : Config::get('site')->taxed($pdo->min_charge),2) }}</td>
|
||||
</tr>
|
||||
|
||||
<tfoot>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!-- $o = Product::class -->
|
||||
<!-- $pdo=Product::class -->
|
||||
@include('theme.frontend.metronic.order.widget.info.base',['footer'=>'
|
||||
<sup>
|
||||
* Additional setup charges may apply for complex installations.<br>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!-- $o = Product::class -->
|
||||
<!-- $pdo=Product::class -->
|
||||
@include('theme.frontend.metronic.order.widget.info.base',['footer'=>'
|
||||
<sup>
|
||||
* Depends on domain availability.<br>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!-- $o = Product::class -->
|
||||
<!-- $pdo=Product::class -->
|
||||
@include('theme.frontend.metronic.order.widget.info.base',['footer'=>'
|
||||
<sup>
|
||||
* Depends on domain availability.<br>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!-- $o = Product::class -->
|
||||
<!-- $pdo=Product::class -->
|
||||
@include('theme.frontend.metronic.order.widget.info.base',['footer'=>'
|
||||
<sup>
|
||||
* Depends on domain availability.<br>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!-- $o = Product::class -->
|
||||
<!-- $pdo=Product::class -->
|
||||
@include('theme.frontend.metronic.order.widget.info.base',['footer'=>'
|
||||
<sup>
|
||||
* Depends on complex porting.<br>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!-- $o = Product::class [{{$o->category}}] -->
|
||||
@if(View::exists('order.widget.order.'.$o->category))
|
||||
<!-- $pdo=Product::class [{{$pdo->category}}] -->
|
||||
@if(View::exists('theme.frontend.metronic.order.widget.order.'.$pdo->category))
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Order Configuration</h3>
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
<div class="box-body">
|
||||
{{-- Return Category Requirements --}}
|
||||
@include('theme.frontend.metronic.order.widget.order.'.$o->category)
|
||||
@include('theme.frontend.metronic.order.widget.order.'.$pdo->category)
|
||||
|
||||
{{-- Return Supplier Requirements --}}
|
||||
{{-- Return Product Requirements --}}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<fieldset class="form-group col-sm-12">
|
||||
<label>ADSL</label>
|
||||
<label>BROADBAND</label>
|
||||
|
||||
<div class="form-group col-sm-12 {{ $errors->has('options.address') ? 'has-error' : '' }}">
|
||||
<label for="options.address">Site Address</label>
|
||||
|
@ -1,3 +1,5 @@
|
||||
@use(App\Models\TLD)
|
||||
|
||||
<fieldset class="form-group">
|
||||
<label class="col-md-12">DOMAIN</label>
|
||||
|
||||
@ -10,8 +12,8 @@
|
||||
<div class="form-group col-sm-6 {{ $errors->has('options.tld_id') ? 'has-error' : '' }}">
|
||||
<label for="options.tld_id">Domain TLD</label>
|
||||
<select style="width:25%;" class="form-control @error('options.tld_id') is-invalid @enderror" id="options.tld_id" name="options[tld_id]">
|
||||
@foreach(\App\Models\TLD::orderBy('name')->get() as $oo)
|
||||
<option value="{{ $oo->id }}" @if($oo->id == old('options.tld_id',$o->tld_id))selected @endif>{{ $oo->name }}</option>
|
||||
@foreach(TLD::orderBy('name')->get() as $oo)
|
||||
<option value="{{ $oo->id }}" @selected($oo->id == old('options.tld_id',$pdo->tld_id))>{{ $oo->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span class="help-block">{{ $errors->first('options.tld') }}</span>
|
||||
|
@ -223,5 +223,5 @@ Route::group(['prefix'=>'u'],function() {
|
||||
Route::view('order','theme.frontend.metronic.order.home');
|
||||
Route::post('order',[OrderController::class,'submit']);
|
||||
|
||||
Route::get('product_order/{o}',[OrderController::class,'product_order']);
|
||||
Route::get('product_info/{o}',[OrderController::class,'product_info']);
|
||||
Route::view('product_order/{pdo}','theme.frontend.metronic.order.widget.order');
|
||||
Route::view('product_info/{pdo}','theme.frontend.metronic.order.widget.info');
|
Loading…
Reference in New Issue
Block a user