More work on ordering

This commit is contained in:
Deon George
2018-08-11 15:09:41 +10:00
parent 499d44289e
commit 5373e6b246
33 changed files with 730 additions and 163 deletions

View File

@@ -65,30 +65,30 @@
<div class="col-md-6">
<ul class="nav nav-tabs">
<li class="active">
<li>
<a href="#tab_1" data-toggle="tab">New Client</a>
</li>
<li>
<li class="active">
<a href="#tab_2" data-toggle="tab">Existing Client</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane row fade in active" id="tab_1">
<div class="control-group form-group col-sm-12 {{ $errors->has('order_email') ? 'has-error' : '' }}">
<label for="order_email">New Client Email</label>
<input type="email" class="form-control" id="order_email" name="order_email" placeholder="New Client Email" value="{{ old('order_email') }}">
<span class="help-block">{{ $errors->first('order_email') }}</span>
<div class="tab-pane row fade" id="tab_1">
<div class="control-group form-group col-sm-12 {{ $errors->has('order_email_manual') ? 'has-error' : '' }}">
<label for="order_email_manual">New Client Email</label>
<input type="email" class="form-control" id="order_email_manual" name="order_email_manual" placeholder="New Client Email" value="{{ old('order_email_manual') }}">
<span class="help-block">{{ $errors->first('order_email_manual') }}</span>
</div>
</div>
<div class="tab-pane row fade" id="tab_2">
<div class="tab-pane row fade in active" id="tab_2">
<div class="control-group form-group col-sm-12 {{ $errors->has('order_email') ? 'has-error' : '' }}">
<label for="order_email">Client Account</label>
<select class="form-control" id="order_email" name="order_email" value="{{ old('order_email') }}">
<select class="form-control" id="order_email" name="order_email">
<option value="">&nbsp;</option>
@foreach ($user->all_clients()->sortBy('sur_first_name') as $o)
<option value="{{ $o->email }}">{{ $o->sur_first_name }}</option>
<option value="{{ $o->email }}" @if($o->email == old('order_email')) selected @endif>{{ $o->sur_first_name }}</option>
@endforeach
</select>
<span class="help-block">{{ $errors->first('order_email') }}</span>
@@ -124,6 +124,8 @@
</div>
</div>
</div>
@else
<input type="hidden" name="order_email" value="{{ $user->email }}">
@endif
<!-- Product -->
@@ -135,27 +137,48 @@
<div class="panel-collapse margin-bottom-20">
<div class="panel-body">
<div class="col-md-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>
<div class="control-group form-group col-sm-6 {{ $errors->has('product_id') ? 'has-error' : '' }}">
<label for="order_email">Product</label>
<select class="form-control" id="product_id" name="product_id" value="{{ old('product_id') }}">
<select class="form-control" id="product_id" name="product_id">
<option value="">&nbsp;</option>
@php
$po = $selected = NULL;
@endphp
@foreach (\App\Models\Product::active()->get()->sortBy('name') as $o)
<option value="{{ $o->id }}">{{ $o->name }}</option>
@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"></div>
<div class="col-sm-6" id="product_info">
@if (old('product_id'))
@include('widgets.product_description',['o'=>$po])
@endif
</div>
</div>
<div class="col-md-12" id="product_order"></div>
<div class="col-md-12" id="product_order">
@if (old('product_id'))
@include('widgets.product_order',['o'=>$po])
@endif
</div>
<div class="row">
<div class="col-sm-2"><button class="btn btn-block btn-primary">Previous</button></div>
</div>
<div class="row">
<div class="col-sm-2"><input type="submit" class="btn btn-block btn-primary" value="Submit Order"></div>
<div class="col-sm-2 pull-right"><input type="submit" class="btn btn-block btn-primary" value="Submit Order"></div>
</div>
</div>
</div>
@@ -205,7 +228,6 @@
// Send the request and update sub category dropdown
$.ajax({
type: "GET",
//data: "key="+$(this).val(),
dataType: "html",
cache: true,
url: '{{ url('product_info') }}'+'/'+$(this).val(),
@@ -220,7 +242,7 @@
$.ajax({
type: "GET",
//data: "key="+$(this).val(),
// data: "old=",
dataType: "html",
cache: true,
url: '{{ url('product_order') }}'+'/'+$(this).val(),
@@ -243,4 +265,4 @@
list-style-type: none;
}
</style>
@append
@append