mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
make tab title clearer and cleaner #617 (clean js code)
This commit is contained in:
parent
f08b6afd10
commit
e1b832c6ff
@ -210,15 +210,13 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
$(".priceField, .priceDecimalField, .standard-price-field, .standard-price-decimal-field").on('change', function () {
|
||||
let price = $(".priceField").val() === "" ? '0' : $(".priceField").val();
|
||||
let standardPrice = $(".standard-price-field").val() === "" ? '0' : $(".standard-price-field").val();
|
||||
$(".decimal-price, .whole-price").on('change', function (e) {
|
||||
const parent = e.target.closest('.select-price')
|
||||
let price = $(parent).find('.whole-price').val() === "" ? '0' : $(parent).find('.whole-price').val();
|
||||
price = parseInt(price.replace(/\./g, ''));
|
||||
standardPrice = parseInt(standardPrice.replace(/\./g, ''));
|
||||
let decimal = parseInt($(".priceDecimalField").val());
|
||||
let standardDecimal = parseInt($(".standard-price-decimal-field").val());
|
||||
$('.priceHidden').find('input').val(parseFloat(price + "." + decimal));
|
||||
$('.standard-price-hidden').find('input').val(parseFloat(standardPrice + "." + standardDecimal));
|
||||
let decimal = parseInt($(parent).find('.decimal-price').val());
|
||||
|
||||
$(parent).find('input[type=number]').val(parseFloat(price + "." + decimal));
|
||||
});
|
||||
|
||||
// Add dynamic option creation
|
||||
|
||||
@ -72,10 +72,10 @@
|
||||
</div>
|
||||
{% set standardPriceValue = form.fields.standard_price.value|split('.') %}
|
||||
<div class="col-8 pr-0 col-md-3">
|
||||
<input class="form-control standard-price-field" value="{{ standardPriceValue|first }}">
|
||||
<input class="form-control standard-price-field whole-price" value="{{ standardPriceValue|first }}">
|
||||
</div>
|
||||
<div class="col-4 col-md-1">
|
||||
<input class="form-control standard-price-decimal-field" placeholder="00" maxlength="2"
|
||||
<input class="form-control standard-price-decimal-field decimal-price" placeholder="00" maxlength="2"
|
||||
value="{{ standardPriceValue[1] }}">
|
||||
</div>
|
||||
</div>
|
||||
@ -92,10 +92,10 @@
|
||||
</div>
|
||||
{% set PriceValue = form.fields.price.value|split('.') %}
|
||||
<div class="col-8 pr-0 col-md-3">
|
||||
<input class="form-control priceField" value="{{ PriceValue|first }}">
|
||||
<input class="form-control priceField whole-price" value="{{ PriceValue|first }}">
|
||||
</div>
|
||||
<div class="col-4 col-md-1">
|
||||
<input class="form-control priceDecimalField" placeholder="00" maxlength="2"
|
||||
<input class="form-control priceDecimalField decimal-price" placeholder="00" maxlength="2"
|
||||
value="{{ PriceValue[1] }}">
|
||||
</div>
|
||||
<div class="col-sm-3 col-xs-6">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user