Fix product price, cost history dialogs, for Buefy theme
This commit is contained in:
parent
a2277feb10
commit
815cdbdd0a
|
@ -1,7 +1,7 @@
|
|||
## -*- coding: utf-8; -*-
|
||||
<%inherit file="/page.mako" />
|
||||
|
||||
<%def name="title()">${instance_title_normal} @ ver ${transaction.id}</%def>
|
||||
<%def name="title()">changes @ ver ${transaction.id}</%def>
|
||||
|
||||
<%def name="page_content()">
|
||||
## TODO: this was basically copied from Revel diff template..need to abstract
|
||||
|
|
|
@ -302,7 +302,14 @@
|
|||
<%def name="sources_panel()">
|
||||
% if use_buefy:
|
||||
<nav class="panel">
|
||||
<p class="panel-heading">Vendor Sources</p>
|
||||
<p class="panel-heading">
|
||||
Vendor Sources
|
||||
% if request.rattail_config.versioning_enabled() and master.has_perm('versions'):
|
||||
<a href="#" @click.prevent="showingCostHistory = true">
|
||||
(view cost history)
|
||||
</a>
|
||||
% endif
|
||||
</p>
|
||||
<div class="panel-block">
|
||||
${self.sources_grid()}
|
||||
</div>
|
||||
|
@ -360,6 +367,88 @@
|
|||
|
||||
<%def name="extra_right_panels()"></%def>
|
||||
|
||||
<%def name="render_this_page()">
|
||||
${parent.render_this_page()}
|
||||
% if use_buefy and request.rattail_config.versioning_enabled() and master.has_perm('versions'):
|
||||
|
||||
<b-modal :active.sync="showingPriceHistory_regular"
|
||||
has-modal-card>
|
||||
<div class="modal-card">
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">
|
||||
Regular Price History
|
||||
</p>
|
||||
</header>
|
||||
<section class="modal-card-body">
|
||||
${regular_price_history_grid.render_buefy_table_element(data_prop='regularPriceHistoryData')|n}
|
||||
</section>
|
||||
<footer class="modal-card-foot">
|
||||
<b-button @click="showingPriceHistory_regular = false">
|
||||
Close
|
||||
</b-button>
|
||||
</footer>
|
||||
</div>
|
||||
</b-modal>
|
||||
|
||||
<b-modal :active.sync="showingPriceHistory_current"
|
||||
has-modal-card>
|
||||
<div class="modal-card">
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">
|
||||
Current Price History
|
||||
</p>
|
||||
</header>
|
||||
<section class="modal-card-body">
|
||||
${current_price_history_grid.render_buefy_table_element(data_prop='currentPriceHistoryData')|n}
|
||||
</section>
|
||||
<footer class="modal-card-foot">
|
||||
<b-button @click="showingPriceHistory_current = false">
|
||||
Close
|
||||
</b-button>
|
||||
</footer>
|
||||
</div>
|
||||
</b-modal>
|
||||
|
||||
<b-modal :active.sync="showingPriceHistory_suggested"
|
||||
has-modal-card>
|
||||
<div class="modal-card">
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">
|
||||
Suggested Price History
|
||||
</p>
|
||||
</header>
|
||||
<section class="modal-card-body">
|
||||
${suggested_price_history_grid.render_buefy_table_element(data_prop='suggestedPriceHistoryData')|n}
|
||||
</section>
|
||||
<footer class="modal-card-foot">
|
||||
<b-button @click="showingPriceHistory_suggested = false">
|
||||
Close
|
||||
</b-button>
|
||||
</footer>
|
||||
</div>
|
||||
</b-modal>
|
||||
|
||||
<b-modal :active.sync="showingCostHistory"
|
||||
has-modal-card>
|
||||
<div class="modal-card">
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">
|
||||
Cost History
|
||||
</p>
|
||||
</header>
|
||||
<section class="modal-card-body">
|
||||
${cost_history_grid.render_buefy_table_element(data_prop='costHistoryData')|n}
|
||||
</section>
|
||||
<footer class="modal-card-foot">
|
||||
<b-button @click="showingCostHistory = false">
|
||||
Close
|
||||
</b-button>
|
||||
</footer>
|
||||
</div>
|
||||
</b-modal>
|
||||
% endif
|
||||
</%def>
|
||||
|
||||
<%def name="page_content()">
|
||||
% if use_buefy:
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
|
@ -444,5 +533,26 @@
|
|||
% endif
|
||||
</%def>
|
||||
|
||||
<%def name="modify_this_page_vars()">
|
||||
${parent.modify_this_page_vars()}
|
||||
% if request.rattail_config.versioning_enabled() and master.has_perm('versions'):
|
||||
<script type="text/javascript">
|
||||
|
||||
ThisPageData.showingPriceHistory_regular = false
|
||||
ThisPageData.regularPriceHistoryData = ${json.dumps(regular_price_history_grid.get_buefy_data()['data'])|n}
|
||||
|
||||
ThisPageData.showingPriceHistory_current = false
|
||||
ThisPageData.currentPriceHistoryData = ${json.dumps(current_price_history_grid.get_buefy_data()['data'])|n}
|
||||
|
||||
ThisPageData.showingPriceHistory_suggested = false
|
||||
ThisPageData.suggestedPriceHistoryData = ${json.dumps(suggested_price_history_grid.get_buefy_data()['data'])|n}
|
||||
|
||||
ThisPageData.showingCostHistory = false
|
||||
ThisPageData.costHistoryData = ${json.dumps(cost_history_grid.get_buefy_data()['data'])|n}
|
||||
|
||||
</script>
|
||||
% endif
|
||||
</%def>
|
||||
|
||||
|
||||
${parent.body()}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue