Add way to "ignore" a pending product

and some related tweaks for sake of grid
This commit is contained in:
Lance Edgar 2023-10-26 20:43:12 -05:00
parent 1fc17658ff
commit fe4a178d43
3 changed files with 143 additions and 56 deletions

View file

@ -7,25 +7,16 @@
${product_lookup.tailbone_product_lookup_template()}
</%def>
<%def name="object_helpers()">
${parent.object_helpers()}
% if instance.status_code == enum.PENDING_PRODUCT_STATUS_PENDING and master.has_perm('resolve_product'):
<nav class="panel">
<p class="panel-heading">Tools</p>
<div class="panel-block">
<div style="display: flex; flex-direction: column;">
<div class="buttons">
<b-button type="is-primary"
@click="resolveProductInit()"
icon-pack="fas"
icon-left="object-ungroup">
Resolve Product
</b-button>
</div>
</div>
</div>
</nav>
<%def name="page_content()">
${parent.page_content()}
% if master.has_perm('ignore_product') and instance.status_code in (enum.PENDING_PRODUCT_STATUS_PENDING, enum.PENDING_PRODUCT_STATUS_READY):
${h.form(master.get_action_url('ignore_product', instance), ref='ignoreProductForm')}
${h.csrf_token(request)}
${h.end_form()}
% endif
% if master.has_perm('resolve_product') and instance.status_code in (enum.PENDING_PRODUCT_STATUS_PENDING, enum.PENDING_PRODUCT_STATUS_READY, enum.PENDING_PRODUCT_STATUS_IGNORED):
<b-modal has-modal-card
:active.sync="resolveProductShowDialog">
<div class="modal-card">
@ -80,39 +71,55 @@
${parent.modify_this_page_vars()}
<script type="text/javascript">
ThisPageData.resolveProductShowDialog = false
ThisPageData.resolveProductUUID = null
ThisPageData.resolveProductSubmitting = false
% if master.has_perm('ignore_product') and instance.status_code in (enum.PENDING_PRODUCT_STATUS_PENDING, enum.PENDING_PRODUCT_STATUS_READY):
ThisPage.computed.resolveProductSubmitDisabled = function() {
if (this.resolveProductSubmitting) {
return true
ThisPage.methods.ignoreProductInit = function() {
if (!confirm("Really ignore this product?\n\n"
+ "This will leave it unresolved, but hidden via default filters.")) {
return
}
this.$refs.ignoreProductForm.submit()
}
if (!this.resolveProductUUID) {
return true
% endif
% if master.has_perm('resolve_product') and instance.status_code in (enum.PENDING_PRODUCT_STATUS_PENDING, enum.PENDING_PRODUCT_STATUS_READY, enum.PENDING_PRODUCT_STATUS_IGNORED):
ThisPageData.resolveProductShowDialog = false
ThisPageData.resolveProductUUID = null
ThisPageData.resolveProductSubmitting = false
ThisPage.computed.resolveProductSubmitDisabled = function() {
if (this.resolveProductSubmitting) {
return true
}
if (!this.resolveProductUUID) {
return true
}
return false
}
return false
}
ThisPage.methods.resolveProductInit = function() {
this.resolveProductUUID = null
this.resolveProductShowDialog = true
this.$nextTick(() => {
this.$refs.productLookup.focus()
})
}
ThisPage.methods.resolveProductInit = function() {
this.resolveProductUUID = null
this.resolveProductShowDialog = true
this.$nextTick(() => {
this.$refs.productLookup.focus()
})
}
ThisPage.methods.resolveProductSubmit = function() {
this.resolveProductSubmitting = true
this.$refs.resolveProductForm.submit()
}
ThisPage.methods.resolveProductSubmit = function() {
this.resolveProductSubmitting = true
this.$refs.resolveProductForm.submit()
}
ThisPageData.actualProduct = null
ThisPageData.actualProduct = null
ThisPage.methods.productSelected = function(product) {
this.actualProduct = product
this.resolveProductUUID = product ? product.uuid : null
}
ThisPage.methods.productSelected = function(product) {
this.actualProduct = product
this.resolveProductUUID = product ? product.uuid : null
}
% endif
</script>
</%def>