2016-12-31 09:27:40 -05:00
|
|
|
<div toggle-switch="{{$name}}" class="toggle-switch @if($value) active @endif">
|
2016-12-22 14:41:32 -05:00
|
|
|
<input type="hidden" name="{{$name}}" value="{{$value?'true':'false'}}"/>
|
|
|
|
<div class="switch-handle"></div>
|
2016-12-31 09:27:40 -05:00
|
|
|
</div>
|
|
|
|
<script>
|
|
|
|
(function() {
|
|
|
|
var toggle = document.querySelector('[toggle-switch="{{$name}}"]');
|
|
|
|
var toggleInput = toggle.querySelector('input');
|
|
|
|
toggle.onclick = function(event) {
|
|
|
|
var checked = toggleInput.value !== 'true';
|
|
|
|
toggleInput.value = checked ? 'true' : 'false';
|
|
|
|
checked ? toggle.classList.add('active') : toggle.classList.remove('active');
|
|
|
|
};
|
|
|
|
})()
|
|
|
|
</script>
|