Some aesthetic improvements for vendor catalog batch
hopefully they're improvements...
This commit is contained in:
parent
f89dc88c0e
commit
ab61778d35
13
tailbone/templates/batch/vendorcatalog/view_row.mako
Normal file
13
tailbone/templates/batch/vendorcatalog/view_row.mako
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
## -*- coding: utf-8; -*-
|
||||||
|
<%inherit file="/master/view_row.mako" />
|
||||||
|
|
||||||
|
<%def name="render_buefy_form()">
|
||||||
|
<div class="form">
|
||||||
|
<tailbone-form></tailbone-form>
|
||||||
|
<br />
|
||||||
|
${catalog_entry_diff.render_html()}
|
||||||
|
</div>
|
||||||
|
</%def>
|
||||||
|
|
||||||
|
|
||||||
|
${parent.body()}
|
|
@ -351,6 +351,58 @@
|
||||||
</div>
|
</div>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
|
<%def name="render_row_grid_tools()">
|
||||||
|
${parent.render_row_grid_tools()}
|
||||||
|
% if use_buefy and master.rows_bulk_deletable and not batch.executed and master.has_perm('delete_rows'):
|
||||||
|
<b-button type="is-danger"
|
||||||
|
@click="deleteResultsInit()"
|
||||||
|
icon-pack="fas"
|
||||||
|
icon-left="trash">
|
||||||
|
Delete Results
|
||||||
|
</b-button>
|
||||||
|
<b-modal has-modal-card
|
||||||
|
:active.sync="deleteResultsShowDialog">
|
||||||
|
<div class="modal-card">
|
||||||
|
|
||||||
|
<header class="modal-card-head">
|
||||||
|
<p class="modal-card-title">Delete Results</p>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<section class="modal-card-body">
|
||||||
|
<p class="block">
|
||||||
|
This batch has
|
||||||
|
<span class="has-text-weight-bold">${batch.rowcount}</span>
|
||||||
|
total rows.
|
||||||
|
</p>
|
||||||
|
<p class="block">
|
||||||
|
Your current filters have returned
|
||||||
|
<span class="has-text-weight-bold">{{ total }}</span>
|
||||||
|
results.
|
||||||
|
</p>
|
||||||
|
<p class="block">
|
||||||
|
Would you like to
|
||||||
|
<span class="has-text-danger has-text-weight-bold">
|
||||||
|
delete all {{ total }}
|
||||||
|
</span>
|
||||||
|
results?
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<footer class="modal-card-foot">
|
||||||
|
<b-button @click="deleteResultsShowDialog = false">
|
||||||
|
Cancel
|
||||||
|
</b-button>
|
||||||
|
<once-button type="is-danger"
|
||||||
|
tag="a" href="${url('{}.delete_rows'.format(route_prefix), uuid=batch.uuid)}"
|
||||||
|
icon-left="trash"
|
||||||
|
text="Delete Results">
|
||||||
|
</once-button>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</b-modal>
|
||||||
|
% endif
|
||||||
|
</%def>
|
||||||
|
|
||||||
<%def name="modify_this_page_vars()">
|
<%def name="modify_this_page_vars()">
|
||||||
${parent.modify_this_page_vars()}
|
${parent.modify_this_page_vars()}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -395,6 +447,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
% endif
|
% endif
|
||||||
|
|
||||||
|
% if master.rows_bulk_deletable and not batch.executed and master.has_perm('delete_rows'):
|
||||||
|
|
||||||
|
${rows_grid.component_studly}Data.deleteResultsShowDialog = false
|
||||||
|
|
||||||
|
${rows_grid.component_studly}.methods.deleteResultsInit = function() {
|
||||||
|
this.deleteResultsShowDialog = true
|
||||||
|
}
|
||||||
|
|
||||||
|
% endif
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
|
|
|
@ -71,16 +71,32 @@
|
||||||
% if master.touchable and request.has_perm('{}.touch'.format(permission_prefix)):
|
% if master.touchable and request.has_perm('{}.touch'.format(permission_prefix)):
|
||||||
<li>${h.link_to("\"Touch\" this {}".format(model_title), url('{}.touch'.format(route_prefix), uuid=instance.uuid))}</li>
|
<li>${h.link_to("\"Touch\" this {}".format(model_title), url('{}.touch'.format(route_prefix), uuid=instance.uuid))}</li>
|
||||||
% endif
|
% endif
|
||||||
% if master.has_rows and master.rows_downloadable_csv and request.has_perm('{}.row_results_csv'.format(permission_prefix)):
|
% if not use_buefy and master.has_rows and master.rows_downloadable_csv and master.has_perm('row_results_csv'):
|
||||||
<li>${h.link_to("Download row results as CSV", url('{}.row_results_csv'.format(route_prefix), uuid=instance.uuid))}</li>
|
<li>${h.link_to("Download row results as CSV", master.get_action_url('row_results_csv', instance))}</li>
|
||||||
% endif
|
% endif
|
||||||
% if master.has_rows and master.rows_downloadable_xlsx and master.has_perm('row_results_xlsx'):
|
% if not use_buefy and master.has_rows and master.rows_downloadable_xlsx and master.has_perm('row_results_xlsx'):
|
||||||
<li>${h.link_to("Download row results as XLSX", master.get_action_url('row_results_xlsx', instance))}</li>
|
<li>${h.link_to("Download row results as XLSX", master.get_action_url('row_results_xlsx', instance))}</li>
|
||||||
% endif
|
% endif
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="render_row_grid_tools()">
|
<%def name="render_row_grid_tools()">
|
||||||
${rows_grid_tools}
|
${rows_grid_tools}
|
||||||
|
% if use_buefy:
|
||||||
|
% if master.rows_downloadable_xlsx and master.has_perm('row_results_xlsx'):
|
||||||
|
<b-button tag="a" href="${master.get_action_url('row_results_xlsx', instance)}"
|
||||||
|
icon-pack="fas"
|
||||||
|
icon-left="download">
|
||||||
|
Download Results XLSX
|
||||||
|
</b-button>
|
||||||
|
% endif
|
||||||
|
% if master.rows_downloadable_csv and master.has_perm('row_results_csv'):
|
||||||
|
<b-button tag="a" href="${master.get_action_url('row_results_csv', instance)}"
|
||||||
|
icon-pack="fas"
|
||||||
|
icon-left="download">
|
||||||
|
Download Results CSV
|
||||||
|
</b-button>
|
||||||
|
% endif
|
||||||
|
% endif
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="render_this_page()">
|
<%def name="render_this_page()">
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2021 Lance Edgar
|
# Copyright © 2010-2022 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -686,6 +686,8 @@ class BatchMasterView(MasterView):
|
||||||
return HTML.tag('p', c=[link])
|
return HTML.tag('p', c=[link])
|
||||||
|
|
||||||
def make_batch_row_grid_tools(self, batch):
|
def make_batch_row_grid_tools(self, batch):
|
||||||
|
if self.get_use_buefy():
|
||||||
|
return
|
||||||
if self.rows_bulk_deletable and not batch.executed and self.request.has_perm('{}.delete_rows'.format(self.get_permission_prefix())):
|
if self.rows_bulk_deletable and not batch.executed and self.request.has_perm('{}.delete_rows'.format(self.get_permission_prefix())):
|
||||||
url = self.request.route_url('{}.delete_rows'.format(self.get_route_prefix()), uuid=batch.uuid)
|
url = self.request.route_url('{}.delete_rows'.format(self.get_route_prefix()), uuid=batch.uuid)
|
||||||
return HTML.tag('p', c=[tags.link_to("Delete all rows matching current search", url)])
|
return HTML.tag('p', c=[tags.link_to("Delete all rows matching current search", url)])
|
||||||
|
|
|
@ -40,6 +40,7 @@ from webhelpers2.html import tags
|
||||||
from tailbone import forms
|
from tailbone import forms
|
||||||
from tailbone.db import Session
|
from tailbone.db import Session
|
||||||
from tailbone.views.batch import FileBatchMasterView
|
from tailbone.views.batch import FileBatchMasterView
|
||||||
|
from tailbone.diffs import Diff
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
@ -76,11 +77,12 @@ class VendorCatalogView(FileBatchMasterView):
|
||||||
|
|
||||||
form_fields = [
|
form_fields = [
|
||||||
'id',
|
'id',
|
||||||
'description',
|
|
||||||
'vendor',
|
|
||||||
'filename',
|
'filename',
|
||||||
|
'parser_key',
|
||||||
|
'vendor',
|
||||||
'future',
|
'future',
|
||||||
'effective',
|
'effective',
|
||||||
|
'description',
|
||||||
'notes',
|
'notes',
|
||||||
'created',
|
'created',
|
||||||
'created_by',
|
'created_by',
|
||||||
|
@ -114,16 +116,6 @@ class VendorCatalogView(FileBatchMasterView):
|
||||||
'description',
|
'description',
|
||||||
'size',
|
'size',
|
||||||
'is_preferred_vendor',
|
'is_preferred_vendor',
|
||||||
'old_vendor_code',
|
|
||||||
'vendor_code',
|
|
||||||
'old_case_size',
|
|
||||||
'case_size',
|
|
||||||
'old_case_cost',
|
|
||||||
'case_cost',
|
|
||||||
'case_cost_diff',
|
|
||||||
'old_unit_cost',
|
|
||||||
'unit_cost',
|
|
||||||
'unit_cost_diff',
|
|
||||||
'suggested_retail',
|
'suggested_retail',
|
||||||
'starts',
|
'starts',
|
||||||
'ends',
|
'ends',
|
||||||
|
@ -131,6 +123,8 @@ class VendorCatalogView(FileBatchMasterView):
|
||||||
'discount_ends',
|
'discount_ends',
|
||||||
'discount_amount',
|
'discount_amount',
|
||||||
'discount_percent',
|
'discount_percent',
|
||||||
|
'case_cost_diff',
|
||||||
|
'unit_cost_diff',
|
||||||
'status_code',
|
'status_code',
|
||||||
'status_text',
|
'status_text',
|
||||||
]
|
]
|
||||||
|
@ -228,7 +222,7 @@ class VendorCatalogView(FileBatchMasterView):
|
||||||
|
|
||||||
# starts
|
# starts
|
||||||
if not batch.future:
|
if not batch.future:
|
||||||
g.hide_column('starts')
|
g.remove('starts')
|
||||||
|
|
||||||
g.set_type('old_unit_cost', 'currency')
|
g.set_type('old_unit_cost', 'currency')
|
||||||
g.set_type('unit_cost', 'currency')
|
g.set_type('unit_cost', 'currency')
|
||||||
|
@ -262,6 +256,25 @@ class VendorCatalogView(FileBatchMasterView):
|
||||||
f.set_type('upc', 'gpc')
|
f.set_type('upc', 'gpc')
|
||||||
f.set_type('discount_percent', 'percent')
|
f.set_type('discount_percent', 'percent')
|
||||||
|
|
||||||
|
def template_kwargs_view_row(self, **kwargs):
|
||||||
|
row = kwargs['instance']
|
||||||
|
batch = row.batch
|
||||||
|
|
||||||
|
fields = [
|
||||||
|
'vendor_code',
|
||||||
|
'case_size',
|
||||||
|
'case_cost',
|
||||||
|
'unit_cost',
|
||||||
|
]
|
||||||
|
old_data = dict([(field, getattr(row, 'old_{}'.format(field)))
|
||||||
|
for field in fields])
|
||||||
|
new_data = dict([(field, getattr(row, field))
|
||||||
|
for field in fields])
|
||||||
|
kwargs['catalog_entry_diff'] = Diff(old_data, new_data, fields=fields,
|
||||||
|
monospace=True)
|
||||||
|
|
||||||
|
return kwargs
|
||||||
|
|
||||||
def template_kwargs_create(self, **kwargs):
|
def template_kwargs_create(self, **kwargs):
|
||||||
parsers = self.get_parsers()
|
parsers = self.get_parsers()
|
||||||
for parser in parsers:
|
for parser in parsers:
|
||||||
|
|
Loading…
Reference in a new issue