Merge pull request #496 from cuneytsenturk/1.3-dev

List invoices/bills in customer/vendor show page
This commit is contained in:
Cüneyt Şentürk 2018-09-20 19:50:34 +03:00 committed by GitHub
commit f3fb4f60f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 188 additions and 68 deletions

View File

@ -100,8 +100,10 @@ class Vendors extends Controller
$limit = request('limit', setting('general.list_limit', '25'));
$transactions = $this->paginate($items->merge($bill_payments)->sortByDesc('paid_at'), $limit);
$bills = $this->paginate($bills->sortByDesc('paid_at'), $limit);
$payments = $this->paginate($payments->sortByDesc('paid_at'), $limit);
return view('expenses.vendors.show', compact('vendor', 'counts', 'amounts', 'transactions'));
return view('expenses.vendors.show', compact('vendor', 'counts', 'amounts', 'transactions', 'bills', 'payments'));
}
/**

View File

@ -100,8 +100,10 @@ class Customers extends Controller
$limit = request('limit', setting('general.list_limit', '25'));
$transactions = $this->paginate($items->merge($invoice_payments)->sortByDesc('paid_at'), $limit);
$invoices = $this->paginate($invoices->sortByDesc('paid_at'), $limit);
$revenues = $this->paginate($revenues->sortByDesc('paid_at'), $limit);
return view('incomes.customers.show', compact('customer', 'counts', 'amounts', 'transactions'));
return view('incomes.customers.show', compact('customer', 'counts', 'amounts', 'transactions', 'invoices', 'revenues'));
}
/**

View File

@ -110,41 +110,98 @@
<!-- /.col -->
</div>
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">{{ trans_choice('general.transactions', 2) }}</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="table table-responsive">
<table class="table table-striped table-hover" id="tbl-transactions">
<thead>
<tr>
<th class="col-md-3">{{ trans('general.date') }}</th>
<th class="col-md-2 text-right amount-space">{{ trans('general.amount') }}</th>
<th class="col-md-4 hidden-xs">{{ trans_choice('general.categories', 1) }}</th>
<th class="col-md-3 hidden-xs">{{ trans_choice('general.accounts', 1) }}</th>
</tr>
</thead>
<tbody>
@foreach($transactions as $item)
<tr>
<td>{{ Date::parse($item->paid_at)->format($date_format) }}</td>
<td class="text-right amount-space">@money($item->amount, $item->currency_code, true)</td>
<td class="hidden-xs">{{ $item->category->name }}</td>
<td class="hidden-xs">{{ $item->account->name }}</td>
</tr>
@endforeach
</tbody>
</table>
<div class="row">
<div class="col-sm-12">
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="active"><a href="#transactions" data-toggle="tab" aria-expanded="true">{{ trans_choice('general.transactions', 2) }}</a></li>
<li class=""><a href="#bills" data-toggle="tab" aria-expanded="false">{{ trans_choice('general.bills', 2) }}</a></li>
<li class=""><a href="#payments" data-toggle="tab" aria-expanded="false">{{ trans_choice('general.payments', 2) }}</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane tab-margin active" id="transactions">
<table class="table table-striped table-hover" id="tbl-transactions">
<thead>
<tr>
<th class="col-md-3">{{ trans('general.date') }}</th>
<th class="col-md-2 text-right amount-space">{{ trans('general.amount') }}</th>
<th class="col-md-4 hidden-xs">{{ trans_choice('general.categories', 1) }}</th>
<th class="col-md-3 hidden-xs">{{ trans_choice('general.accounts', 1) }}</th>
</tr>
</thead>
<tbody>
@foreach($transactions as $item)
<tr>
<td>{{ Date::parse($item->paid_at)->format($date_format) }}</td>
<td class="text-right amount-space">@money($item->amount, $item->currency_code, true)</td>
<td class="hidden-xs">{{ $item->category->name }}</td>
<td class="hidden-xs">{{ $item->account->name }}</td>
</tr>
@endforeach
</tbody>
</table>
@include('partials.admin.pagination', ['items' => $transactions, 'type' => 'transactions'])
</div>
<div class="tab-pane tab-margin" id="bills">
<div class="table table-responsive">
<table class="table table-striped table-hover" id="tbl-bills">
<thead>
<tr>
<th class="col-md-2">{{ trans_choice('general.numbers', 1) }}</th>
<th class="col-md-2 text-right amount-space">{{ trans('general.amount') }}</th>
<th class="col-md-2">{{ trans('bills.bill_date') }}</th>
<th class="col-md-2">{{ trans('bills.due_date') }}</th>
<th class="col-md-2">{{ trans_choice('general.statuses', 1) }}</th>
</tr>
</thead>
<tbody>
@foreach($bills as $item)
<tr>
<td><a href="{{ url('expenses/bills/' . $item->id . ' ') }}">{{ $item->bill_number }}</a></td>
<td class="text-right amount-space">@money($item->amount, $item->currency_code, true)</td>
<td>{{ Date::parse($item->billed_at)->format($date_format) }}</td>
<td>{{ Date::parse($item->due_at)->format($date_format) }}</td>
<td><span class="label {{ $item->status->label }}">{{ trans('bills.status.' . $item->status->code) }}</span></td>
</tr>
@endforeach
</tbody>
</table>
</div>
@include('partials.admin.pagination', ['items' => $bills, 'type' => 'bills'])
</div>
<div class="tab-pane tab-margin" id="payments">
<div class="table table-responsive">
<table class="table table-striped table-hover" id="tbl-payments">
<thead>
<tr>
<th class="col-md-3">{{ trans('general.date') }}</th>
<th class="col-md-3 text-right amount-space">{{ trans('general.amount') }}</th>
<th class="col-md-3 hidden-xs">{{ trans_choice('general.categories', 1) }}</th>
<th class="col-md-3 hidden-xs">{{ trans_choice('general.accounts', 1) }}</th>
</tr>
</thead>
<tbody>
@foreach($payments as $item)
<tr>
<td><a href="{{ url('expenses/payments/' . $item->id . '/edit') }}">{{ Date::parse($item->paid_at)->format($date_format) }}</a></td>
<td class="text-right amount-space">@money($item->amount, $item->currency_code, true)</td>
<td class="hidden-xs">{{ $item->category->name }}</td>
<td class="hidden-xs">{{ $item->account->name }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@include('partials.admin.pagination', ['items' => $payments, 'type' => 'payments'])
</div>
</div>
</div>
</div>
<!-- /.box-body -->
<div class="box-footer">
@include('partials.admin.pagination', ['items' => $transactions, 'type' => 'transactions'])
</div>
<!-- /.box-footer -->
</div>
<!-- /.box -->
</div>

View File

@ -110,41 +110,100 @@
<!-- /.col -->
</div>
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">{{ trans_choice('general.transactions', 2) }}</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="table table-responsive">
<table class="table table-striped table-hover" id="tbl-transactions">
<thead>
<tr>
<th class="col-md-3">{{ trans('general.date') }}</th>
<th class="col-md-2 text-right amount-space">{{ trans('general.amount') }}</th>
<th class="col-md-4 hidden-xs">{{ trans_choice('general.categories', 1) }}</th>
<th class="col-md-3 hidden-xs">{{ trans_choice('general.accounts', 1) }}</th>
</tr>
</thead>
<tbody>
@foreach($transactions as $item)
<tr>
<td>{{ Date::parse($item->paid_at)->format($date_format) }}</td>
<td class="text-right amount-space">@money($item->amount, $item->currency_code, true)</td>
<td class="hidden-xs">{{ $item->category->name }}</td>
<td class="hidden-xs">{{ $item->account->name }}</td>
</tr>
@endforeach
</tbody>
</table>
<div class="row">
<div class="col-sm-12">
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="active"><a href="#transactions" data-toggle="tab" aria-expanded="true">{{ trans_choice('general.transactions', 2) }}</a></li>
<li class=""><a href="#invoices" data-toggle="tab" aria-expanded="false">{{ trans_choice('general.invoices', 2) }}</a></li>
<li class=""><a href="#revenues" data-toggle="tab" aria-expanded="false">{{ trans_choice('general.revenues', 2) }}</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane tab-margin active" id="transactions">
<div class="table table-responsive">
<table class="table table-striped table-hover" id="tbl-transactions">
<thead>
<tr>
<th class="col-md-3">{{ trans('general.date') }}</th>
<th class="col-md-2 text-right amount-space">{{ trans('general.amount') }}</th>
<th class="col-md-4 hidden-xs">{{ trans_choice('general.categories', 1) }}</th>
<th class="col-md-3 hidden-xs">{{ trans_choice('general.accounts', 1) }}</th>
</tr>
</thead>
<tbody>
@foreach($transactions as $item)
<tr>
<td>{{ Date::parse($item->paid_at)->format($date_format) }}</td>
<td class="text-right amount-space">@money($item->amount, $item->currency_code, true)</td>
<td class="hidden-xs">{{ $item->category->name }}</td>
<td class="hidden-xs">{{ $item->account->name }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@include('partials.admin.pagination', ['items' => $transactions, 'type' => 'transactions'])
</div>
<div class="tab-pane tab-margin" id="invoices">
<div class="table table-responsive">
<table class="table table-striped table-hover" id="tbl-invoices">
<thead>
<tr>
<th class="col-md-2">{{ trans_choice('general.numbers', 1) }}</th>
<th class="col-md-2 text-right amount-space">{{ trans('general.amount') }}</th>
<th class="col-md-2">{{ trans('invoices.invoice_date') }}</th>
<th class="col-md-2">{{ trans('invoices.due_date') }}</th>
<th class="col-md-2">{{ trans_choice('general.statuses', 1) }}</th>
</tr>
</thead>
<tbody>
@foreach($invoices as $item)
<tr>
<td><a href="{{ url('incomes/invoices/' . $item->id . ' ') }}">{{ $item->invoice_number }}</a></td>
<td class="text-right amount-space">@money($item->amount, $item->currency_code, true)</td>
<td>{{ Date::parse($item->invoiced_at)->format($date_format) }}</td>
<td>{{ Date::parse($item->due_at)->format($date_format) }}</td>
<td><span class="label {{ $item->status->label }}">{{ trans('invoices.status.' . $item->status->code) }}</span></td>
</tr>
@endforeach
</tbody>
</table>
</div>
@include('partials.admin.pagination', ['items' => $invoices, 'type' => 'invoices'])
</div>
<div class="tab-pane tab-margin" id="revenues">
<div class="table table-responsive">
<table class="table table-striped table-hover" id="tbl-revenues">
<thead>
<tr>
<th class="col-md-3">{{ trans('general.date') }}</th>
<th class="col-md-3 text-right amount-space">{{ trans('general.amount') }}</th>
<th class="col-md-3 hidden-xs">{{ trans_choice('general.categories', 1) }}</th>
<th class="col-md-3 hidden-xs">{{ trans_choice('general.accounts', 1) }}</th>
</tr>
</thead>
<tbody>
@foreach($revenues as $item)
<tr>
<td><a href="{{ url('incomes/revenues/' . $item->id . '/edit') }}">{{ Date::parse($item->paid_at)->format($date_format) }}</a></td>
<td class="text-right amount-space">@money($item->amount, $item->currency_code, true)</td>
<td class="hidden-xs">{{ $item->category->name }}</td>
<td class="hidden-xs">{{ $item->account->name }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@include('partials.admin.pagination', ['items' => $revenues, 'type' => 'revenues'])
</div>
</div>
</div>
</div>
<!-- /.box-body -->
<div class="box-footer">
@include('partials.admin.pagination', ['items' => $transactions, 'type' => 'transactions'])
</div>
<!-- /.box-footer -->
</div>
<!-- /.box -->
</div>