Use map() instead of transform(), use fn() instead of function(), consistent coding for form.select
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
||||
@if(($x=Supplier::active()->whereNotIn('id',$o->suppliers->pluck('id'))->orderBy('name')->get())->count())
|
||||
@if(($x=Supplier::active()->whereNotIn('id',$o->suppliers->pluck('id'))->orderBy(DB::raw('UPPER(name)'))->get())->count())
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<x-leenooks::form.select id="supplier_id" name="supplier_id" icon="fa-handshake" label="Add Supplier" :options="$x->map(function($item) { $item->value = $item->name; return $item; })->toArray()"/>
|
||||
<x-leenooks::form.select id="supplier_id" name="supplier_id" icon="fa-handshake" label="Add Supplier" :options="$x->map(fn($item)=>['id'=>$item->id,'value'=>$item->name])"/>
|
||||
</div>
|
||||
|
||||
<div class="col-4">
|
||||
|
@@ -31,7 +31,7 @@
|
||||
<input type="hidden" name="type" value="invoice">
|
||||
|
||||
<!-- @todo This is currently forcing only paypal -->
|
||||
<x-leenooks::form.select id="checkout_id" name="checkout_id" icon="fa-credit-card" label="Payment Method" feedback="Payment Method is required" choose="true" :options="Checkout::active()->where('name','ilike','paypal')->orderBy('name')->get()->map(function ($item) { $item->value = $item->name; return $item; })"/>
|
||||
<x-leenooks::form.select id="checkout_id" name="checkout_id" icon="fa-credit-card" label="Payment Method" feedback="Payment Method is required" choose="true" :options="Checkout::active()->where('name','ilike','paypal')->orderBy('name')->get()->map(fn($item)=>['id'=>$item->id,'value'=>$item->name])"/>
|
||||
|
||||
<table id="invoices" class="table table-sm w-100">
|
||||
<tr>
|
||||
|
@@ -26,7 +26,7 @@
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-4">
|
||||
<x-leenooks::form.select id="checkout_id" name="checkout_id" icon="fa-credit-card" label="Payment Name" feedback="Payment Name is required" addnew="New Payment" groupby="active" :options="Checkout::orderBy('active','DESC')->orderBy('name')->get()->map(function ($item) { $item->value = $item->name; return $item; })"/>
|
||||
<x-leenooks::form.select id="checkout_id" name="checkout_id" icon="fa-credit-card" label="Payment Name" feedback="Payment Name is required" addnew="New Payment" groupby="active" :options="Checkout::orderBy('active','DESC')->orderBy('name')->get()->map(fn($item)=>['id'=>$item->id,'value'=>$item->name])"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -42,7 +42,7 @@
|
||||
<div class="row">
|
||||
<!-- Product Type -->
|
||||
<div class="col-12">
|
||||
<x-leenooks::form.select name="model" icon="fa-list" label="Product" choose="true" groupby="active" :value="get_class($pdo->type)" :options="Product::availableTypes()->transform(fn($item)=>['id'=>$item,'value'=>$item])"/>
|
||||
<x-leenooks::form.select name="model" icon="fa-list" label="Product" choose="true" groupby="active" :value="get_class($pdo->type)" :options="Product::availableTypes()->map(fn($item)=>['id'=>$item,'value'=>$item])"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@@ -12,7 +12,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
|
||||
<x-leenooks::form.select name="product_id" icon="fa-list" label="Product" choose="true" groupby="active" :value="$po?->id ?? ''" :options="Product::get()->sortBy(fn($item)=>($item->active ? '0' : '1').$item->name)->transform(fn($item)=>['id'=>$item->id,'value'=>$item->name,'active'=>$item->active])"/>
|
||||
<x-leenooks::form.select name="product_id" icon="fa-list" label="Product" choose="true" groupby="active" :value="$po?->id ?? ''" :options="Product::get()->sortBy(fn($item)=>($item->active ? '0' : '1').$item->name)->map(fn($item)=>['id'=>$item->id,'value'=>$item->name,'active'=>$item->active])"/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@@ -41,7 +41,7 @@
|
||||
<!-- PRODUCT -->
|
||||
<x-leenooks::form.select id="product_id" name="broadband[product_id]" icon="fa-list" label="Product" :helper="$o->product->category_name" groupby="active"
|
||||
:value="$np->id"
|
||||
:options="Product::get()->filter(fn($item)=>$item->category === $np->category)->sortBy('name')->sortByDesc('active')->transform(fn($item)=>['id'=>$item->id,'active'=>$item->active,'value'=>$item->name])" required/>
|
||||
:options="Product::get()->filter(fn($item)=>$item->category === $np->category)->sortBy('name')->sortByDesc('active')->map(fn($item)=>['id'=>$item->id,'active'=>$item->active,'value'=>$item->name])" required/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
<x-leenooks::form.select id="product_id" name="product_id" icon="fa-list" label="Product" :helper="$o->category_name" :choose="true"
|
||||
:value="$o->service->product_id"
|
||||
:options="Product::active()->get()->filter(fn($item)=>get_class($item->type) === Broadband::class)->sortBy('name')->sortByDesc('active')->transform(fn($item)=>['id'=>$item->id,'active'=>$item->active,'value'=>$item->name])" required/>
|
||||
:options="Product::active()->get()->filter(fn($item)=>get_class($item->type) === Broadband::class)->sortBy('name')->sortByDesc('active')->map(fn($item)=>['id'=>$item->id,'active'=>$item->active,'value'=>$item->name])" required/>
|
||||
|
||||
<strong>NOTE</strong>: A plan setup fee is normally not applicable to Broadband changes, but a plan change fee normally is.
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
|
||||
<x-leenooks::form.select id="domain_registrar_id" name="domain[domain_registrar_id]" icon="fa-handshake" label="Registrar" :value="$o->domain_registrar_id" :options="DomainRegistrar::active()->orderBy('name')->get()->transform(fn($item)=>['id'=>$item->id,'value'=>$item->name])"/>
|
||||
<x-leenooks::form.select id="domain_registrar_id" name="domain[domain_registrar_id]" icon="fa-handshake" label="Registrar" :value="$o->domain_registrar_id" :options="DomainRegistrar::active()->orderBy('name')->get()->map(fn($item)=>['id'=>$item->id,'value'=>$item->name])"/>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-sm-9 col-md-12 col-xl-6">
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
|
||||
<x-leenooks::form.select id="registrar_ns" name="domain[registrar_ns]" icon="fa-project-diagram" label="DNS Location" :value="$o->registrar_ns" :options="ServiceDomain::select('registrar_ns')->distinct()->orderBy('registrar_ns')->get()->transform(fn($item)=>['id'=>$item->registrar_ns,'value'=>$item->registrar_ns])"/>
|
||||
<x-leenooks::form.select id="registrar_ns" name="domain[registrar_ns]" icon="fa-project-diagram" label="DNS Location" :value="$o->registrar_ns" :options="ServiceDomain::select('registrar_ns')->distinct()->orderBy('registrar_ns')->get()->map(fn($item)=>['id'=>$item->registrar_ns,'value'=>$item->registrar_ns])"/>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-sm-9 col-md-12 col-xl-6">
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
|
||||
<x-leenooks::form.select id="supplier_host_server_id" name="hosting[supplier_host_server_id]" icon="fa-handshake" label="Registrar" :value="$o->supplier_host_server_id" :options="SupplierHostServer::active()->orderBy('name')->get()->transform(fn($item)=>['id'=>$item->id,'value'=>$item->name])"/>
|
||||
<x-leenooks::form.select id="supplier_host_server_id" name="hosting[supplier_host_server_id]" icon="fa-handshake" label="Registrar" :value="$o->supplier_host_server_id" :options="SupplierHostServer::active()->orderBy('name')->get()->map(fn($item)=>['id'=>$item->id,'value'=>$item->name])"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@@ -1,3 +1,6 @@
|
||||
<!-- ($o??$user)=User::class -->
|
||||
@use(App\Models\Country)
|
||||
|
||||
@extends('adminlte::layouts.app')
|
||||
|
||||
@section('htmlheader_title')
|
||||
@@ -14,8 +17,6 @@
|
||||
{{ ($o??$user)->role }}
|
||||
@endsection
|
||||
|
||||
@use(App\Models\Country)
|
||||
<!-- ($o??$user)=User::class -->
|
||||
@section('main-content')
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
@@ -93,7 +94,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6">
|
||||
<x-leenooks::form.select id="country" name="country_id" icon="fa-globe" label="Country" :value="($o??$user)->country_id ?? ''" :options="Country::select(['id','name'])->active()->get()->map(function($item) { $item->value = $item->name; return $item; })->toArray()"/>
|
||||
<x-leenooks::form.select id="country" name="country_id" icon="fa-globe" label="Country" :value="($o??$user)->country_id ?? ''" :options="Country::select(['id','name'])->active()->get()->map(fn($item)=>['id'=>$item->id,'value'=>$item->name])"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user