mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-04 02:05:16 +02:00
Fill new pricedetails with useful values.
This commit is contained in:
parent
21cb12303f
commit
40889832ca
1 changed files with 18 additions and 0 deletions
|
@ -32,8 +32,26 @@
|
||||||
//Increase the index
|
//Increase the index
|
||||||
newForm = newForm.replace(/__name__/g, index);
|
newForm = newForm.replace(/__name__/g, index);
|
||||||
|
|
||||||
|
//Set default value
|
||||||
|
$vals = $(newForm).find("input[id$='min_discount_quantity']");
|
||||||
|
|
||||||
|
//Determine the id of the fields we later update
|
||||||
|
var price_related_id = $("input[id$='price_related_quantity']", newForm).attr('id');
|
||||||
|
var min_discount_id = $("input[id$='min_discount_quantity']", newForm).attr('id');
|
||||||
|
|
||||||
|
//Determine the new value for the min_discount_qty
|
||||||
|
var new_min_amount = $("input[id$='min_discount_quantity']" , $holder).last().val();
|
||||||
|
new_min_amount = parseInt(new_min_amount) + 1;
|
||||||
|
//Determine the next exponent, 10 -> 100 -> 1000
|
||||||
|
new_min_amount = Math.pow(10, Math.ceil(Math.log10(new_min_amount)));
|
||||||
|
|
||||||
$holder.children("tbody").append(newForm);
|
$holder.children("tbody").append(newForm);
|
||||||
|
|
||||||
|
// Now really update the values, after they were inserted into dom
|
||||||
|
$("#" + min_discount_id).val(new_min_amount);
|
||||||
|
$("#" + price_related_id).val("1");
|
||||||
|
|
||||||
|
|
||||||
//Reinit the selectpickers
|
//Reinit the selectpickers
|
||||||
$(".selectpicker").selectpicker();
|
$(".selectpicker").selectpicker();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue