File: D:/HostingSpaces/SBogers10/anvil.komma.pro/resources/views/kms/attributes/currency.blade.php
<div class="entity-attribute entity-attribute-currency {!! $attribute->getStyleClass() !!} @if($errors->has((string)$attribute->getKey())) error @endif {!!$attribute->getStyleClass()!!}"
{{--{{ dd($errors->get((string)$attribute->getKey())) }}--}}
data-uk-tooltip="{pos:'bottom-right'}"
title="{{ $errors->get((string)$attribute->getKey()) != [] ? $errors->get((string)$attribute->getKey())[0] : ''}}"
>
<label for="{{ $attribute->getKey() }}">{{ $attribute->getLabelText() }}</label>
@if($attribute->getReadOnly())
<div class="content">{!! $attribute->getValue() !!}</div>
<input type="hidden" name="{{ $attribute->getKey() }}">
@else
<input type="number"
data-forInput="{{ $attribute->getKey() }}"
@if($attribute->getMin() !== null) min="{{$attribute->getMin()}}" @endif
@if($attribute->getMax()) max="{{$attribute->getMax()}}" @endif
@if($attribute->getStep()) step="{{$attribute->getStep()}}" @endif
>
<input type="hidden" value="" name="{{ $attribute->getKey() }}">
@if($attribute->getExplanation())<span class="explanation">{{ $attribute->getExplanation() }}</span> @endif
@endif
</div>
<script>
(function() {
let realInputSelector = 'input[name="{{ $attribute->getKey() }}"]';
let fakeInputSelector = 'input[data-forInput="{{ $attribute->getKey() }}"]';
let realInput = document.querySelector(realInputSelector);
let fakeInput = document.querySelector(fakeInputSelector);
if("{{ $attribute->getValue() }}" !== "")
{
realInput.setAttribute('value', {{ (int)$attribute->getValue() }});
fakeInput.setAttribute('value', {{ (int)$attribute->getValue() / 100 }});
}
fakeInput.addEventListener('change', (event) => {
realInput.value = event.target.value * 100;
});
})()
</script>