multiple-select.blade.php
1.3 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
38
39
40
41
@extends('admin::grid.inline-edit.comm')
@section('field')
<select name='multiple-select-{{ $name }}' class="form-control ie-input" multiple>
@foreach($options as $option => $label)
<option name='multiple-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($.inArray($(option).attr('value'), $trigger.data('value')) >= 0) {
$(option).attr('selected', true);
}
});
@endslot
@endcomponent
</script>
<script>
@component('admin::grid.inline-edit.partials.submit', compact('resource', 'name'))
@slot('val')
var val = [];
var label = [];
$popover.find('.ie-input>option:selected').each(function(){
val.push($(this).val());
label.push($(this).data('label'));
});
@endslot
$popover.data('display').html(label.join(';'));
@endcomponent
</script>
@endsection