From c611eb378770c9b52d610274ee0d082158854016 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 6 Oct 2021 18:43:52 -0400 Subject: [PATCH] Clear out contact for custorder if user clicks "customer is unknown" also show pending customer reference when viewing proper custorder --- tailbone/templates/custorders/create.mako | 10 ++++++++++ tailbone/views/custorders/orders.py | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/tailbone/templates/custorders/create.mako b/tailbone/templates/custorders/create.mako index d921779e..194ec600 100644 --- a/tailbone/templates/custorders/create.mako +++ b/tailbone/templates/custorders/create.mako @@ -892,6 +892,16 @@ this.customerPanelOpen = true } }, + watch: { + contactIsKnown: function(val) { + // if user has already specified a proper contact, then + // clicks the "contact is unknown" button, then we want + // to *clear out* the existing contact + if (!val && this.contactUUID) { + this.contactChanged(null) + } + }, + }, methods: { startOverEntirely() { diff --git a/tailbone/views/custorders/orders.py b/tailbone/views/custorders/orders.py index 1c6aed08..58f33b32 100644 --- a/tailbone/views/custorders/orders.py +++ b/tailbone/views/custorders/orders.py @@ -68,6 +68,7 @@ class CustomerOrderView(MasterView): 'store', 'customer', 'person', + 'pending_customer', 'phone_number', 'email_address', 'total_price', @@ -134,6 +135,7 @@ class CustomerOrderView(MasterView): f.set_renderer('store', self.render_store) f.set_renderer('customer', self.render_customer) f.set_renderer('person', self.render_person) + f.set_renderer('pending_customer', self.render_pending_customer) f.set_type('total_price', 'currency') @@ -152,6 +154,14 @@ class CustomerOrderView(MasterView): url = self.request.route_url('people.view', uuid=person.uuid) return tags.link_to(text, url) + def render_pending_customer(self, batch, field): + pending = batch.pending_customer + if not pending: + return + text = six.text_type(pending) + url = self.request.route_url('pending_customers.view', uuid=pending.uuid) + return tags.link_to(text, url) + def get_row_data(self, order): return self.Session.query(model.CustomerOrderItem)\ .filter(model.CustomerOrderItem.order == order)