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,43 +76,49 @@
value="{{old('tracking_code',$invoice->tracking_code??null)}}"/> value="{{old('tracking_code',$invoice->tracking_code??null)}}"/>
</div> </div>
</div> </div>
@foreach($invoice->products as $product ) @if(isset($invoice))
@foreach($invoice->products as $product )
<div class="col-md-6"> <div class="col-md-6">
<div class="card"> <div class="card">
<div id="product_{{$product->id}}" class="row"> <div id="product_{{$product->id}}" class="row">
<div class="col-md-6 mt-3"> <div class="col-md-6 mt-3">
<div class="form-group"> <div class="form-group">
<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[]"
class="form-control searchable"> data-live-search="true" id="products"
@foreach(\App\models\Product::all() as $allProduct ) class="form-control searchable">
<option value="{{ $allProduct->id }}" @foreach(\App\models\Product::all() as $allProduct )
@if ($product->id==$allProduct->id ) selected @endif > {{$allProduct->name}} </option> <option value="{{ $allProduct->id }}"
@endforeach @if ($product->id==$allProduct->id ) selected @endif > {{$allProduct->name}} </option>
</select> @endforeach
</div> </select>
</div> </div>
<div class="col-md-6 mt-3"> </div>
<div class="form-group"> <div class="col-md-6 mt-3">
<label for="count"> <div class="form-group">
{{__('Count')}} <label for="count">
</label> {{__('Count')}}
<input type="number" name="products.counts[]" value="{{$product->pivot->count}}" </label>
id="" class="form-control"> <input type="number" name="products.counts[]"
<button class="btn btn-outline-danger " value="{{$product->pivot->count}}"
onclick="document.getElementById('product_{{$product->id}}').remove()"> X id="" class="form-control">
</button> <button class="btn btn-outline-danger "
</div> onclick="document.getElementById('product_{{$product->id}}').remove()">
</div> X
</button>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@endforeach
@endif
@endforeach
<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