Add "most of" support for truck dump receiving

still not complete, but conceptually it sort of is...
This commit is contained in:
Lance Edgar 2018-05-18 15:51:47 -05:00
parent 805a1afa3f
commit cd7922f204
8 changed files with 368 additions and 76 deletions

View file

@ -61,7 +61,13 @@
<%def name="execute_button()">
% if not batch.executed and request.has_perm('{}.execute'.format(permission_prefix)):
<button type="button" id="execute-batch"${'' if execute_enabled else ' disabled="disabled"'}>${execute_title}</button>
% if execute_enabled:
<button type="button" id="execute-batch">${execute_title}</button>
% elif why_not_execute:
<button type="button" id="execute-batch" disabled="disabled" title="${why_not_execute}">${execute_title}</button>
% else:
<button type="button" id="execute-batch" disabled="disabled">${execute_title}</button>
% endif
% endif
</%def>

View file

@ -0,0 +1,67 @@
## -*- coding: utf-8; -*-
<%inherit file="/batch/create.mako" />
<%def name="extra_javascript()">
${parent.extra_javascript()}
${self.func_show_batch_type()}
<script type="text/javascript">
% if master.allow_truck_dump:
var batch_vendor_map = ${json.dumps(batch_vendor_map)|n};
% endif
$(function() {
$('.batch_type select').on('selectmenuchange', function(event, ui) {
show_batch_type(ui.item.value);
});
$('.truck_dump_batch_uuid select').on('selectmenuchange', function(event, ui) {
var form = $(this).parents('form');
var uuid = ui.item.value ? batch_vendor_map[ui.item.value] : '';
form.find('input[name="vendor_uuid"]').val(uuid);
});
show_batch_type();
});
</script>
</%def>
<%def name="func_show_batch_type()">
<script type="text/javascript">
function show_batch_type(batch_type) {
if (batch_type === undefined) {
batch_type = $('.field-wrapper.batch_type select').val();
}
if (batch_type == 'from_scratch') {
$('.field-wrapper.truck_dump_batch_uuid').hide();
$('.field-wrapper.invoice_file').hide();
$('.field-wrapper.invoice_parser_key').hide();
$('.field-wrapper.vendor_uuid').show();
$('.field-wrapper.date_ordered').show();
$('.field-wrapper.date_received').show();
$('.field-wrapper.po_number').show();
$('.field-wrapper.invoice_date').show();
$('.field-wrapper.invoice_number').show();
} else if (batch_type == 'truck_dump') {
$('.field-wrapper.truck_dump_batch_uuid').show();
$('.field-wrapper.invoice_file').show();
$('.field-wrapper.invoice_parser_key').show();
$('.field-wrapper.vendor_uuid').hide();
$('.field-wrapper.date_ordered').hide();
$('.field-wrapper.date_received').hide();
$('.field-wrapper.po_number').hide();
$('.field-wrapper.invoice_date').hide();
$('.field-wrapper.invoice_number').hide();
}
}
</script>
</%def>
${parent.body()}