-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Price to Catalog Items. #5719
Added Price to Catalog Items. #5719
Conversation
5bda006
to
9e3c073
Compare
Added Currency drop down and Price text field to Angular and non-angular Catalog Item editors. And update Catalog Item details screen t show the price information. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1602072
9e3c073
to
9ad9add
Compare
@edit[:new][:currency] = params[:currency].to_i | ||
@edit[:new][:code_currency] = code_currency_label(params[:currency]) | ||
end | ||
@edit[:new][:price] = params[:price] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing if params[:price]
?
This is called both when saving from angular (st_edit
with ?button=save
or add
), and from non-angular st_form_field_changed
.
On the non-angular version, UAE Dirham is getting preselected (first option). (Angular starts with "Nothing selected") (=> #5719 (comment)) |
app/assets/javascripts/controllers/catalog/catalog_item_form_controller.js
Show resolved
Hide resolved
%p.form-control-static | ||
- currency = ChargebackRateDetailCurrency.currencies_for_select | ||
= select_tag("currency", | ||
options_for_select(currency, @edit[:new][:currency]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aah, this is missing the usual [["<Nothing>", nil]] +
@himdel please re-review |
Only show Price info on details screen when currency and price was set. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1602072
Also made changes to show `Price` as required field if user has made selection in a currency drop down. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1602072
@Loicavenel cc |
Ok, it is fine but I think we need to be more precise.. Price / Month |
@Loicavenel updated labels to |
Creating a Generic catalog item...
As far as I understand, price & currency are not required fields, so, creating a catalog item without currency & price should still be working, right? (If i do chose a currency, the price is required, that probably makes sense.) |
Creating an Ansible Playbook (angular) item works as expected, price is only required when a currency was chosen, saving seems to work fine. The only issue I'm seeing is that That is also present in the non-angular version. EDIT: fixed |
@himdel addressed your feedback |
Trying to add a generic catalog item without price or currency now fails on (I think that's the last issue, assuming it doesn't still throw Couldn't find ChargebackRateDetailCurrency with 'id'= afterwards.) |
Fixed to show label on Price field appropriately when adding new record, and fixed saving of new record when currency/price are both not entered by user. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1602072
d127bca
to
11a9375
Compare
Two potential issues when unsetting an already set currency:
|
|
||
function idWatch(name) { | ||
var fieldName = 'vm._' + name; | ||
$scope.$watch(fieldName, function(value) { | ||
vm.catalogItemModel[name + '_id'] = value ? value.id : ''; | ||
if (name == 'currency' && typeof value !== 'undefined') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (name == 'currency' && ! value)
should fix the problem when unsetting currency. (It goes from undefined to a currency, but then it goes to null, not undefined, when unselecting.)
Checked commits h-kataria/manageiq-ui-classic@9ad9add~...12a460a with ruby 2.4.6, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 |
LGTM, |
Added Currency drop down and Price text field to Angular and non-angular Catalog Item editors. And update Catalog Item details screen t show the price information.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1602072
Angular Version Catalog Item editor
Non- Angular version Catalog Item editor
Catalog Item summary screen
Price info on Catalog Service detail screen
Service that has no pricing info saved
Catalog Item edit, show price as required field when Currency has been selected.