From 88f12a98d594684aa9654acf853af89305cb628f Mon Sep 17 00:00:00 2001 From: Kenny Ong Date: Sat, 23 Mar 2019 20:44:36 +0800 Subject: [PATCH 1/3] When the name is empty, display [No Name] Currently showing "*undefined undefined*", feel like a bug, so change it to [No Name] instead. --- .../js/components/order-processing/customers/CustomerEdit.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/js/components/order-processing/customers/CustomerEdit.vue b/resources/assets/js/components/order-processing/customers/CustomerEdit.vue index 87e0241e..6b25da42 100644 --- a/resources/assets/js/components/order-processing/customers/CustomerEdit.vue +++ b/resources/assets/js/components/order-processing/customers/CustomerEdit.vue @@ -92,7 +92,7 @@ }); CandyEvent.$emit('title-changed', { - title: this.customer.details.data.firstname + ' ' + this.customer.details.data.lastname + title: !this.customer.details.data.firstname && !this.customer.details.data.lastname ? '[No Name]' : this.customer.details.data.firstname?this.customer.details.data.firstname:'' + ' ' + this.customer.details.data.lastname?this.customer.details.data.lastname:'' }); let chunkedOrders = _.chunk(this.customer.orders.data, this.ordersPerPage); From dfa8a1657c329d48edc00539cbc8f410db26db6e Mon Sep 17 00:00:00 2001 From: Kenny Ong Date: Sat, 23 Mar 2019 21:00:34 +0800 Subject: [PATCH 2/3] Tidy Code with using methods --- .../components/order-processing/customers/CustomerEdit.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/resources/assets/js/components/order-processing/customers/CustomerEdit.vue b/resources/assets/js/components/order-processing/customers/CustomerEdit.vue index 6b25da42..57993a1a 100644 --- a/resources/assets/js/components/order-processing/customers/CustomerEdit.vue +++ b/resources/assets/js/components/order-processing/customers/CustomerEdit.vue @@ -44,7 +44,10 @@ mounted() { Dispatcher.add('save-customer', this); }, - methods: { + methods: { + displayName() { + return !this.customer.details.data.firstname && !this.customer.details.data.lastname ? '[No Name]' : this.customer.details.data.firstname?this.customer.details.data.firstname:'' + ' ' + this.customer.details.data.lastname?this.customer.details.data.lastname:'' + }, formatLabel(value) { value = value.split('_').join(' ').toString(); return value.charAt(0).toUpperCase() + value.slice(1); @@ -92,7 +95,7 @@ }); CandyEvent.$emit('title-changed', { - title: !this.customer.details.data.firstname && !this.customer.details.data.lastname ? '[No Name]' : this.customer.details.data.firstname?this.customer.details.data.firstname:'' + ' ' + this.customer.details.data.lastname?this.customer.details.data.lastname:'' + title: this.displayName() }); let chunkedOrders = _.chunk(this.customer.orders.data, this.ordersPerPage); From 6b3d3a9010be30443aba892a1909aca3c5b56747 Mon Sep 17 00:00:00 2001 From: Kenny Ong Date: Sat, 23 Mar 2019 21:37:18 +0800 Subject: [PATCH 3/3] Fixed [No Name] for browser title --- .../js/components/order-processing/customers/CustomerEdit.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/resources/assets/js/components/order-processing/customers/CustomerEdit.vue b/resources/assets/js/components/order-processing/customers/CustomerEdit.vue index 57993a1a..1006559a 100644 --- a/resources/assets/js/components/order-processing/customers/CustomerEdit.vue +++ b/resources/assets/js/components/order-processing/customers/CustomerEdit.vue @@ -105,9 +105,7 @@ }); document.title = 'Editing ' + - this.customer.details.data.firstname + - ' ' + - this.customer.details.data.lastname + + this.displayName() + ' - GetCandy'; apiRequest.send('GET', 'currencies').then(response => {