From 7085c0137fea5dcb1191aec06935de0f1ee8d9b1 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 15 Dec 2016 15:20:36 +0200 Subject: [PATCH] Fix payments column headers --- app/Ninja/Datatables/PaymentDatatable.php | 6 +++--- app/Ninja/Repositories/PaymentRepository.php | 3 +++ resources/lang/en/texts.php | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/Ninja/Datatables/PaymentDatatable.php b/app/Ninja/Datatables/PaymentDatatable.php index 0950b4719b9e..fb7dc175d5c7 100644 --- a/app/Ninja/Datatables/PaymentDatatable.php +++ b/app/Ninja/Datatables/PaymentDatatable.php @@ -20,7 +20,7 @@ class PaymentDatatable extends EntityDatatable { return [ [ - 'invoice_number', + 'invoice_name', function ($model) { if(!Auth::user()->can('viewByOwner', [ENTITY_INVOICE, $model->invoice_user_id])){ return $model->invoice_number; @@ -47,13 +47,13 @@ class PaymentDatatable extends EntityDatatable } ], [ - 'payment_type', + 'method', function ($model) { return ($model->payment_type && !$model->last4) ? $model->payment_type : ($model->account_gateway_id ? $model->gateway_name : ''); } ], [ - 'payment_type_id', + 'source', function ($model) { $code = str_replace(' ', '', strtolower($model->payment_type)); $card_type = trans('texts.card_' . $code); diff --git a/app/Ninja/Repositories/PaymentRepository.php b/app/Ninja/Repositories/PaymentRepository.php index fbc582868f94..0c99521368c9 100644 --- a/app/Ninja/Repositories/PaymentRepository.php +++ b/app/Ninja/Repositories/PaymentRepository.php @@ -39,12 +39,15 @@ class PaymentRepository extends BaseRepository 'payments.payment_date', 'payments.payment_status_id', 'payments.payment_type_id', + 'payments.payment_type_id as source', 'invoices.public_id as invoice_public_id', 'invoices.user_id as invoice_user_id', 'invoices.invoice_number', + 'invoices.invoice_number as invoice_name', 'contacts.first_name', 'contacts.last_name', 'contacts.email', + 'payment_types.name as method', 'payment_types.name as payment_type', 'payments.account_gateway_id', 'payments.deleted_at', diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 705c6b9cc1e0..a5fb54d0f4cf 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -2272,6 +2272,8 @@ $LANG = array( 'mark_paid' => 'Mark Paid', 'marked_sent_invoice' => 'Successfully marked invoice sent', 'marked_sent_invoices' => 'Successfully marked invoices sent', + 'invoice_name' => 'Invoice', + ); return $LANG;