Refactor how batch editing is done; don't include rows for that sometimes

Various other fixes also..for sake of new purchase batches
This commit is contained in:
Lance Edgar 2016-11-08 12:56:12 -06:00
parent da8ef9ebd8
commit 7454e611c5
7 changed files with 85 additions and 26 deletions

View file

@ -3,6 +3,23 @@
<%def name="title()">Edit ${model_title}: ${instance_title}</%def>
<%def name="head_tags()">
${parent.head_tags()}
<script type="text/javascript">
$(function() {
$('form').submit(function() {
var submit = $(this).find('input[type="submit"]');
if (submit.length) {
submit.button('disable').button('option', 'label', "Saving, please wait...");
}
});
});
</script>
</%def>
<%def name="context_menu_items()">
<li>${h.link_to("Back to {}".format(model_title_plural), url(route_prefix))}</li>
% if master.viewable and request.has_perm('{}.view'.format(permission_prefix)):

View file

@ -11,7 +11,7 @@
% if master.rows_deletable and instance_deletable and request.has_perm('{}.delete'.format(permission_prefix)):
<li>${h.link_to("Delete this {}".format(model_title), action_url('delete', instance))}</li>
% endif
% if master.rows_creatable and request.has_perm('{}.create'.format(permission_prefix)):
% if rows_creatable and request.has_perm('{}.create'.format(permission_prefix)):
<li>${h.link_to("Create a new {}".format(model_title), url('{}.create'.format(route_prefix)))}</li>
% endif
</%def>

View file

@ -50,10 +50,16 @@
</ul>
<div class="form-wrapper">
${form.render(buttons=capture(buttons))|n}
</div><!-- form-wrapper -->
% if master.edit_with_rows:
${form.render(buttons=capture(buttons))|n}
% else:
${form.render()|n}
% endif
</div>
${rows_grid.render_complete(allow_save_defaults=False, tools=capture(self.grid_tools))|n}
% if master.edit_with_rows:
${rows_grid.render_complete(allow_save_defaults=False, tools=capture(self.grid_tools))|n}
% endif
<div id="execution-options-dialog" style="display: none;">

View file

@ -5,6 +5,7 @@
${parent.head_tags()}
<script type="text/javascript">
$(function() {
$('#order-form').click(function() {
% if vendor_cost_count > 199:
if (! confirm("This vendor has ${'{:,d}'.format(vendor_cost_count)} cost records.\n\n" +
@ -14,14 +15,15 @@
}
% endif
$(this).button('disable').button('option', 'label', "Working, please wait...");
location.href = '${url('purchases.batch.order_form', uuid=instance.uuid)}';
location.href = '${url('purchases.batch.order_form', uuid=batch.uuid)}';
});
});
</script>
</%def>
<%def name="leading_buttons()">
% if not instance.executed and request.has_perm('purchases.batch.order_form'):
% if not batch.complete and not batch.executed and request.has_perm('purchases.batch.order_form'):
<button type="button" id="order-form">View as Order Form</button>
% endif
</%def>