Show some more product attributes in custorder item selection popup

This commit is contained in:
Lance Edgar 2021-11-06 17:37:05 -05:00
parent 7a5ba0503a
commit 43bbc2a29e
2 changed files with 79 additions and 2 deletions

View file

@ -531,18 +531,35 @@
<div class="is-pulled-right has-text-centered">
<img :src="productImageURL"
style="height: 150px; width: 150px; "/>
<p>{{ productKey }}</p>
## <p>{{ productKey }}</p>
</div>
<b-field grouped>
<b-field :label="productKeyLabel">
<span>{{ productKey }}</span>
</b-field>
<b-field label="Unit Size">
<span>{{ productSize }}</span>
</b-field>
<b-field label="Unit Price">
<span :class="productPriceNeedsConfirmation ? 'has-background-warning' : ''">
<span
% if product_price_may_be_questionable:
:class="productPriceNeedsConfirmation ? 'has-background-warning' : ''"
% endif
>
{{ productUnitPriceDisplay }}
</span>
</b-field>
<!-- <b-field label="Last Changed"> -->
<!-- <span>2021-01-01</span> -->
<!-- </b-field> -->
<b-field label="Case Size">
<span>{{ productCaseQuantity }}</span>
</b-field>
</b-field>
% if product_price_may_be_questionable:
@ -568,6 +585,12 @@
</b-tab-item>
<b-tab-item label="Quantity">
<b-field grouped>
<b-field label="Product" horizontal>
<span>{{ productDisplay }}</span>
</b-field>
</b-field>
<b-field grouped>
<b-field label="Quantity" horizontal>
@ -583,6 +606,39 @@
</b-select>
</b-field>
<b-field grouped>
<b-field label="Unit Size">
<span>{{ productSize }}</span>
</b-field>
<b-field label="Unit Price">
<span
% if product_price_may_be_questionable:
:class="productPriceNeedsConfirmation ? 'has-background-warning' : ''"
% endif
>
{{ productUnitPriceDisplay }}
</span>
</b-field>
<b-field label="Case Size">
<span>{{ productCaseQuantity }}</span>
</b-field>
<b-field label="Case Price">
<span
% if product_price_may_be_questionable:
:class="productPriceNeedsConfirmation ? 'has-background-warning' : ''"
% endif
>
{{ productCasePriceDisplay }}
</span>
</b-field>
</b-field>
</b-tab-item>
</b-tabs>
@ -765,7 +821,11 @@
productDisplay: null,
productUPC: null,
productKey: null,
productKeyLabel: ${json.dumps(product_key_label)|n},
productSize: null,
productCaseQuantity: null,
productUnitPriceDisplay: null,
productCasePriceDisplay: null,
productURL: null,
productImageURL: null,
productQuantity: null,
@ -1305,7 +1365,10 @@
this.productDisplay = null
this.productUPC = null
this.productKey = null
this.productSize = null
this.productCaseQuantity = null
this.productUnitPriceDisplay = null
this.productCasePriceDisplay = null
this.productQuantity = 1
this.productUnitChoices = this.defaultUnitChoices
this.productUOM = this.defaultUOM
@ -1328,8 +1391,11 @@
this.productDisplay = row.product_full_description
this.productUPC = row.product_upc_pretty || row.product_upc
this.productKey = row.product_key
this.productSize = row.product_size
this.productCaseQuantity = row.case_quantity
this.productURL = row.product_url
this.productUnitPriceDisplay = row.unit_price_display
this.productCasePriceDisplay = row.case_price_display
this.productImageURL = row.product_image_url
this.productQuantity = row.order_quantity
this.productUnitChoices = row.order_uom_choices
@ -1370,7 +1436,10 @@
this.productDisplay = null
this.productUPC = null
this.productKey = null
this.productSize = null
this.productCaseQuantity = null
this.productUnitPriceDisplay = null
this.productCasePriceDisplay = null
this.productURL = null
this.productImageURL = null
this.productUnitChoices = this.defaultUnitChoices
@ -1412,7 +1481,10 @@
this.productUPC = response.data.upc_pretty
this.productKey = response.data.key
this.productDisplay = response.data.full_description
this.productSize = response.data.size
this.productCaseQuantity = response.data.case_quantity
this.productUnitPriceDisplay = response.data.unit_price_display
this.productCasePriceDisplay = response.data.case_price_display
this.productURL = response.data.url
this.productImageURL = response.data.image_url
this.setProductUnitChoices(response.data.uom_choices)

View file

@ -285,6 +285,7 @@ class CustomerOrderView(MasterView):
'allow_contact_info_choice': self.handler.allow_contact_info_choice(),
'restrict_contact_info': self.handler.should_restrict_contact_info(),
'order_items': items,
'product_key_label': self.rattail_config.product_key_title(),
})
return self.render_to_response(template, context)
@ -625,6 +626,10 @@ class CustomerOrderView(MasterView):
'status_text': row.status_text,
}
case_price = self.handler.get_case_price_for_row(row)
data['case_price'] = six.text_type(case_price) if case_price is not None else None
data['case_price_display'] = app.render_currency(case_price)
if self.handler.product_price_may_be_questionable():
data['price_needs_confirmation'] = row.price_needs_confirmation