Fixes for ordering, the themes are in frontend.metronic, not backend.adminlte
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user