Fix product price, cost history dialogs, for Buefy theme

This commit is contained in:
Lance Edgar 2020-02-28 17:06:30 -06:00
parent a2277feb10
commit 815cdbdd0a
3 changed files with 120 additions and 20 deletions

View file

@ -482,8 +482,11 @@ class ProductsView(MasterView):
if not self.has_perm('versions'):
return text
history = tags.link_to("(view history)", '#',
id='view-{}-price-history'.format(typ))
if self.get_use_buefy():
kwargs = {'@click.prevent': 'showingPriceHistory_{} = true'.format(typ)}
else:
kwargs = {'id': 'view-{}-price-history'.format(typ)}
history = tags.link_to("(view history)", '#', **kwargs)
if not text:
return history
@ -500,11 +503,7 @@ class ProductsView(MasterView):
date = localtime(self.rattail_config, history[0]['changed'], from_utc=True).date()
text = "{} (as of {})".format(text, date)
if self.get_use_buefy():
# TODO: should add history link here too...
return text
else: # not buefy
return self.add_price_history_link(text, 'regular')
return self.add_price_history_link(text, 'regular')
def render_current_price(self, product, field):
text = self.render_price(product, field)
@ -515,11 +514,7 @@ class ProductsView(MasterView):
date = localtime(self.rattail_config, history[0]['changed'], from_utc=True).date()
text = "{} (as of {})".format(text, date)
if self.get_use_buefy():
# TODO: should add history link here too...
return text
else: # not buefy
return self.add_price_history_link(text, 'current')
return self.add_price_history_link(text, 'current')
def warn_if_regprice_more_than_srp(self, product, text):
sugprice = product.suggested_price.price if product.suggested_price else None
@ -538,12 +533,7 @@ class ProductsView(MasterView):
text = "{} (as of {})".format(text, date)
text = self.warn_if_regprice_more_than_srp(product, text)
if self.get_use_buefy():
# TODO: should add history link here too...
return text
else: # not buefy
return self.add_price_history_link(text, 'suggested')
return self.add_price_history_link(text, 'suggested')
def render_grid_suggested_price(self, product, field):
text = self.render_price(product, field)