Fixed recording of orders and order notes

This commit is contained in:
Deon George 2019-06-17 13:17:58 +10:00
parent 4c5c43c390
commit 3ff82f5f10
No known key found for this signature in database
GPG Key ID: 7670E8DC27415254
7 changed files with 30 additions and 21 deletions

View File

@ -53,7 +53,6 @@ class OrderController extends Controller
}) })
->validate(); ->validate();
// Check the plugin details. // Check the plugin details.
$po = Product::findOrFail($request->input('product_id')); $po = Product::findOrFail($request->input('product_id'));
@ -103,6 +102,7 @@ class OrderController extends Controller
$so->product_id = $request->input('product_id'); $so->product_id = $request->input('product_id');
$so->order_status = 'ORDER-SUBMIT'; $so->order_status = 'ORDER-SUBMIT';
$so->orderby_id = Auth::id(); $so->orderby_id = Auth::id();
$so->model = get_class($options);
if ($options->order_info) if ($options->order_info)
{ {
@ -117,7 +117,7 @@ class OrderController extends Controller
$options->save(); $options->save();
} }
Mail::to('deon@graytech.net.au')->queue((new OrderRequest($so))->onQueue('email')); //@todo Get email from DB. Mail::to('help@graytech.net.au')->queue((new OrderRequest($so,$request->input('options.notes')))->onQueue('email')); //@todo Get email from DB.
return view('order_received',['o'=>$so]); return view('order_received',['o'=>$so]);
} }
} }

View File

@ -19,6 +19,12 @@ class AdslPlan extends Model
'validation'=>'required|string:10', 'validation'=>'required|string:10',
'validation_message'=>'Address is a required field.', 'validation_message'=>'Address is a required field.',
], ],
'options.notes'=>[
'request'=>'options.notes',
'key'=>'order_info.notes',
'validation'=>'present',
'validation_message'=>'Special Instructions here.',
],
]; ];
protected $order_model = Service\Adsl::class; protected $order_model = Service\Adsl::class;

View File

@ -14,7 +14,7 @@ class PlanVoip extends Model
'options.phonenumber'=>[ 'options.phonenumber'=>[
'request'=>'options.phonenumber', 'request'=>'options.phonenumber',
'key'=>'service_number', 'key'=>'service_number',
'validation'=>'required|min:10', 'validation'=>'required|size:10',
'validation_message'=>'Phone Number is a required field.', 'validation_message'=>'Phone Number is a required field.',
], ],
'options.supplier'=>[ 'options.supplier'=>[
@ -29,6 +29,12 @@ class PlanVoip extends Model
'validation'=>'required|min:4', 'validation'=>'required|min:4',
'validation_message'=>'Phone Supplier Account Number is a required field.', 'validation_message'=>'Phone Supplier Account Number is a required field.',
], ],
'options.notes'=>[
'request'=>'options.notes',
'key'=>'order_info.notes',
'validation'=>'present',
'validation_message'=>'Special Instructions here.',
],
]; ];
protected $order_model = Service\Voip::class; protected $order_model = Service\Voip::class;

View File

@ -180,6 +180,7 @@ class Service extends Model
{ {
return $this->model ? $this->type->name : NULL; return $this->model ? $this->type->name : NULL;
} }
/** /**
* Return the date for the next invoice * Return the date for the next invoice
* *

6
composer.lock generated
View File

@ -2357,11 +2357,11 @@
}, },
{ {
"name": "leenooks/laravel", "name": "leenooks/laravel",
"version": "0.3.8", "version": "0.3.9",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://dev.leenooks.net/leenooks/laravel", "url": "https://dev.leenooks.net/leenooks/laravel",
"reference": "70a714287706fbde3f2043315f939a8e98e2d9c4" "reference": "6d876f2c946f5b182e4efe6c8f89038385818ea1"
}, },
"require": { "require": {
"acacha/user": "^0.2.2", "acacha/user": "^0.2.2",
@ -2399,7 +2399,7 @@
"laravel", "laravel",
"leenooks" "leenooks"
], ],
"time": "2019-05-16T01:15:49+00:00" "time": "2019-06-17T01:44:56+00:00"
}, },
{ {
"name": "maximebf/debugbar", "name": "maximebf/debugbar",

View File

@ -55,8 +55,8 @@
<label for="account_id">Client Account</label> <label for="account_id">Client Account</label>
<select class="form-control" id="account_id" name="account_id"> <select class="form-control" id="account_id" name="account_id">
<option value="">&nbsp;</option> <option value="">&nbsp;</option>
@foreach ($user->all_accounts()->sortBy('company') as $o) @foreach ($user->all_accounts()->sortBy('name') as $o)
<option value="{{ $o->id }}" @if($o->id == old('account_id')) selected @endif>{{ $o->company }}</option> <option value="{{ $o->id }}" @if($o->id == old('account_id')) selected @endif>{{ $o->name }}</option>
@endforeach @endforeach
</select> </select>
<span class="help-block">{{ $errors->first('account_id') }}</span> <span class="help-block">{{ $errors->first('account_id') }}</span>
@ -111,8 +111,8 @@
<label for="account_id">Existing Account</label> <label for="account_id">Existing Account</label>
<select class="form-control" id="account_id" name="account_id"> <select class="form-control" id="account_id" name="account_id">
<option value="">&nbsp;</option> <option value="">&nbsp;</option>
@foreach ($user->accounts->sortBy('company') as $o) @foreach ($user->accounts->sortBy('name') as $o)
<option value="{{ $o->id }}" @if($o->id == old('account_id')) selected @endif>{{ $o->company }}</option> <option value="{{ $o->id }}" @if($o->id == old('account_id')) selected @endif>{{ $o->name }}</option>
@endforeach @endforeach
</select> </select>
<span class="help-block">{{ $errors->first('account_id') }}</span> <span class="help-block">{{ $errors->first('account_id') }}</span>
@ -237,14 +237,10 @@
<div class="panel-collapse margin-bottom-20"> <div class="panel-collapse margin-bottom-20">
<div class="panel-body"> <div class="panel-body">
<div class="col-md-12"> <div class="col-md-12">
<div class="control-group form-group col-sm-12 {{ $errors->has('order_notes') ? 'has-error' : '' }}"> <div class="control-group form-group col-sm-12 {{ $errors->has('options.notes') ? 'has-error' : '' }}">
<span class="help-block">{{ $errors->first('product_options') }}</span> <label for="options.notes">Notes</label>
</div> <textarea name="options[notes]" class="form-control" rows="4" placeholder="Enter any special instructions...">{{ old('options.notes') }}</textarea>
<span class="help-block">{{ $errors->first('options.notes') }}</span>
<div class="control-group form-group col-sm-12 {{ $errors->has('order_notes') ? 'has-error' : '' }}">
<label for="order_notes">Notes</label>
<textarea name="order_notes" class="form-control" rows="4" placeholder="Enter any special instructions...">{{ old('order_notes') }}</textarea>
<span class="help-block">{{ $errors->first('order_notes') }}</span>
</div> </div>
</div> </div>

View File

@ -9,12 +9,12 @@
| Account | {{ $service->account_name }} ({!! $service->account->account_id_url !!}) | | Account | {{ $service->account_name }} ({!! $service->account->account_id_url !!}) |
| Service ID | {!! $service->service_id_url !!} | | Service ID | {!! $service->service_id_url !!} |
| Product | {{ $service->product_name }} | | Product | {{ $service->product_name }} |
@switch($service->category) @switch($service->product_category)
@case('ADSL') @case('ADSL')
| Address | {{ $service->service_adsl->service_address }} | | Address | {{ $service->type->service_address }} |
@break; @break;
@case('VOIP') @case('VOIP')
| Address | {{ $service->service_voip->service_address }} | | Number | {{ $service->type->service_number }} |
| Supplier Details | {{ join(':',$service->order_info) }} | | Supplier Details | {{ join(':',$service->order_info) }} |
@break; @break;
@endswitch @endswitch