Get more of the select2 ajax lists working
This commit is contained in:
@@ -1,7 +1,11 @@
|
|||||||
@aware(['name'])
|
@aware(['name'])
|
||||||
|
|
||||||
@props([
|
@props([
|
||||||
'class' => 'col-md-8',
|
'class' => null,
|
||||||
|
'new_model' => false,
|
||||||
|
'category_type' => null,
|
||||||
|
'modal_type' => false,
|
||||||
|
'modal_id' => false,
|
||||||
])
|
])
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
@@ -12,7 +16,7 @@ switch ($name) {
|
|||||||
case 'qty':
|
case 'qty':
|
||||||
case 'min_amt':
|
case 'min_amt':
|
||||||
case 'seats':
|
case 'seats':
|
||||||
$class = 'col-md-3';
|
$class_override = $new_model ? 'col-md-3' : 'col-md-4';
|
||||||
break;
|
break;
|
||||||
case 'purchase_cost':
|
case 'purchase_cost':
|
||||||
case 'purchase_date':
|
case 'purchase_date':
|
||||||
@@ -20,25 +24,40 @@ switch ($name) {
|
|||||||
case 'expiration_date':
|
case 'expiration_date':
|
||||||
case 'start_date':
|
case 'start_date':
|
||||||
case 'end_date':
|
case 'end_date':
|
||||||
$class = 'col-md-5';
|
$class_override = $new_model ? 'col-md-4' : 'col-md-5';
|
||||||
break;
|
break;
|
||||||
case 'model_number':
|
case 'model_number':
|
||||||
case 'item_no':
|
case 'item_no':
|
||||||
case 'order_number':
|
case 'order_number':
|
||||||
case 'purchase_order':
|
case 'purchase_order':
|
||||||
$class = 'col-md-6';
|
$class_override = $new_model ? 'col-md-5' : 'col-md-6';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$class = 'col-md-8';
|
$class_override = $new_model ? 'col-md-7' : 'col-md-8';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use the explicit override if one is set
|
||||||
|
if ($class) {
|
||||||
|
$class_override = $class;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<!-- form-input blade component -->
|
<!-- form-input blade component -->
|
||||||
<div {{ $attributes->merge(['class' => $class]) }}>
|
<div {{ $attributes->merge(['class' => $class_override]) }}>
|
||||||
{{ $slot }}
|
{{ $slot }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if ($new_model)
|
||||||
|
<div class="col-md-1 col-sm-1">
|
||||||
|
@can('create', $new_model)
|
||||||
|
<a href='{{ route('modal.show',[
|
||||||
|
'type' => $modal_type ?? null,
|
||||||
|
'category_type' => $category_type ?? null
|
||||||
|
]) }}' data-toggle="modal" data-target="#createModal" data-select="{{ $modal_id }}" class="btn btn-sm btn-primary text-left">{{ trans('button.new') }}</a>
|
||||||
|
@endcan
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
|
||||||
@error($name)
|
@error($name)
|
||||||
<div class="col-md-8 col-md-offset-3">
|
<div class="col-md-8 col-md-offset-3">
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
'multiple' => false,
|
'multiple' => false,
|
||||||
'item_model' => null,
|
'item_model' => null,
|
||||||
'name' => null,
|
'name' => null,
|
||||||
|
'new_button' => false,
|
||||||
])
|
])
|
||||||
|
|
||||||
@if (!$selected)
|
@if (!$selected)
|
||||||
|
|||||||
@@ -17,8 +17,35 @@
|
|||||||
{{-- Page content --}}
|
{{-- Page content --}}
|
||||||
@section('inputFields')
|
@section('inputFields')
|
||||||
|
|
||||||
@include ('partials.forms.edit.name', ['translated_name' => trans('admin/components/table.title')])
|
<!-- Name -->
|
||||||
@include ('partials.forms.edit.category-select', ['translated_name' => trans('general.category'), 'fieldname' => 'category_id','category_type' => 'component'])
|
<x-form-row name="name">
|
||||||
|
<x-form-label>{{ trans('general.name') }}</x-form-label>
|
||||||
|
<x-form-input>
|
||||||
|
<x-input.text
|
||||||
|
required="true"
|
||||||
|
:value="old('name', $item->name)"
|
||||||
|
/>
|
||||||
|
</x-form-input>
|
||||||
|
</x-form-row>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Category -->
|
||||||
|
<x-form-row name="category_id">
|
||||||
|
<x-form-label>{{ trans('general.category') }}</x-form-label>
|
||||||
|
<x-form-input modal_type="category" modal_id="category_select_id" category_type="component" new_model="\App\Models\Category::class">
|
||||||
|
<x-input.select2-ajax
|
||||||
|
id="category_select_id"
|
||||||
|
:data_placeholder="trans('general.select_asset')"
|
||||||
|
:item="old('category_id', $item->category_id)"
|
||||||
|
:new_button="true"
|
||||||
|
:required="Helper::checkIfRequired($item, 'category_id')"
|
||||||
|
:selected="old('category_id', $item->category_id)"
|
||||||
|
data_endpoint="categories/component"
|
||||||
|
item_model="\App\Models\Category"
|
||||||
|
/>
|
||||||
|
</x-form-input>
|
||||||
|
</x-form-row>
|
||||||
|
|
||||||
|
|
||||||
<!-- QTY -->
|
<!-- QTY -->
|
||||||
<x-form-row name="qty">
|
<x-form-row name="qty">
|
||||||
@@ -49,15 +76,68 @@
|
|||||||
</x-form-row>
|
</x-form-row>
|
||||||
|
|
||||||
@include ('partials.forms.edit.serial', ['fieldname' => 'serial'])
|
@include ('partials.forms.edit.serial', ['fieldname' => 'serial'])
|
||||||
@include ('partials.forms.edit.manufacturer-select', ['translated_name' => trans('general.manufacturer'), 'fieldname' => 'manufacturer_id'])
|
|
||||||
|
<!-- Manufacturer -->
|
||||||
|
<x-form-row name="manufacturer_id">
|
||||||
|
<x-form-label>{{ trans('general.manufacturer') }}</x-form-label>
|
||||||
|
<x-form-input modal_type="manufacturer" modal_id="manufacturer_select_id" new_model="\App\Models\Manufacturer::class">
|
||||||
|
<x-input.select2-ajax
|
||||||
|
id="manufacturer_select_id"
|
||||||
|
:data_placeholder="trans('general.manufacturer')"
|
||||||
|
:item="old('manufacturer_id', $item->manufacturer_id)"
|
||||||
|
:new_button="true"
|
||||||
|
:required="Helper::checkIfRequired($item, 'manufacturer_id')"
|
||||||
|
:selected="old('manufacturer_id', $item->manufacturer_id)"
|
||||||
|
data_endpoint="manufacturers"
|
||||||
|
item_model="\App\Models\Manufacturer"
|
||||||
|
/>
|
||||||
|
</x-form-input>
|
||||||
|
</x-form-row>
|
||||||
|
|
||||||
@include ('partials.forms.edit.model_number')
|
@include ('partials.forms.edit.model_number')
|
||||||
@include ('partials.forms.edit.company-select', ['translated_name' => trans('general.company'), 'fieldname' => 'company_id'])
|
@include ('partials.forms.edit.company-select', ['translated_name' => trans('general.company'), 'fieldname' => 'company_id'])
|
||||||
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
|
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
|
||||||
@include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'supplier_id'])
|
@include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'supplier_id'])
|
||||||
@include ('partials.forms.edit.order_number')
|
@include ('partials.forms.edit.order_number')
|
||||||
@include ('partials.forms.edit.datepicker', ['translated_name' => trans('general.purchase_date'),'fieldname' => 'purchase_date'])
|
|
||||||
@include ('partials.forms.edit.purchase_cost', ['unit_cost' => trans('general.unit_cost')])
|
<!--- Purchase Date -->
|
||||||
@include ('partials.forms.edit.notes')
|
<x-form-row name="purchase_date">
|
||||||
|
<x-form-label>{{ trans('general.purchase_date') }}</x-form-label>
|
||||||
|
<x-form-input>
|
||||||
|
<x-input.datepicker :value="old('purchase_date', $item->purchase_date_for_datepicker)" />
|
||||||
|
</x-form-input>
|
||||||
|
</x-form-row>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Purchase Cost -->
|
||||||
|
<x-form-row name="purchase_cost">
|
||||||
|
<x-form-label>{{ trans('general.unit_cost') }}</x-form-label>
|
||||||
|
<x-form-input>
|
||||||
|
<x-input.text
|
||||||
|
type="number"
|
||||||
|
:input_group_text="$snipeSettings->default_currency"
|
||||||
|
:value="old('purchase_cost', $item->purchase_cost)"
|
||||||
|
input_group_addon="left"
|
||||||
|
input_max="99999999999999999.000"
|
||||||
|
input_min="0"
|
||||||
|
input_min="0.00"
|
||||||
|
input_step="0.001"
|
||||||
|
maxlength="25"
|
||||||
|
/>
|
||||||
|
</x-form-input>
|
||||||
|
</x-form-row>
|
||||||
|
|
||||||
|
<!-- Notes -->
|
||||||
|
<x-form-row name="notes">
|
||||||
|
<x-form-label>{{ trans('general.notes') }}</x-form-label>
|
||||||
|
<x-form-input>
|
||||||
|
<x-input.textarea
|
||||||
|
:value="old('notes', $item->notes)"
|
||||||
|
placeholder="{{ trans('general.placeholders.notes') }}"
|
||||||
|
/>
|
||||||
|
</x-form-input>
|
||||||
|
</x-form-row>
|
||||||
|
|
||||||
@include ('partials.forms.edit.image-upload', ['image_path' => app('components_upload_path')])
|
@include ('partials.forms.edit.image-upload', ['image_path' => app('components_upload_path')])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user