post money input fix
This commit is contained in:
+23
-11
@@ -62,9 +62,9 @@ end
|
||||
|
||||
function private.get_unit_start_price()
|
||||
if UIDropDownMenu_GetSelectedValue(private.mode_dropdown) == BUYOUT_MODE then
|
||||
return Aux.money.from_string(private.unit_buyout_price:GetText())
|
||||
return Aux.money.from_string(private.unit_buyout_price:GetText()) or 0
|
||||
else
|
||||
return Aux.money.from_string(private.unit_start_price:GetText())
|
||||
return Aux.money.from_string(private.unit_start_price:GetText()) or 0
|
||||
end
|
||||
end
|
||||
|
||||
@@ -76,7 +76,7 @@ end
|
||||
|
||||
function private.get_unit_buyout_price()
|
||||
if UIDropDownMenu_GetSelectedValue(private.mode_dropdown) == BUYOUT_MODE or UIDropDownMenu_GetSelectedValue(private.mode_dropdown) == FULL_MODE then
|
||||
return Aux.money.from_string(private.unit_buyout_price:GetText())
|
||||
return Aux.money.from_string(private.unit_buyout_price:GetText()) or 0
|
||||
else
|
||||
return 0
|
||||
end
|
||||
@@ -414,9 +414,15 @@ function public.on_load()
|
||||
editbox:SetScript('OnTextChanged', function()
|
||||
if selected_item then
|
||||
local settings = private.read_settings()
|
||||
settings.start_price = Aux.money.from_string(this:GetText())
|
||||
|
||||
local input = Aux.money.from_string(this:GetText())
|
||||
if input then
|
||||
settings.start_price = input
|
||||
end
|
||||
input = input or 0
|
||||
|
||||
local historical_value = Aux.history.value(selected_item.key)
|
||||
private.start_price_percentage:SetText(historical_value and Aux.auction_listing.percentage_historical(Aux.round(settings.start_price / historical_value * 100)) or '---')
|
||||
private.start_price_percentage:SetText(historical_value and Aux.auction_listing.percentage_historical(Aux.round(input / historical_value * 100)) or '---')
|
||||
private.write_settings(settings)
|
||||
end
|
||||
refresh = true
|
||||
@@ -440,7 +446,7 @@ function public.on_load()
|
||||
this:HighlightText()
|
||||
end)
|
||||
editbox:SetScript('OnEditFocusLost', function()
|
||||
this:SetText(Aux.money.to_string(Aux.money.from_string(this:GetText()), true, nil, 3))
|
||||
this:SetText(Aux.money.to_string(Aux.money.from_string(this:GetText()) or 0, true, nil, 3))
|
||||
end)
|
||||
do
|
||||
local label = Aux.gui.label(editbox, 13)
|
||||
@@ -463,9 +469,15 @@ function public.on_load()
|
||||
editbox:SetScript('OnTextChanged', function()
|
||||
if selected_item then
|
||||
local settings = private.read_settings()
|
||||
settings.buyout_price = Aux.money.from_string(this:GetText())
|
||||
|
||||
local input = Aux.money.from_string(this:GetText())
|
||||
if input then
|
||||
settings.buyout_price = input
|
||||
end
|
||||
input = input or 0
|
||||
|
||||
local historical_value = Aux.history.value(selected_item.key)
|
||||
private.buyout_price_percentage:SetText(historical_value and Aux.auction_listing.percentage_historical(Aux.round(settings.buyout_price / historical_value * 100)) or '---')
|
||||
private.buyout_price_percentage:SetText(historical_value and Aux.auction_listing.percentage_historical(Aux.round(input / historical_value * 100)) or '---')
|
||||
private.write_settings(settings)
|
||||
end
|
||||
refresh = true
|
||||
@@ -487,7 +499,7 @@ function public.on_load()
|
||||
this:HighlightText()
|
||||
end)
|
||||
editbox:SetScript('OnEditFocusLost', function()
|
||||
this:SetText(Aux.money.to_string(Aux.money.from_string(this:GetText()), true, nil, 3))
|
||||
this:SetText(Aux.money.to_string(Aux.money.from_string(this:GetText()) or 0, true, nil, 3))
|
||||
end)
|
||||
do
|
||||
local label = Aux.gui.label(editbox, 13)
|
||||
@@ -639,14 +651,14 @@ function private.update_recommendation()
|
||||
private.hide_checkbox:Hide()
|
||||
else
|
||||
private.mode_dropdown:Show()
|
||||
private.unit_start_price:Hide()
|
||||
private.unit_buyout_price:Hide()
|
||||
private.unit_start_price:ClearAllPoints()
|
||||
private.unit_buyout_price:ClearAllPoints()
|
||||
if UIDropDownMenu_GetSelectedValue(private.mode_dropdown) == BUYOUT_MODE then
|
||||
private.unit_start_price:Hide()
|
||||
private.unit_buyout_price:SetPoint('TOPRIGHT', -65, -100)
|
||||
private.unit_buyout_price:Show()
|
||||
elseif UIDropDownMenu_GetSelectedValue(private.mode_dropdown) == BID_MODE then
|
||||
private.unit_buyout_price:Hide()
|
||||
private.unit_start_price:SetPoint('TOPRIGHT', -65, -100)
|
||||
private.unit_start_price:Show()
|
||||
elseif UIDropDownMenu_GetSelectedValue(private.mode_dropdown) == FULL_MODE then
|
||||
|
||||
Reference in New Issue
Block a user