diff --git a/app/Http/Livewire/InvoicesTable.php b/app/Http/Livewire/InvoicesTable.php index 9cfe333c8bc4..3df61c46e9b2 100644 --- a/app/Http/Livewire/InvoicesTable.php +++ b/app/Http/Livewire/InvoicesTable.php @@ -5,6 +5,7 @@ namespace App\Http\Livewire; use App\Models\Invoice; use App\Utils\Traits\WithSorting; use Carbon\Carbon; +use Illuminate\Support\Facades\DB; use Livewire\Component; use Livewire\WithPagination; @@ -30,6 +31,7 @@ class InvoicesTable extends Component public function render() { + DB::enableQueryLog(); $query = Invoice::query() ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc'); @@ -44,12 +46,16 @@ class InvoicesTable extends Component if (in_array('overdue', $this->status)) { $query = $query->orWhereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL]) - ->where('due_date', '<', Carbon::now()) - ->orWhere('partial_due_date', '<', Carbon::now()); + ->where(function ($query) { + $query + ->orWhere('due_date', '<', Carbon::now()) + ->orWhere('partial_due_date', '<', Carbon::now()); + }); } $query = $query ->where('client_id', auth('contact')->user()->client->id) + ->where('status_id', '<>', Invoice::STATUS_DRAFT) ->paginate($this->per_page); return render('components.livewire.invoices-table', [ diff --git a/app/Models/Quote.php b/app/Models/Quote.php index 4efb3d35cd99..98625394b352 100644 --- a/app/Models/Quote.php +++ b/app/Models/Quote.php @@ -218,7 +218,7 @@ class Quote extends BaseModel return '
' . ctrans('texts.draft') . '
'; break; case Quote::STATUS_SENT: - return '
' . ctrans('texts.sent') . '
'; + return '
' . ctrans('texts.pending') . '
'; break; case Quote::STATUS_APPROVED: return '
' . ctrans('texts.approved') . '
'; diff --git a/resources/views/portal/ninja2020/components/livewire/quotes-table.blade.php b/resources/views/portal/ninja2020/components/livewire/quotes-table.blade.php index 5c7ef5f35286..c357b5405cb0 100644 --- a/resources/views/portal/ninja2020/components/livewire/quotes-table.blade.php +++ b/resources/views/portal/ninja2020/components/livewire/quotes-table.blade.php @@ -1,8 +1,8 @@
- - @@ -11,54 +11,54 @@
- +
- - + +
- +
- +
-
-
- +
+
+
- - - - - - @forelse($quotes as $quote) - - - - - - - @empty - @@ -106,9 +106,9 @@
+ + {{ ctrans('texts.quote_number') }} + {{ ctrans('texts.quote_date') }} + {{ ctrans('texts.balance') }} + {{ ctrans('texts.valid_until') }} + {{ ctrans('texts.quote_status') }} @@ -69,27 +69,27 @@
+ + {{ $quote->number }} + {{ $quote->formatDate($quote->date, $quote->client->date_format()) }} + {{ App\Utils\Number::formatMoney($quote->balance, $quote->client) }} - {{ $quote->formatDate($quote->date, $quote->client->date_format()) }} + + {{ $quote->formatDate($quote->due_date, $quote->client->date_format()) }} + {!! App\Models\Quote::badgeForStatus($quote->status_id) !!} + @lang('texts.view') @@ -97,7 +97,7 @@
+ {{ ctrans('texts.no_results') }}
-
+
@if($quotes->total() > 0) -