Add edit supplier products (phone)

This commit is contained in:
2025-05-18 21:14:02 +10:00
parent ac702397a6
commit 7fd1ce9584
9 changed files with 166 additions and 75 deletions

View File

@@ -5,8 +5,10 @@
@php
if(isset($spo)) {
$oo = $spo->detail?->find(request()->route()->parameter('type'),request()->route()->parameter('id'));
$oo = $spo->detail?->supplier_product(request()->route()->parameter('type'),request()->route()->parameter('id'));
$oo?->load(['products.products.services']);
$breadcrumb = [$spo->name=>route('supplier.details',['spo'=>$spo->id])];
}
@endphp
@@ -55,7 +57,11 @@ if(isset($spo)) {
</div>
</div>
<div id="type"></div>
<div id="type">
@if(($x=old('offering_type')) && ((! isset($oo)) || (! $oo->exists)))
@include('theme.backend.adminlte.supplier.product.widget.'.$x,['o'=>NULL])
@endif
</div>
<div class="row">
<!-- Buttons -->
@@ -153,26 +159,26 @@ if(isset($spo)) {
@section('page-scripts')
<script type="text/javascript">
$(document).ready(function() {
function load_type(type,id) {
$.ajax({
type: 'POST',
dataType: 'html',
cache: false,
data: {errors: {!! $errors !!}, old: {!! json_encode(old()) !!} },
url: '{{ url('a/supplier/product/view') }}/'+type+(id ? '/'+id : ''),
timeout: 2000,
error: function(x) {
//spinner.toggleClass('d-none').toggleClass('fa-spin');
alert('Failed to submit');
},
success: function(data) {
$("div[id=type]").empty().append(data);
}
});
}
function load_type(type,id) {
$.ajax({
type: 'POST',
dataType: 'html',
cache: false,
data: {errors: {!! $errors !!}, old: {!! json_encode(old()) !!} },
url: '{{ url('a/supplier/product/view') }}/'+type+(id ? '/'+id : ''),
timeout: 2000,
error: function(x) {
//spinner.toggleClass('d-none').toggleClass('fa-spin');
alert('Failed to submit');
},
success: function(data) {
$("div[id=type]").empty().append(data);
}
});
}
@if (isset($oo) && $oo->exists)
$(document).ready(function() {
@if(isset($oo) && $oo->exists)
$('#offering_type').attr('style','pointer-events: none;');
load_type('{{$oo->category}}',{{$oo->id}})
@endif

View File

@@ -0,0 +1,43 @@
<!-- $o=Supplier/Phone::class -->
<div class="row">
<!-- Supplier Name -->
<div class="col-4">
<x-leenooks::form.text name="product_id" label="Product ID" icon="fa-tag" helper="Supplier's Product ID" :value="$o?->product_id"/>
</div>
<!-- Suppliers Description -->
<div class="col-8">
<x-leenooks::form.text name="product_desc" label="Product Description" icon="fa-file-alt" helper="Supplier's Product Description as it appears on Invoices" :value="$o?->product_desc"/>
</div>
</div>
<div class="row">
<!-- Supplier Active -->
<div class="col-1">
<x-leenooks::form.toggle name="active" label="Active" :value="$o?->active"/>
</div>
<div class="offset-1 col-10">
<div class="row">
<!-- Base Cost -->
<div class="col-12 col-sm-2">
<x-leenooks::form.text class="text-right" name="base_cost" label="Base" helper="Monthly Cost (ex)" :value="$o?->base_cost"/>
</div>
<!-- Setup Cost -->
<div class="col-2">
<x-leenooks::form.text class="text-right" name="setup_cost" label="Setup" helper="Setup Cost (ex)" :value="$o?->setup_cost"/>
</div>
<!-- Contract Term -->
<div class="col-2">
<x-leenooks::form.number class="text-right" name="contract_term" label="Contract Term" helper="Term (mths)" :value="$o?->contract_term"/>
</div>
<!-- Technology -->
<div class="col-2">
<x-leenooks::form.text class="text-right" name="technology" label="Technology" :value="$o?->technology"/>
</div>
</div>
</div>
</div>

View File

@@ -37,7 +37,7 @@
<tbody>
@foreach($xx=$offering->items->with(['products.products.services'])->get() as $oo)
<tr>
<td>{{ $oo->id }}</td>
<td><a href="{{ route('supplier.product.type',['id'=>$oo->id,'spo'=>$oo->supplier_detail_id,'type'=>$oo->category]) }}">{{ $oo->id }}</a></td>
<td>{{ $oo->name }}</td>
<td>{{ $oo->name_long }}</td>
<td class="text-right">{{ $oo->active ? 'YES' : 'NO' }}</td>