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; -*-
|
## -*- coding: utf-8; -*-
|
||||||
<%inherit file="/page.mako" />
|
<%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()">
|
<%def name="page_content()">
|
||||||
## TODO: this was basically copied from Revel diff template..need to abstract
|
## TODO: this was basically copied from Revel diff template..need to abstract
|
||||||
|
|
|
@ -302,7 +302,14 @@
|
||||||
<%def name="sources_panel()">
|
<%def name="sources_panel()">
|
||||||
% if use_buefy:
|
% if use_buefy:
|
||||||
<nav class="panel">
|
<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">
|
<div class="panel-block">
|
||||||
${self.sources_grid()}
|
${self.sources_grid()}
|
||||||
</div>
|
</div>
|
||||||
|
@ -360,6 +367,88 @@
|
||||||
|
|
||||||
<%def name="extra_right_panels()"></%def>
|
<%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()">
|
<%def name="page_content()">
|
||||||
% if use_buefy:
|
% if use_buefy:
|
||||||
<div style="display: flex; flex-direction: column;">
|
<div style="display: flex; flex-direction: column;">
|
||||||
|
@ -444,5 +533,26 @@
|
||||||
% endif
|
% endif
|
||||||
</%def>
|
</%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()}
|
${parent.body()}
|
||||||
|
|
|
@ -482,8 +482,11 @@ class ProductsView(MasterView):
|
||||||
if not self.has_perm('versions'):
|
if not self.has_perm('versions'):
|
||||||
return text
|
return text
|
||||||
|
|
||||||
history = tags.link_to("(view history)", '#',
|
if self.get_use_buefy():
|
||||||
id='view-{}-price-history'.format(typ))
|
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:
|
if not text:
|
||||||
return history
|
return history
|
||||||
|
|
||||||
|
@ -500,10 +503,6 @@ class ProductsView(MasterView):
|
||||||
date = localtime(self.rattail_config, history[0]['changed'], from_utc=True).date()
|
date = localtime(self.rattail_config, history[0]['changed'], from_utc=True).date()
|
||||||
text = "{} (as of {})".format(text, 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):
|
def render_current_price(self, product, field):
|
||||||
|
@ -515,10 +514,6 @@ class ProductsView(MasterView):
|
||||||
date = localtime(self.rattail_config, history[0]['changed'], from_utc=True).date()
|
date = localtime(self.rattail_config, history[0]['changed'], from_utc=True).date()
|
||||||
text = "{} (as of {})".format(text, 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):
|
def warn_if_regprice_more_than_srp(self, product, text):
|
||||||
|
@ -538,11 +533,6 @@ class ProductsView(MasterView):
|
||||||
text = "{} (as of {})".format(text, date)
|
text = "{} (as of {})".format(text, date)
|
||||||
|
|
||||||
text = self.warn_if_regprice_more_than_srp(product, text)
|
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):
|
def render_grid_suggested_price(self, product, field):
|
||||||
|
|
Loading…
Reference in a new issue