Make "view row" prettier for receiving batch, for buefy themes
this seems like a good direction; should make "receive product" and "declare item" use b-modal on same page probably
This commit is contained in:
parent
be92075abb
commit
e906c01e64
|
@ -286,17 +286,15 @@
|
||||||
<%def name="object_helpers()">
|
<%def name="object_helpers()">
|
||||||
${parent.object_helpers()}
|
${parent.object_helpers()}
|
||||||
% if master.has_perm('auto_receive') and master.can_auto_receive(batch):
|
% if master.has_perm('auto_receive') and master.can_auto_receive(batch):
|
||||||
|
|
||||||
<div class="object-helper">
|
<div class="object-helper">
|
||||||
<h3>Tools</h3>
|
<h3>Tools</h3>
|
||||||
<div class="object-helper-content">
|
<div class="object-helper-content">
|
||||||
% if use_buefy:
|
% if use_buefy:
|
||||||
${h.form(url('{}.auto_receive'.format(route_prefix), uuid=batch.uuid), ref='auto_receive_all_form')}
|
<b-button type="is-primary"
|
||||||
${h.csrf_token(request)}
|
@click="autoReceiveShowDialog = true">
|
||||||
<once-button type="is-primary"
|
Auto-Receive All Items
|
||||||
@click="$refs.auto_receive_all_form.submit()"
|
</b-button>
|
||||||
text="Auto-Receive All Items">
|
|
||||||
</once-button>
|
|
||||||
${h.end_form()}
|
|
||||||
% else:
|
% else:
|
||||||
${h.form(url('{}.auto_receive'.format(route_prefix), uuid=batch.uuid), class_='autodisable')}
|
${h.form(url('{}.auto_receive'.format(route_prefix), uuid=batch.uuid), class_='autodisable')}
|
||||||
${h.csrf_token(request)}
|
${h.csrf_token(request)}
|
||||||
|
@ -305,9 +303,58 @@
|
||||||
% endif
|
% endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
% if use_buefy:
|
||||||
|
<b-modal has-modal-card
|
||||||
|
:active.sync="autoReceiveShowDialog">
|
||||||
|
<div class="modal-card">
|
||||||
|
|
||||||
|
<header class="modal-card-head">
|
||||||
|
<p class="modal-card-title">Auto-Receive All Items</p>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<section class="modal-card-body">
|
||||||
|
<p class="block">
|
||||||
|
You can automatically mark all items as having been
|
||||||
|
received normally.
|
||||||
|
</p>
|
||||||
|
<p class="block">
|
||||||
|
Would you like to do so?
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<footer class="modal-card-foot">
|
||||||
|
<b-button @click="autoReceiveShowDialog = false">
|
||||||
|
Cancel
|
||||||
|
</b-button>
|
||||||
|
${h.form(url('{}.auto_receive'.format(route_prefix), uuid=batch.uuid))}
|
||||||
|
${h.csrf_token(request)}
|
||||||
|
<b-button type="is-primary"
|
||||||
|
native-type="submit"
|
||||||
|
:disabled="autoReceiveSubmitting"
|
||||||
|
@click="autoReceiveSubmitting = true"
|
||||||
|
icon-pack="fas"
|
||||||
|
icon-left="arrow-circle-right">
|
||||||
|
{{ autoReceiveSubmitting ? "Working, please wait..." : "Auto-Receive All Items" }}
|
||||||
|
</b-button>
|
||||||
|
${h.end_form()}
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</b-modal>
|
||||||
|
% endif
|
||||||
% endif
|
% endif
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
|
<%def name="modify_this_page_vars()">
|
||||||
|
${parent.modify_this_page_vars()}
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
ThisPageData.autoReceiveShowDialog = false
|
||||||
|
ThisPageData.autoReceiveSubmitting = false
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</%def>
|
||||||
|
|
||||||
|
|
||||||
${parent.body()}
|
${parent.body()}
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,77 @@
|
||||||
## -*- coding: utf-8; -*-
|
## -*- coding: utf-8; -*-
|
||||||
<%inherit file="/master/view_row.mako" />
|
<%inherit file="/master/view_row.mako" />
|
||||||
|
|
||||||
|
<%def name="extra_styles()">
|
||||||
|
${parent.extra_styles()}
|
||||||
|
<style type="text/css">
|
||||||
|
% if use_buefy:
|
||||||
|
nav.panel {
|
||||||
|
margin: 0.5rem;
|
||||||
|
}
|
||||||
|
% endif
|
||||||
|
</style>
|
||||||
|
</%def>
|
||||||
|
|
||||||
<%def name="object_helpers()">
|
<%def name="object_helpers()">
|
||||||
${parent.object_helpers()}
|
${parent.object_helpers()}
|
||||||
% if not batch.executed and not batch.is_truck_dump_child():
|
% if not use_buefy and master.row_editable(row) and not batch.is_truck_dump_child():
|
||||||
<div class="object-helper">
|
<div class="object-helper">
|
||||||
<h3>Receiving Tools</h3>
|
<h3>Receiving Tools</h3>
|
||||||
<div class="object-helper-content">
|
<div class="object-helper-content">
|
||||||
<div style="white-space: nowrap;">
|
<div style="white-space: nowrap;">
|
||||||
% if use_buefy:
|
${h.link_to("Receive Product", url('{}.receive_row'.format(route_prefix), uuid=batch.uuid, row_uuid=row.uuid), class_='button autodisable')}
|
||||||
|
${h.link_to("Declare Credit", url('{}.declare_credit'.format(route_prefix), uuid=batch.uuid, row_uuid=row.uuid), class_='button autodisable')}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
% endif
|
||||||
|
</%def>
|
||||||
|
|
||||||
|
<%def name="page_content()">
|
||||||
|
% if use_buefy:
|
||||||
|
|
||||||
|
<b-field grouped>
|
||||||
|
${form.render_field_readonly('sequence')}
|
||||||
|
${form.render_field_readonly('status_code')}
|
||||||
|
</b-field>
|
||||||
|
|
||||||
|
<div style="display: flex;">
|
||||||
|
|
||||||
|
<nav class="panel">
|
||||||
|
<p class="panel-heading">Product</p>
|
||||||
|
<div class="panel-block">
|
||||||
|
<div style="display: flex;">
|
||||||
|
<div>
|
||||||
|
% if not row.product:
|
||||||
|
${form.render_field_readonly('item_entry')}
|
||||||
|
% endif
|
||||||
|
${form.render_field_readonly('upc')}
|
||||||
|
${form.render_field_readonly('vendor_code')}
|
||||||
|
${form.render_field_readonly('product')}
|
||||||
|
${form.render_field_readonly('case_quantity')}
|
||||||
|
${form.render_field_readonly('catalog_unit_cost')}
|
||||||
|
</div>
|
||||||
|
% if image_url:
|
||||||
|
<div class="is-pulled-right">
|
||||||
|
${h.image(image_url, "Product Image")}
|
||||||
|
</div>
|
||||||
|
% endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<nav class="panel">
|
||||||
|
<p class="panel-heading">Quantities</p>
|
||||||
|
<div class="panel-block">
|
||||||
|
<div>
|
||||||
|
${form.render_field_readonly('ordered')}
|
||||||
|
${form.render_field_readonly('shipped')}
|
||||||
|
${form.render_field_readonly('received')}
|
||||||
|
${form.render_field_readonly('damaged')}
|
||||||
|
${form.render_field_readonly('expired')}
|
||||||
|
${form.render_field_readonly('mispick')}
|
||||||
|
|
||||||
|
<div class="buttons">
|
||||||
<once-button type="is-primary"
|
<once-button type="is-primary"
|
||||||
tag="a" href="${url('{}.receive_row'.format(route_prefix), uuid=batch.uuid, row_uuid=row.uuid)}"
|
tag="a" href="${url('{}.receive_row'.format(route_prefix), uuid=batch.uuid, row_uuid=row.uuid)}"
|
||||||
text="Receive Product">
|
text="Receive Product">
|
||||||
|
@ -17,14 +80,56 @@
|
||||||
tag="a" href="${url('{}.declare_credit'.format(route_prefix), uuid=batch.uuid, row_uuid=row.uuid)}"
|
tag="a" href="${url('{}.declare_credit'.format(route_prefix), uuid=batch.uuid, row_uuid=row.uuid)}"
|
||||||
text="Declare Credit">
|
text="Declare Credit">
|
||||||
</once-button>
|
</once-button>
|
||||||
% else:
|
</div>
|
||||||
${h.link_to("Receive Product", url('{}.receive_row'.format(route_prefix), uuid=batch.uuid, row_uuid=row.uuid), class_='button autodisable')}
|
|
||||||
${h.link_to("Declare Credit", url('{}.declare_credit'.format(route_prefix), uuid=batch.uuid, row_uuid=row.uuid), class_='button autodisable')}
|
</div>
|
||||||
% endif
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="display: flex;">
|
||||||
|
|
||||||
|
<nav class="panel" >
|
||||||
|
<p class="panel-heading">Purchase Order</p>
|
||||||
|
<div class="panel-block">
|
||||||
|
<div>
|
||||||
|
${form.render_field_readonly('po_line_number')}
|
||||||
|
${form.render_field_readonly('po_unit_cost')}
|
||||||
|
${form.render_field_readonly('po_total')}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<nav class="panel" >
|
||||||
|
<p class="panel-heading">Invoice</p>
|
||||||
|
<div class="panel-block">
|
||||||
|
<div>
|
||||||
|
${form.render_field_readonly('invoice_line_number')}
|
||||||
|
${form.render_field_readonly('invoice_unit_cost')}
|
||||||
|
${form.render_field_readonly('invoice_cost_confirmed')}
|
||||||
|
${form.render_field_readonly('invoice_total')}
|
||||||
|
${form.render_field_readonly('invoice_total_calculated')}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<nav class="panel" >
|
||||||
|
<p class="panel-heading">Credits</p>
|
||||||
|
<div class="panel-block">
|
||||||
|
<div>
|
||||||
|
${form.render_field_readonly('credits')}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</nav>
|
||||||
|
|
||||||
|
% else:
|
||||||
|
## legacy / not buefy
|
||||||
|
${parent.page_content()}
|
||||||
% endif
|
% endif
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
|
|
||||||
${parent.body()}
|
${parent.body()}
|
||||||
|
|
|
@ -129,14 +129,19 @@ class PurchasingBatchView(BatchMasterView):
|
||||||
'description',
|
'description',
|
||||||
'size',
|
'size',
|
||||||
'case_quantity',
|
'case_quantity',
|
||||||
|
'ordered',
|
||||||
'cases_ordered',
|
'cases_ordered',
|
||||||
'units_ordered',
|
'units_ordered',
|
||||||
|
'received',
|
||||||
'cases_received',
|
'cases_received',
|
||||||
'units_received',
|
'units_received',
|
||||||
|
'damaged',
|
||||||
'cases_damaged',
|
'cases_damaged',
|
||||||
'units_damaged',
|
'units_damaged',
|
||||||
|
'expired',
|
||||||
'cases_expired',
|
'cases_expired',
|
||||||
'units_expired',
|
'units_expired',
|
||||||
|
'mispick',
|
||||||
'cases_mispick',
|
'cases_mispick',
|
||||||
'units_mispick',
|
'units_mispick',
|
||||||
'po_line_number',
|
'po_line_number',
|
||||||
|
@ -699,6 +704,13 @@ class PurchasingBatchView(BatchMasterView):
|
||||||
f.set_readonly('case_quantity')
|
f.set_readonly('case_quantity')
|
||||||
|
|
||||||
# quantity fields
|
# quantity fields
|
||||||
|
f.set_renderer('ordered', self.render_row_quantity)
|
||||||
|
f.set_renderer('shipped', self.render_row_quantity)
|
||||||
|
f.set_renderer('received', self.render_row_quantity)
|
||||||
|
f.set_renderer('damaged', self.render_row_quantity)
|
||||||
|
f.set_renderer('expired', self.render_row_quantity)
|
||||||
|
f.set_renderer('mispick', self.render_row_quantity)
|
||||||
|
|
||||||
f.set_type('case_quantity', 'quantity')
|
f.set_type('case_quantity', 'quantity')
|
||||||
f.set_type('cases_ordered', 'quantity')
|
f.set_type('cases_ordered', 'quantity')
|
||||||
f.set_type('units_ordered', 'quantity')
|
f.set_type('units_ordered', 'quantity')
|
||||||
|
@ -770,6 +782,18 @@ class PurchasingBatchView(BatchMasterView):
|
||||||
else:
|
else:
|
||||||
f.remove_field('product')
|
f.remove_field('product')
|
||||||
|
|
||||||
|
def render_row_quantity(self, row, field):
|
||||||
|
app = self.get_rattail_app()
|
||||||
|
cases = getattr(row, 'cases_{}'.format(field))
|
||||||
|
units = getattr(row, 'units_{}'.format(field))
|
||||||
|
if cases and units:
|
||||||
|
return "{} cases + {} units".format(app.render_quantity(cases),
|
||||||
|
app.render_quantity(units))
|
||||||
|
if cases and not units:
|
||||||
|
return "{} cases".format(app.render_quantity(cases))
|
||||||
|
if units and not cases:
|
||||||
|
return "{} units".format(app.render_quantity(units))
|
||||||
|
|
||||||
def render_row_credits(self, row, field):
|
def render_row_credits(self, row, field):
|
||||||
if not row.credits:
|
if not row.credits:
|
||||||
return ""
|
return ""
|
||||||
|
|
|
@ -163,18 +163,25 @@ class ReceivingBatchView(PurchasingBatchView):
|
||||||
'description',
|
'description',
|
||||||
'size',
|
'size',
|
||||||
'case_quantity',
|
'case_quantity',
|
||||||
|
'ordered',
|
||||||
'cases_ordered',
|
'cases_ordered',
|
||||||
'units_ordered',
|
'units_ordered',
|
||||||
|
'shipped',
|
||||||
'cases_shipped',
|
'cases_shipped',
|
||||||
'units_shipped',
|
'units_shipped',
|
||||||
|
'received',
|
||||||
'cases_received',
|
'cases_received',
|
||||||
'units_received',
|
'units_received',
|
||||||
|
'damaged',
|
||||||
'cases_damaged',
|
'cases_damaged',
|
||||||
'units_damaged',
|
'units_damaged',
|
||||||
|
'expired',
|
||||||
'cases_expired',
|
'cases_expired',
|
||||||
'units_expired',
|
'units_expired',
|
||||||
|
'mispick',
|
||||||
'cases_mispick',
|
'cases_mispick',
|
||||||
'units_mispick',
|
'units_mispick',
|
||||||
|
'catalog_unit_cost',
|
||||||
'po_line_number',
|
'po_line_number',
|
||||||
'po_unit_cost',
|
'po_unit_cost',
|
||||||
'po_total',
|
'po_total',
|
||||||
|
@ -607,6 +614,19 @@ class ReceivingBatchView(PurchasingBatchView):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
|
def template_kwargs_view_row(self, **kwargs):
|
||||||
|
kwargs = super(ReceivingBatchView, self).template_kwargs_view_row(**kwargs)
|
||||||
|
app = self.get_rattail_app()
|
||||||
|
handler = app.get_products_handler()
|
||||||
|
row = kwargs['instance']
|
||||||
|
|
||||||
|
if row.product:
|
||||||
|
kwargs['image_url'] = handler.get_image_url(row.product)
|
||||||
|
elif row.upc:
|
||||||
|
kwargs['image_url'] = handler.get_image_url(upc=row.upc)
|
||||||
|
|
||||||
|
return kwargs
|
||||||
|
|
||||||
def department_for_purchase(self, purchase):
|
def department_for_purchase(self, purchase):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -816,6 +836,8 @@ class ReceivingBatchView(PurchasingBatchView):
|
||||||
return css_class
|
return css_class
|
||||||
|
|
||||||
def get_row_instance_title(self, row):
|
def get_row_instance_title(self, row):
|
||||||
|
if row.product:
|
||||||
|
return six.text_type(row.product)
|
||||||
if row.upc:
|
if row.upc:
|
||||||
return row.upc.pretty()
|
return row.upc.pretty()
|
||||||
return super(ReceivingBatchView, self).get_row_instance_title(row)
|
return super(ReceivingBatchView, self).get_row_instance_title(row)
|
||||||
|
|
Loading…
Reference in a new issue