Add "mark complete" button for inventory batch row entry page
This commit is contained in:
parent
d84b98041f
commit
2f4877a264
|
@ -3,9 +3,35 @@
|
|||
|
||||
<%def name="title()">Inventory Form</%def>
|
||||
|
||||
<%def name="context_menu_items()">
|
||||
${parent.context_menu_items()}
|
||||
<li>${h.link_to("Back to Inventory Batch", url('batch.inventory.view', uuid=batch.uuid))}</li>
|
||||
<%def name="object_helpers()">
|
||||
<nav class="panel">
|
||||
<p class="panel-heading">Batch</p>
|
||||
<div class="panel-block buttons">
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
|
||||
<once-button type="is-primary"
|
||||
icon-left="eye"
|
||||
tag="a" href="${url('batch.inventory.view', uuid=batch.uuid)}"
|
||||
text="View Batch">
|
||||
</once-button>
|
||||
|
||||
% if not batch.executed and master.has_perm('edit'):
|
||||
${h.form(master.get_action_url('toggle_complete', batch), **{'@submit': 'toggleCompleteSubmitting = true'})}
|
||||
${h.csrf_token(request)}
|
||||
${h.hidden('complete', value='true')}
|
||||
<b-button type="is-primary"
|
||||
native-type="submit"
|
||||
icon-pack="fas"
|
||||
icon-left="check"
|
||||
:disabled="toggleCompleteSubmitting">
|
||||
{{ toggleCompleteSubmitting ? "Working, please wait..." : "Mark Complete" }}
|
||||
</b-button>
|
||||
${h.end_form()}
|
||||
% endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</%def>
|
||||
|
||||
<%def name="render_form()">
|
||||
|
@ -123,6 +149,7 @@
|
|||
|
||||
let ${form.component_studly} = {
|
||||
template: '#${form.component}-template',
|
||||
mixins: [SimpleRequestMixin],
|
||||
|
||||
mounted() {
|
||||
this.$refs.productUPC.focus()
|
||||
|
@ -195,15 +222,9 @@
|
|||
let params = {
|
||||
upc: this.productUPC,
|
||||
}
|
||||
this.$http.get(url, {params: params}).then(response => {
|
||||
this.simpleGET(url, params, response => {
|
||||
|
||||
if (response.data.error) {
|
||||
alert(response.data.error)
|
||||
if (response.data.redirect) {
|
||||
location.href = response.data.redirect
|
||||
}
|
||||
|
||||
} else if (response.data.product.uuid) {
|
||||
if (response.data.product.uuid) {
|
||||
|
||||
this.productUPC = response.data.product.upc_pretty
|
||||
this.productInfo = response.data.product
|
||||
|
@ -238,6 +259,19 @@
|
|||
} else {
|
||||
## this.productNotFound = true
|
||||
alert("Product not found!")
|
||||
|
||||
// focus/select UPC entry
|
||||
this.$refs.productUPC.focus()
|
||||
// nb. must traverse into the <b-input> element
|
||||
this.$refs.productUPC.$el.firstChild.select()
|
||||
}
|
||||
|
||||
}, response => {
|
||||
if (response.data.error) {
|
||||
alert(response.data.error)
|
||||
if (response.data.redirect) {
|
||||
location.href = response.data.redirect
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
@ -263,5 +297,14 @@
|
|||
</script>
|
||||
</%def>
|
||||
|
||||
<%def name="modify_this_page_vars()">
|
||||
${parent.modify_this_page_vars()}
|
||||
<script type="text/javascript">
|
||||
|
||||
ThisPageData.toggleCompleteSubmitting = false
|
||||
|
||||
</script>
|
||||
</%def>
|
||||
|
||||
|
||||
${parent.body()}
|
||||
|
|
|
@ -228,7 +228,7 @@ class InventoryBatchView(BatchMasterView):
|
|||
Desktop workflow view for adding items to inventory batch.
|
||||
"""
|
||||
batch = self.get_instance()
|
||||
if batch.executed:
|
||||
if batch.executed or batch.complete:
|
||||
return self.redirect(self.get_action_url('view', batch))
|
||||
|
||||
schema = DesktopForm().bind(session=self.Session())
|
||||
|
@ -360,11 +360,17 @@ class InventoryBatchView(BatchMasterView):
|
|||
|
||||
# TODO: deprecate / remove (?)
|
||||
def find_product(self, entry):
|
||||
lookup_by_code = self.rattail_config.getbool(
|
||||
'tailbone', 'inventory.lookup_by_code', default=False)
|
||||
lookup_fields = [
|
||||
'uuid',
|
||||
'_product_key_',
|
||||
]
|
||||
|
||||
return self.handler.locate_product_for_entry(
|
||||
self.Session(), entry, lookup_by_code=lookup_by_code)
|
||||
if self.rattail_config.getbool('tailbone', 'inventory.lookup_by_code',
|
||||
default=False):
|
||||
lookup_fields.append('alt_code')
|
||||
|
||||
return self.handler.locate_product_for_entry(self.Session(), entry,
|
||||
lookup_fields=lookup_fields)
|
||||
|
||||
def product_info(self, product):
|
||||
data = {}
|
||||
|
|
Loading…
Reference in a new issue