select.blade.php
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
@extends('admin::grid.inline-edit.comm')
@section('field')
<select name='select-{{ $name }}' class="form-control ie-input">
@foreach($options as $option => $label)
<option name='select-{{ $name }}' value="{{ $option }}" data-label="{{ $label }}"> {{$label}} </option>
@endforeach
</select>
@endsection
@section('assert')
<script>
@component('admin::grid.inline-edit.partials.popover', compact('trigger'))
@slot('content')
$template.find('select>option').each(function (index, option) {
if ($(option).attr('value') == $trigger.data('value')) {
$(option).attr('selected', true);
}
});
@endslot
@endcomponent
</script>
<script>
@component('admin::grid.inline-edit.partials.submit', compact('resource', 'name'))
@slot('val')
var val = $popover.find('.ie-input').val();
var label = $popover.find('.ie-input>option:selected').data('label');
@endslot
$popover.data('display').html(label);
@endcomponent
</script>
@endsection