<script>
document.addEventListener("DOMContentLoaded", function() {
(function () {
const vidInput = document.querySelector('input[name="numoperation"]');
const corectionInpit = document.querySelector('input[name="correction"]');
const profitInput = document.querySelector('select[name="profit"]');
corectionInpit.closest('.t-input-group').classList.add('correction');
function correctionStart(){
const profitType = profitInput.selectedIndex;
if ( (Number(vidInput.value) >= 30) && profitType ){
corectionInpit.value = 0.5;
}else{
corectionInpit.value = 1;
};
};
["input", "keyup"].forEach(function(event) {
vidInput.addEventListener(event, function() {
if (this.value.match(/[^0-9]/g)) {
this.value = this.value.replace(/[^0-9]/g, '');
};
if( this.value.length > 3) {
this.value = this.value.substr(0, 3);
};
correctionStart();
});
});
vidInput.nextElementSibling.addEventListener('click', function(event) {
correctionStart();
});
vidInput.previousElementSibling.addEventListener('click', function(event) {
correctionStart();
});
profitInput.addEventListener('change', function(event){
correctionStart()
});
})();
});
</script>
<style>
.correction{display:none}
.t700 .t-input-group.t-input-group_fr {
display: flex;
align-items: baseline;
}
.t700 input.t-inputquantity {
height: 40px;
}
</style>