Fix display for "view receiving row" page, per oruga

this page still needs help; "Account for Product" is broken for oruga
This commit is contained in:
Lance Edgar 2024-05-07 12:43:07 -05:00
parent 9cd648f78f
commit d607ab2981
4 changed files with 34 additions and 15 deletions

View file

@ -1139,13 +1139,16 @@ class Form(object):
if field_name not in self.fields: if field_name not in self.fields:
return '' return ''
# TODO: fair bit of duplication here, should merge with deform.mako
label = kwargs.get('label') label = kwargs.get('label')
if not label: if not label:
label = self.get_label(field_name) label = self.get_label(field_name)
value = self.render_field_value(field_name) or ''
if not self.request.use_oruga:
label = HTML.tag('label', label, for_=field_name) label = HTML.tag('label', label, for_=field_name)
field = self.render_field_value(field_name) or '' field_div = HTML.tag('div', class_='field', c=[value])
field_div = HTML.tag('div', class_='field', c=[field])
contents = [label, field_div] contents = [label, field_div]
if self.has_helptext(field_name): if self.has_helptext(field_name):
@ -1154,6 +1157,9 @@ class Form(object):
return HTML.tag('div', class_='field-wrapper {}'.format(field_name), c=contents) return HTML.tag('div', class_='field-wrapper {}'.format(field_name), c=contents)
# oruga uses <o-field>
return HTML.tag('o-field', label=label, c=[value], **{':horizontal': 'true'})
def render_field_value(self, field_name): def render_field_value(self, field_name):
record = self.model_instance record = self.model_instance
if self.renderers and field_name in self.renderers: if self.renderers and field_name in self.renderers:

View file

@ -60,8 +60,12 @@
<nav class="panel"> <nav class="panel">
<p class="panel-heading">Product</p> <p class="panel-heading">Product</p>
<div class="panel-block"> <div class="panel-block">
<div style="display: flex;"> <div style="display: flex; gap: 1rem;">
<div> <div style="flex-grow: 1;"
% if request.use_oruga:
class="form-wrapper"
% endif
>
${form.render_field_readonly('item_entry')} ${form.render_field_readonly('item_entry')}
% if row.product: % if row.product:
${form.render_field_readonly(product_key_field)} ${form.render_field_readonly(product_key_field)}
@ -80,7 +84,7 @@
${form.render_field_readonly('catalog_unit_cost')} ${form.render_field_readonly('catalog_unit_cost')}
</div> </div>
% if image_url: % if image_url:
<div class="is-pulled-right"> <div>
${h.image(image_url, "Product Image", width=150, height=150)} ${h.image(image_url, "Product Image", width=150, height=150)}
</div> </div>
% endif % endif
@ -429,7 +433,11 @@
<nav class="panel" > <nav class="panel" >
<p class="panel-heading">Purchase Order</p> <p class="panel-heading">Purchase Order</p>
<div class="panel-block"> <div class="panel-block">
<div> <div
% if request.use_oruga:
class="form-wrapper"
% endif
>
${form.render_field_readonly('po_line_number')} ${form.render_field_readonly('po_line_number')}
${form.render_field_readonly('po_unit_cost')} ${form.render_field_readonly('po_unit_cost')}
${form.render_field_readonly('po_case_size')} ${form.render_field_readonly('po_case_size')}
@ -443,7 +451,11 @@
<nav class="panel" > <nav class="panel" >
<p class="panel-heading">Invoice</p> <p class="panel-heading">Invoice</p>
<div class="panel-block"> <div class="panel-block">
<div> <div
% if request.use_oruga:
class="form-wrapper"
% endif
>
${form.render_field_readonly('invoice_number')} ${form.render_field_readonly('invoice_number')}
${form.render_field_readonly('invoice_line_number')} ${form.render_field_readonly('invoice_line_number')}
${form.render_field_readonly('invoice_unit_cost')} ${form.render_field_readonly('invoice_unit_cost')}

View file

@ -243,7 +243,7 @@
} }
/* .form-wrapper .form .field.is-horizontal .field-label .label, */ /* .form-wrapper .form .field.is-horizontal .field-label .label, */
.form-wrapper .form .field.is-horizontal .field-label { .form-wrapper .field.is-horizontal .field-label {
text-align: left; text-align: left;
white-space: nowrap; white-space: nowrap;
min-width: 18em; min-width: 18em;

View file

@ -794,6 +794,7 @@ class PurchasingBatchView(BatchMasterView):
g = factory( g = factory(
key='{}.row_credits'.format(route_prefix), key='{}.row_credits'.format(route_prefix),
request=self.request,
data=[], data=[],
columns=[ columns=[
'credit_type', 'credit_type',