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:
return ''
# TODO: fair bit of duplication here, should merge with deform.mako
label = kwargs.get('label')
if not label:
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)
field = self.render_field_value(field_name) or ''
field_div = HTML.tag('div', class_='field', c=[field])
field_div = HTML.tag('div', class_='field', c=[value])
contents = [label, field_div]
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)
# oruga uses <o-field>
return HTML.tag('o-field', label=label, c=[value], **{':horizontal': 'true'})
def render_field_value(self, field_name):
record = self.model_instance
if self.renderers and field_name in self.renderers:

View file

@ -60,8 +60,12 @@
<nav class="panel">
<p class="panel-heading">Product</p>
<div class="panel-block">
<div style="display: flex;">
<div>
<div style="display: flex; gap: 1rem;">
<div style="flex-grow: 1;"
% if request.use_oruga:
class="form-wrapper"
% endif
>
${form.render_field_readonly('item_entry')}
% if row.product:
${form.render_field_readonly(product_key_field)}
@ -80,7 +84,7 @@
${form.render_field_readonly('catalog_unit_cost')}
</div>
% if image_url:
<div class="is-pulled-right">
<div>
${h.image(image_url, "Product Image", width=150, height=150)}
</div>
% endif
@ -429,7 +433,11 @@
<nav class="panel" >
<p class="panel-heading">Purchase Order</p>
<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_unit_cost')}
${form.render_field_readonly('po_case_size')}
@ -443,7 +451,11 @@
<nav class="panel" >
<p class="panel-heading">Invoice</p>
<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_line_number')}
${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 {
.form-wrapper .field.is-horizontal .field-label {
text-align: left;
white-space: nowrap;
min-width: 18em;

View file

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