From 21c4721942230253571cee50a49a65bc9c53f62a Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 29 Sep 2019 12:28:34 +0300 Subject: [PATCH] Bug fixes --- .../Repositories/DashboardRepository.php | 8 +++--- app/Ninja/Transformers/InvoiceTransformer.php | 2 +- database/seeds/PaymentTypesSeeder.php | 1 + resources/lang/en/texts.php | 1 + resources/views/dashboard.blade.php | 26 ++++++++++--------- resources/views/proposals/edit.blade.php | 1 + 6 files changed, 22 insertions(+), 17 deletions(-) diff --git a/app/Ninja/Repositories/DashboardRepository.php b/app/Ninja/Repositories/DashboardRepository.php index 093e7e0276a4..d8b49019b5c5 100644 --- a/app/Ninja/Repositories/DashboardRepository.php +++ b/app/Ninja/Repositories/DashboardRepository.php @@ -347,7 +347,7 @@ class DashboardRepository return $activities->orderBy('activities.created_at', 'desc')->orderBy('activities.id', 'desc') ->with('client.contacts', 'user', 'invoice', 'payment', 'credit', 'account', 'task', 'expense', 'contact') - ->take(50) + ->take(100) ->get(); } @@ -374,7 +374,7 @@ class DashboardRepository return $pastDue->select([DB::raw("coalesce(invoices.partial_due_date, invoices.due_date) due_date"), 'invoices.balance', 'invoices.public_id', 'invoices.invoice_number', 'clients.name as client_name', 'contacts.email', 'contacts.first_name', 'contacts.last_name', 'clients.currency_id', 'clients.public_id as client_public_id', 'clients.user_id as client_user_id', 'invoice_type_id']) ->orderBy('invoices.due_date', 'asc') - ->take(50) + ->take(100) ->get(); } @@ -403,7 +403,7 @@ class DashboardRepository $upcoming = $upcoming->where('invoices.user_id', '=', $userId); } - return $upcoming->take(50) + return $upcoming->take(100) ->select([DB::raw("coalesce(invoices.partial_due_date, invoices.due_date) due_date"), 'invoices.balance', 'invoices.public_id', 'invoices.invoice_number', 'clients.name as client_name', 'contacts.email', 'contacts.first_name', 'contacts.last_name', 'clients.currency_id', 'clients.public_id as client_public_id', 'clients.user_id as client_user_id', 'invoice_type_id']) ->get(); } @@ -428,7 +428,7 @@ class DashboardRepository return $payments->select(['payments.payment_date', DB::raw('(payments.amount - payments.refunded) as amount'), 'invoices.public_id', 'invoices.invoice_number', 'clients.name as client_name', 'contacts.email', 'contacts.first_name', 'contacts.last_name', 'clients.currency_id', 'clients.public_id as client_public_id', 'clients.user_id as client_user_id']) ->orderBy('payments.payment_date', 'desc') - ->take(50) + ->take(100) ->get(); } diff --git a/app/Ninja/Transformers/InvoiceTransformer.php b/app/Ninja/Transformers/InvoiceTransformer.php index 0377363e33f1..f77ca7b9e065 100644 --- a/app/Ninja/Transformers/InvoiceTransformer.php +++ b/app/Ninja/Transformers/InvoiceTransformer.php @@ -156,7 +156,7 @@ class InvoiceTransformer extends EntityTransformer 'partial' => (float) ($invoice->partial ?: 0.0), 'partial_due_date' => $invoice->partial_due_date ?: '', 'has_tasks' => (bool) $invoice->has_tasks, - 'auto_bill' => (bool) $invoice->auto_bill, + 'auto_bill' => (int) $invoice->auto_bill, 'custom_value1' => (float) $invoice->custom_value1, 'custom_value2' => (float) $invoice->custom_value2, 'custom_taxes1' => (bool) $invoice->custom_taxes1, diff --git a/database/seeds/PaymentTypesSeeder.php b/database/seeds/PaymentTypesSeeder.php index d96c46d24af6..326a27500d08 100644 --- a/database/seeds/PaymentTypesSeeder.php +++ b/database/seeds/PaymentTypesSeeder.php @@ -41,6 +41,7 @@ class PaymentTypesSeeder extends Seeder ['name' => 'SEPA', 'gateway_type_id' => GATEWAY_TYPE_SEPA], ['name' => 'GoCardless', 'gateway_type_id' => GATEWAY_TYPE_GOCARDLESS], ['name' => 'Bitcoin', 'gateway_type_id' => GATEWAY_TYPE_BITCOIN], + ['name' => 'Zelle'], ]; foreach ($paymentTypes as $paymentType) { diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 6b319b134f6a..876e72ef6e2c 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -1456,6 +1456,7 @@ $LANG = array( 'payment_type_SEPA' => 'SEPA Direct Debit', 'payment_type_Bitcoin' => 'Bitcoin', 'payment_type_GoCardless' => 'GoCardless', + 'payment_type_Zelle' => 'Zelle', // Industries 'industry_Accounting & Legal' => 'Accounting & Legal', diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index cc0b231913b4..674017b469cb 100644 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -292,6 +292,7 @@ @include('partials/white_label_expired') @endif +@if (Auth::user()->hasPermission('admin'))
@@ -421,7 +422,6 @@
-@if (Auth::user()->hasPermission('view_dashboard'))
@@ -440,7 +440,7 @@

{{ trans('texts.activity') }} - @if ($invoicesSent) + @if (Auth::user()->hasPermission('admin') && $invoicesSent)
@if ($invoicesSent == 1) {{ trans('texts.invoice_sent', ['count' => $invoicesSent]) }} @@ -466,16 +466,18 @@

- @if ($showExpenses && count($averageInvoice)) -
- @foreach ($averageInvoice as $item) - - @endforeach - -
+ @if (Auth::user()->hasPermission('admin')) + @if ($showExpenses && count($averageInvoice)) +
+ @foreach ($averageInvoice as $item) + + @endforeach + +
+ @endif @endif {{ trans('texts.recent_payments') }}

diff --git a/resources/views/proposals/edit.blade.php b/resources/views/proposals/edit.blade.php index 7a1ded95f1a0..4ae39ca44d59 100644 --- a/resources/views/proposals/edit.blade.php +++ b/resources/views/proposals/edit.blade.php @@ -147,6 +147,7 @@ } invoice.account = {!! auth()->user()->account->load('country') !!}; + invoice.contact = invoice.client.contacts[0]; var regExp = new RegExp(/\$[a-z][\w\.]*/g); var matches = html.match(regExp);