mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 20:52:56 +01:00
Support exporting products
This commit is contained in:
parent
7085c0137f
commit
fc87cbafe6
@ -12,6 +12,7 @@ use App\Models\Contact;
|
||||
use App\Models\Credit;
|
||||
use App\Models\Task;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Product;
|
||||
use App\Models\Payment;
|
||||
use App\Models\Expense;
|
||||
use App\Models\Vendor;
|
||||
@ -220,6 +221,12 @@ class ExportController extends BaseController
|
||||
->get();
|
||||
}
|
||||
|
||||
if ($request->input('include') === 'all' || $request->input('products')) {
|
||||
$data['products'] = Product::scope()
|
||||
->withArchived()
|
||||
->get();
|
||||
}
|
||||
|
||||
if ($request->input('include') === 'all' || $request->input('vendors')) {
|
||||
$data['vendors'] = Vendor::scope()
|
||||
->with('user', 'vendor_contacts', 'country')
|
||||
|
@ -4,6 +4,10 @@ use App\Libraries\Skype\HeroCard;
|
||||
|
||||
class ProductPresenter extends EntityPresenter
|
||||
{
|
||||
public function user()
|
||||
{
|
||||
return $this->entity->user->getDisplayName();
|
||||
}
|
||||
|
||||
public function skypeBot($account)
|
||||
{
|
||||
|
@ -81,6 +81,7 @@
|
||||
@include('partials/checkbox', ['field' => 'payments'])
|
||||
</div>
|
||||
<div class="col-lg-3 col-sm-3">
|
||||
@include('partials/checkbox', ['field' => 'products'])
|
||||
@include('partials/checkbox', ['field' => 'expenses'])
|
||||
@include('partials/checkbox', ['field' => 'vendors'])
|
||||
@include('partials/checkbox', ['field' => 'vendor_contacts'])
|
||||
|
@ -45,6 +45,11 @@
|
||||
@include('export.payments')
|
||||
@endif
|
||||
|
||||
@if (isset($products) && $products && count($products))
|
||||
<tr><td>{{ strtoupper(trans('texts.products')) }}</td></tr>
|
||||
@include('export.products')
|
||||
@endif
|
||||
|
||||
@if (isset($expenses) && $expenses && count($expenses))
|
||||
<tr><td>{{ strtoupper(trans('texts.expenses')) }}</td></tr>
|
||||
@include('export.expenses')
|
||||
|
21
resources/views/export/products.blade.php
Normal file
21
resources/views/export/products.blade.php
Normal file
@ -0,0 +1,21 @@
|
||||
<tr>
|
||||
@if ($multiUser)
|
||||
<td>{{ trans('texts.user') }}</td>
|
||||
@endif
|
||||
<td>{{ trans('texts.product') }}</td>
|
||||
<td>{{ trans('texts.notes') }}</td>
|
||||
<td>{{ trans('texts.cost') }}</td>
|
||||
</tr>
|
||||
|
||||
@foreach ($products as $product)
|
||||
<tr>
|
||||
@if ($multiUser)
|
||||
<td>{{ $product->present()->user }}</td>
|
||||
@endif
|
||||
<td>{{ $product->product_key }}</td>
|
||||
<td>{{ $product->notes }}</td>
|
||||
<td>{{ $product->cost }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
<tr><td></td></tr>
|
Loading…
Reference in New Issue
Block a user