fix create problem

pull/13/head
A1Gard 2 years ago
parent a3a62cd259
commit 98bfd2ed5f

@ -29,9 +29,9 @@
</label> </label>
<select name="customer_id" data-live-search="true" id="customer_id" <select name="customer_id" data-live-search="true" id="customer_id"
class="form-control searchable @error('customer_id') is-invalid @enderror"> class="form-control searchable @error('customer_id') is-invalid @enderror">
@foreach(\App\models\Customer::all() as $customer ) @foreach(\App\Models\Customer::all() as $customer )
<option value="{{ $customer->id }}" <option value="{{ $customer->id }}"
@if (old('customer_id',$invoice->customer_id??null) == $customer->id ) selected @endif > {{$customer->name}} </option> @if (old('customer_id',$invoice?->customer_id??null) == $customer->id ) selected @endif > {{$customer->name}} </option>
@endforeach @endforeach
</select> </select>
</div> </div>
@ -76,6 +76,7 @@
value="{{old('tracking_code',$invoice->tracking_code??null)}}"/> value="{{old('tracking_code',$invoice->tracking_code??null)}}"/>
</div> </div>
</div> </div>
@if(isset($invoice))
@foreach($invoice->products as $product ) @foreach($invoice->products as $product )
<div class="col-md-6"> <div class="col-md-6">
@ -86,7 +87,8 @@
<label for="products"> <label for="products">
{{__('Product')}} {{__('Product')}}
</label> </label>
<select data-live-search="true" name="products.ids[]" data-live-search="true" id="products" <select data-live-search="true" name="products.ids[]"
data-live-search="true" id="products"
class="form-control searchable"> class="form-control searchable">
@foreach(\App\models\Product::all() as $allProduct ) @foreach(\App\models\Product::all() as $allProduct )
<option value="{{ $allProduct->id }}" <option value="{{ $allProduct->id }}"
@ -100,10 +102,12 @@
<label for="count"> <label for="count">
{{__('Count')}} {{__('Count')}}
</label> </label>
<input type="number" name="products.counts[]" value="{{$product->pivot->count}}" <input type="number" name="products.counts[]"
value="{{$product->pivot->count}}"
id="" class="form-control"> id="" class="form-control">
<button class="btn btn-outline-danger " <button class="btn btn-outline-danger "
onclick="document.getElementById('product_{{$product->id}}').remove()"> X onclick="document.getElementById('product_{{$product->id}}').remove()">
X
</button> </button>
</div> </div>
</div> </div>
@ -113,6 +117,8 @@
</div> </div>
@endforeach @endforeach
@endif
<div class="col-md-12"> <div class="col-md-12">
<label> &nbsp;</label> <label> &nbsp;</label>
<input name="" type="submit" class="btn btn-primary mt-2" value="{{__('Save')}}"/> <input name="" type="submit" class="btn btn-primary mt-2" value="{{__('Save')}}"/>

Loading…
Cancel
Save