Fix custom cell click handlers in main buefy grid tables

just used for editing catalog/invoice cost in receiving thus far..
This commit is contained in:
Lance Edgar 2023-08-08 18:06:22 -05:00
parent f2915afda4
commit 845b5cda1a
3 changed files with 22 additions and 10 deletions

View file

@ -180,18 +180,21 @@
% endif
:checkable="checkable"
% if grid.checkboxes:
:checked-rows.sync="checkedRows"
% if grid.clicking_row_checks_box:
@click="rowClick"
% endif
% endif
% if grid.check_handler:
@check="${grid.check_handler}"
% endif
% if grid.check_all_handler:
@check-all="${grid.check_all_handler}"
% endif
% if isinstance(grid.checkable, str):
:is-row-checkable="${grid.row_checkable}"
% elif grid.checkable:
@ -204,6 +207,10 @@
@sort="onSort"
% endif
% if grid.click_handlers:
@cellclick="cellClick"
% endif
:paginated="paginated"
:per-page="perPage"
:current-page="currentPage"
@ -227,9 +234,6 @@
searchable
% endif
cell-class="c_${column['field']}"
% if grid.has_click_handler(column['field']):
@click.native="${grid.click_handlers[column['field']]}"
% endif
:visible="${json.dumps(column['visible'])}">
% if column['field'] in grid.raw_renderers:
${grid.raw_renderers[column['field']]()}
@ -392,6 +396,16 @@
methods: {
% if grid.click_handlers:
cellClick(row, column, rowIndex, columnIndex) {
% for key in grid.click_handlers:
if (column._props.field == '${key}') {
${grid.click_handlers[key]}(row)
}
% endfor
},
% endif
copyDirectLink() {
if (navigator.clipboard) {

View file

@ -103,7 +103,8 @@
ref="input"
v-show="editing"
@keydown.native="inputKeyDown"
@blur="inputBlur">
@blur="inputBlur"
style="width: 6rem;">
</b-input>
</div>
</script>

View file

@ -968,19 +968,16 @@ class ReceivingBatchView(PurchasingBatchView):
g.filters['vendor_code'].default_verb = 'contains'
# catalog_unit_cost
if (self.handler.has_purchase_order(batch)
or self.handler.has_invoice_file(batch)):
g.remove('catalog_unit_cost')
elif self.allow_edit_catalog_unit_cost(batch):
if self.allow_edit_catalog_unit_cost(batch):
g.set_raw_renderer('catalog_unit_cost', self.render_catalog_unit_cost)
g.set_click_handler('catalog_unit_cost',
'catalogUnitCostClicked(props.row)')
'this.catalogUnitCostClicked')
# invoice_unit_cost
if self.allow_edit_invoice_unit_cost(batch):
g.set_raw_renderer('invoice_unit_cost', self.render_invoice_unit_cost)
g.set_click_handler('invoice_unit_cost',
'invoiceUnitCostClicked(props.row)')
'this.invoiceUnitCostClicked')
# nb. only show PO *or* invoice cost; prefer the latter unless
# we have a PO and no invoice