Changes to orders to stop existing services being submitted
This commit is contained in:
parent
7277d7407a
commit
4cbe990ec1
@ -21,21 +21,21 @@ class OrderController extends Controller
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('order');
|
||||
return view('order.home');
|
||||
}
|
||||
|
||||
public function product_order(Product $o)
|
||||
{
|
||||
Theme::set('metronic-fe');
|
||||
|
||||
return view('widgets.product_order',['o'=>$o]);
|
||||
return view('order.widget.order',['o'=>$o]);
|
||||
}
|
||||
|
||||
public function product_info(Product $o)
|
||||
{
|
||||
Theme::set('metronic-fe');
|
||||
|
||||
return view('widgets.product_description',['o'=>$o]);
|
||||
return view('order.widget.info',['o'=>$o]);
|
||||
}
|
||||
|
||||
public function submit(Request $request)
|
||||
|
@ -14,25 +14,25 @@ class PlanVoip extends Model
|
||||
'options.phonenumber'=>[
|
||||
'request'=>'options.phonenumber',
|
||||
'key'=>'service_number',
|
||||
'validation'=>'required|size:10',
|
||||
'validation'=>'nullable|size:10|unique:ab_service__voip,service_number',
|
||||
'validation_message'=>'Phone Number is a required field.',
|
||||
],
|
||||
'options.supplier'=>[
|
||||
'request'=>'options.supplier',
|
||||
'key'=>'order_info.supplier',
|
||||
'validation'=>'required|min:4',
|
||||
'validation'=>'required_with:options.phonenumber',
|
||||
'validation_message'=>'Phone Supplier is a required field.',
|
||||
],
|
||||
'options.supplieraccnum'=>[
|
||||
'request'=>'options.supplieraccnum',
|
||||
'key'=>'order_info.supplieraccnum',
|
||||
'validation'=>'required|min:4',
|
||||
'validation'=>'required_with:options.phonenumber',
|
||||
'validation_message'=>'Phone Supplier Account Number is a required field.',
|
||||
],
|
||||
'options.notes'=>[
|
||||
'request'=>'options.notes',
|
||||
'key'=>'order_info.notes',
|
||||
'validation'=>'present',
|
||||
'validation'=>'required_if:options.phonenumber,null',
|
||||
'validation_message'=>'Special Instructions here.',
|
||||
],
|
||||
];
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
namespace App\Traits;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
trait OrderServiceOptions
|
||||
@ -22,23 +23,18 @@ trait OrderServiceOptions
|
||||
protected $order_model = NULL;
|
||||
*/
|
||||
|
||||
public function orderValidation(Request $request)
|
||||
public function orderValidation(Request $request): ?Model
|
||||
{
|
||||
if (! isset($this->order_attributes))
|
||||
if ((! isset($this->order_attributes)) || (! isset($this->order_model)))
|
||||
return NULL;
|
||||
|
||||
$request->validate(collect($this->order_attributes)->pluck('validation','request')->toArray());
|
||||
|
||||
if (! isset($this->order_model))
|
||||
return NULL;
|
||||
$validate = $request->validate(collect($this->order_attributes)->pluck('validation','request')->toArray());
|
||||
|
||||
$o = new $this->order_model;
|
||||
|
||||
$x = [];
|
||||
foreach ($this->order_attributes as $k => $v)
|
||||
{
|
||||
$x[$v['key']] = $request->input($k);
|
||||
}
|
||||
|
||||
$o->forceFill(array_undot($x));
|
||||
|
||||
|
@ -29,12 +29,10 @@
|
||||
|
||||
<div id="accordion">
|
||||
<!-- Reseller Choose Client -->
|
||||
@if (Auth::user() AND Auth::user()->isReseller())
|
||||
@if ($user && $user->isReseller())
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
Account
|
||||
</h4>
|
||||
<h4 class="panel-title">Account</h4>
|
||||
</div>
|
||||
|
||||
<div class="panel-collapse">
|
||||
@ -43,12 +41,8 @@
|
||||
|
||||
<div class="col-6">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active">
|
||||
<a href="#account_exist" data-toggle="tab">Existing Account</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#client_new" data-toggle="tab">New Client</a>
|
||||
</li>
|
||||
<li class="active"><a href="#account_exist" data-toggle="tab">Existing Account</a></li>
|
||||
<li><a href="#client_new" data-toggle="tab">New Client</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
@ -77,7 +71,6 @@
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-2"><button class="btn btn-block btn-primary">Previous</button></div>
|
||||
<div class="col-sm-2"><button class="btn btn-block btn-primary next">Next</button></div>
|
||||
</div>
|
||||
</div>
|
||||
@ -85,7 +78,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Non-Authed User -->
|
||||
@elseif (Auth::user())
|
||||
@elseif ($user)
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
@ -142,9 +135,6 @@
|
||||
|
||||
<!-- Non-Authed User -->
|
||||
@else
|
||||
@php
|
||||
//dd($errors);
|
||||
@endphp
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
@ -181,44 +171,48 @@
|
||||
|
||||
<div class="panel-collapse margin-bottom-20">
|
||||
<div class="panel-body">
|
||||
<div class="col-12">
|
||||
<div class="control-group form-group col-sm-12 {{ $errors->has('product_options') ? 'has-error' : '' }}">
|
||||
<span class="help-block">{{ $errors->first('product_options') }}</span>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="control-group form-group {{ $errors->has('product_options') ? 'has-error' : '' }}">
|
||||
<span class="help-block">{{ $errors->first('product_options') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group form-group {{ $errors->has('product_id') ? 'has-error' : '' }}">
|
||||
<label for="product_id">Product</label>
|
||||
<select class="form-control" id="product_id" name="product_id">
|
||||
<option value=""> </option>
|
||||
@php
|
||||
$po = $selected = NULL;
|
||||
@endphp
|
||||
@foreach (\App\Models\Product::active()->get()->sortBy('name') as $o)
|
||||
@php
|
||||
if ($o->id == old('product_id')) {
|
||||
$selected = 'selected';
|
||||
$po = $o;
|
||||
} else {
|
||||
$selected = NULL;
|
||||
}
|
||||
@endphp
|
||||
<option value="{{ $o->id }}" {{ $selected }}>{{ $o->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span class="help-block">{{ $errors->first('product_id') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group form-group col-sm-6 {{ $errors->has('product_id') ? 'has-error' : '' }}">
|
||||
<label for="product_id">Product</label>
|
||||
<select class="form-control" id="product_id" name="product_id">
|
||||
<option value=""> </option>
|
||||
@php
|
||||
$po = $selected = NULL;
|
||||
@endphp
|
||||
@foreach (\App\Models\Product::active()->get()->sortBy('name') as $o)
|
||||
@php
|
||||
if ($o->id == old('product_id'))
|
||||
{
|
||||
$selected = 'selected';
|
||||
$po = $o;
|
||||
} else {
|
||||
$selected = NULL;
|
||||
}
|
||||
@endphp
|
||||
<option value="{{ $o->id }}" {{ $selected }}>{{ $o->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span class="help-block">{{ $errors->first('product_id') }}</span>
|
||||
</div>
|
||||
<div class="col-sm-6" id="product_info">
|
||||
@if (old('product_id'))
|
||||
@include('widgets.product_description',['o'=>$po])
|
||||
@include('order.widget.info',['o'=>$po])
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12" id="product_order">
|
||||
@if (old('product_id'))
|
||||
@include('widgets.product_order',['o'=>$po])
|
||||
@endif
|
||||
<div class="row">
|
||||
<div class="col-sm-12" id="product_order">
|
||||
@if (old('product_id'))
|
||||
@include('order.widget.order',['o'=>$po])
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
@ -241,7 +235,9 @@
|
||||
<div class="col-12">
|
||||
<div class="control-group form-group col-sm-12 {{ $errors->has('options.notes') ? 'has-error' : '' }}">
|
||||
<label for="options.notes">Notes</label>
|
||||
<textarea name="options[notes]" class="form-control" rows="4" placeholder="Enter any special instructions...">{{ old('options.notes') }}</textarea>
|
||||
<textarea name="options[notes]" class="form-control" rows="4" placeholder="Enter any special instructions...
|
||||
For new ADSL/VOIP services please include the physical address for the requested service.
|
||||
DO NOT request making changes to an active service here, it will not be processed.">{{ old('options.notes') }}</textarea>
|
||||
<span class="help-block">{{ $errors->first('options.notes') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -252,15 +248,11 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="tab-2">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,11 @@
|
||||
@if(View::exists('order.widget.info.'.$o->category))
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
{{-- Return Category Requirements --}}
|
||||
@include('order.widget.info.'.$o->category)
|
||||
|
||||
{{-- Return Supplier Requirements --}}
|
||||
{{-- Return Product Requirements --}}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
@ -0,0 +1,16 @@
|
||||
@if(View::exists('order.widget.order.'.$o->category))
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Order Configuration</h3>
|
||||
</div>
|
||||
|
||||
<div class="box-body">
|
||||
{{-- Return Category Requirements --}}
|
||||
@include('order.widget.order.'.$o->category)
|
||||
|
||||
{{-- Return Supplier Requirements --}}
|
||||
{{-- Return Product Requirements --}}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@endif
|
@ -1,13 +0,0 @@
|
||||
@if(View::exists('widgets.product.'.$o->category))
|
||||
<div class="col-md-12">
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
{{-- Return Category Requirements --}}
|
||||
@include('widgets.product.'.$o->category)
|
||||
|
||||
{{-- Return Supplier Requirements --}}
|
||||
{{-- Return Product Requirements --}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
@ -1,18 +0,0 @@
|
||||
@if(View::exists('widgets.order.'.$o->category))
|
||||
<div class="col-md-12">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Order Configuration</h3>
|
||||
</div>
|
||||
|
||||
<div class="box-body">
|
||||
{{-- Return Category Requirements --}}
|
||||
@include('widgets.order.'.$o->category)
|
||||
|
||||
{{-- Return Supplier Requirements --}}
|
||||
{{-- Return Product Requirements --}}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
Loading…
Reference in New Issue
Block a user