Add button to confirm all costs for receiving

This commit is contained in:
Lance Edgar 2023-11-01 20:53:11 -05:00
parent 7ab3d2b635
commit 55a115e57a
2 changed files with 156 additions and 47 deletions

View file

@ -36,57 +36,105 @@
% endif
</%def>
<%def name="render_auto_receive_helper()">
% if master.has_perm('auto_receive') and master.can_auto_receive(batch):
<%def name="render_tools_helper()">
% if allow_confirm_all_costs or (master.has_perm('auto_receive') and master.can_auto_receive(batch)):
<div class="object-helper">
<h3>Tools</h3>
<div class="object-helper-content">
<b-button type="is-primary"
@click="autoReceiveShowDialog = true"
icon-pack="fas"
icon-left="check">
Auto-Receive All Items
</b-button>
<div class="object-helper-content"
style="display: flex; flex-direction: column; gap: 1rem;">
% if allow_confirm_all_costs:
<b-button type="is-primary"
icon-pack="fas"
icon-left="check"
@click="confirmAllCostsShowDialog = true">
Confirm All Costs
</b-button>
<b-modal has-modal-card
:active.sync="confirmAllCostsShowDialog">
<div class="modal-card">
<header class="modal-card-head">
<p class="modal-card-title">Confirm All Costs</p>
</header>
<section class="modal-card-body">
<p class="block">
You can automatically mark all catalog and invoice
cost amounts as "confirmed" if you wish.
</p>
<p class="block">
Would you like to do this?
</p>
</section>
<footer class="modal-card-foot">
<b-button @click="confirmAllCostsShowDialog = false">
Cancel
</b-button>
${h.form(url(f'{route_prefix}.confirm_all_costs', uuid=batch.uuid), **{'@submit': 'confirmAllCostsSubmitting = true'})}
${h.csrf_token(request)}
<b-button type="is-primary"
native-type="submit"
:disabled="confirmAllCostsSubmitting"
icon-pack="fas"
icon-left="check">
{{ confirmAllCostsSubmitting ? "Working, please wait..." : "Confirm All" }}
</b-button>
${h.end_form()}
</footer>
</div>
</b-modal>
% endif
% if master.has_perm('auto_receive') and master.can_auto_receive(batch):
<b-button type="is-primary"
@click="autoReceiveShowDialog = true"
icon-pack="fas"
icon-left="check">
Auto-Receive All Items
</b-button>
<b-modal has-modal-card
:active.sync="autoReceiveShowDialog">
<div class="modal-card">
<header class="modal-card-head">
<p class="modal-card-title">Auto-Receive All Items</p>
</header>
<section class="modal-card-body">
<p class="block">
You can automatically set the "received" quantity to
match the "shipped" quantity for all items, based on
the invoice.
</p>
<p class="block">
Would you like to do so?
</p>
</section>
<footer class="modal-card-foot">
<b-button @click="autoReceiveShowDialog = false">
Cancel
</b-button>
${h.form(url('{}.auto_receive'.format(route_prefix), uuid=batch.uuid), **{'@submit': 'autoReceiveSubmitting = true'})}
${h.csrf_token(request)}
<b-button type="is-primary"
native-type="submit"
:disabled="autoReceiveSubmitting"
icon-pack="fas"
icon-left="check">
{{ autoReceiveSubmitting ? "Working, please wait..." : "Auto-Receive All Items" }}
</b-button>
${h.end_form()}
</footer>
</div>
</b-modal>
% endif
</div>
</div>
<b-modal has-modal-card
:active.sync="autoReceiveShowDialog">
<div class="modal-card">
<header class="modal-card-head">
<p class="modal-card-title">Auto-Receive All Items</p>
</header>
<section class="modal-card-body">
<p class="block">
You can automatically set the "received" quantity to
match the "shipped" quantity for all items, based on
the invoice.
</p>
<p class="block">
Would you like to do so?
</p>
</section>
<footer class="modal-card-foot">
<b-button @click="autoReceiveShowDialog = false">
Cancel
</b-button>
${h.form(url('{}.auto_receive'.format(route_prefix), uuid=batch.uuid), **{'@submit': 'autoReceiveSubmitting = true'})}
${h.csrf_token(request)}
<b-button type="is-primary"
native-type="submit"
:disabled="autoReceiveSubmitting"
icon-pack="fas"
icon-left="check">
{{ autoReceiveSubmitting ? "Working, please wait..." : "Auto-Receive All Items" }}
</b-button>
${h.end_form()}
</footer>
</div>
</b-modal>
% endif
</%def>
@ -117,13 +165,20 @@
${self.render_status_breakdown()}
${self.render_po_vs_invoice_helper()}
${self.render_execute_helper()}
${self.render_auto_receive_helper()}
${self.render_tools_helper()}
</%def>
<%def name="modify_this_page_vars()">
${parent.modify_this_page_vars()}
<script type="text/javascript">
% if allow_confirm_all_costs:
ThisPageData.confirmAllCostsShowDialog = false
ThisPageData.confirmAllCostsSubmitting = false
% endif
ThisPageData.autoReceiveShowDialog = false
ThisPageData.autoReceiveSubmitting = false