improve filters

This commit is contained in:
denisdulici 2017-09-27 21:40:25 +03:00
parent e4267c7f4a
commit 47f7b5b20e
26 changed files with 62 additions and 29 deletions

View File

@ -19,6 +19,11 @@ class Bills extends ModelFilter
return $this->whereLike('vendor_name', $query);
}
public function vendor($vendor)
{
return $this->where('vendor_id', $vendor);
}
public function status($status)
{
return $this->where('bill_status_code', $status);

View File

@ -19,6 +19,11 @@ class Payments extends ModelFilter
return $this->whereLike('description', $query);
}
public function vendor($vendor)
{
return $this->where('vendor_id', $vendor);
}
public function category($category)
{
return $this->where('category_id', $category);

View File

@ -19,6 +19,11 @@ class Invoices extends ModelFilter
return $this->whereLike('customer_name', $query);
}
public function customer($customer)
{
return $this->where('customer_id', $customer);
}
public function status($status)
{
return $this->where('invoice_status_code', $status);

View File

@ -14,6 +14,11 @@ class Revenues extends ModelFilter
*/
public $relations = [];
public function search($query)
{
return $this->whereLike('description', $query);
}
public function customer($customer)
{
return $this->where('customer_id', $customer);

View File

@ -46,7 +46,7 @@ class Invoices extends Controller
}
$status = collect(InvoiceStatus::all()->pluck('name', 'code'))
->prepend(trans('general.all_statuses'), '');
->prepend(trans('general.all_type', ['type' => trans_choice('general.statuses', 2)]), '');
return view('customers.invoices.index', compact('invoices', 'status'));
}

View File

@ -38,10 +38,13 @@ class Bills extends Controller
{
$bills = Bill::with('status')->collect();
$status = collect(BillStatus::all()->pluck('name', 'code'))
->prepend(trans('general.all_statuses'), '');
$vendors = collect(Vendor::enabled()->pluck('name', 'id'))
->prepend(trans('general.all_type', ['type' => trans_choice('general.vendors', 2)]), '');
return view('expenses.bills.index', compact('bills', 'status'));
$status = collect(BillStatus::all()->pluck('name', 'code'))
->prepend(trans('general.all_type', ['type' => trans_choice('general.statuses', 2)]), '');
return view('expenses.bills.index', compact('bills', 'vendors', 'status'));
}
/**

View File

@ -24,13 +24,16 @@ class Payments extends Controller
{
$payments = Payment::with(['account', 'category'])->collect();
$vendors = collect(Vendor::enabled()->pluck('name', 'id'))
->prepend(trans('general.all_type', ['type' => trans_choice('general.vendors', 2)]), '');
$categories = collect(Category::enabled()->type('expense')->pluck('name', 'id'))
->prepend(trans('categories.all'), '');
->prepend(trans('general.all_type', ['type' => trans_choice('general.categories', 2)]), '');
$accounts = collect(Account::enabled()->pluck('name', 'id'))
->prepend(trans('accounts.all'), '');
->prepend(trans('general.all_type', ['type' => trans_choice('general.accounts', 2)]), '');
return view('expenses.payments.index', compact('payments', 'categories', 'accounts'));
return view('expenses.payments.index', compact('payments', 'vendors', 'categories', 'accounts'));
}
/**

View File

@ -40,10 +40,13 @@ class Invoices extends Controller
{
$invoices = Invoice::with('status')->collect();
$status = collect(InvoiceStatus::all()->pluck('name', 'code'))
->prepend(trans('general.all_statuses'), '');
$customers = collect(Customer::enabled()->pluck('name', 'id'))
->prepend(trans('general.all_type', ['type' => trans_choice('general.customers', 2)]), '');
return view('incomes.invoices.index', compact('invoices', 'status'));
$status = collect(InvoiceStatus::all()->pluck('name', 'code'))
->prepend(trans('general.all_type', ['type' => trans_choice('general.statuses', 2)]), '');
return view('incomes.invoices.index', compact('invoices', 'customers', 'status'));
}
/**

View File

@ -28,13 +28,13 @@ class Revenues extends Controller
$revenues = Revenue::with(['account', 'category', 'customer'])->collect();
$customers = collect(Customer::enabled()->pluck('name', 'id'))
->prepend(trans('customer.all'), '');
->prepend(trans('general.all_type', ['type' => trans_choice('general.customers', 2)]), '');
$categories = collect(Category::enabled()->type('income')->pluck('name', 'id'))
->prepend(trans('categories.all'), '');
->prepend(trans('general.all_type', ['type' => trans_choice('general.categories', 2)]), '');
$accounts = collect(Account::enabled()->pluck('name', 'id'))
->prepend(trans('accounts.all'), '');
->prepend(trans('general.all_type', ['type' => trans_choice('general.accounts', 2)]), '');
return view('incomes.revenues.index', compact('revenues', 'customers', 'categories', 'accounts'));
}

View File

@ -35,6 +35,7 @@ return [
'languages' => 'Language|Languages',
'updates' => 'Update|Updates',
'numbers' => 'Number|Numbers',
'statuses' => 'Status|Statuses',
'dashboard' => 'Dashboard',
'banking' => 'Banking',
@ -76,7 +77,6 @@ return [
'color' => 'Colour',
'save' => 'Save',
'cancel' => 'Cancel',
'status' => 'Status',
'from' => 'From',
'to' => 'To',
'print' => 'Print',
@ -85,12 +85,12 @@ return [
'filter' => 'Filter',
'create_user' => 'Create User',
'created_user' => 'Created User',
'all_statuses' => 'All Statuses',
'bank' => 'Bank Transfer',
'cash' => 'Cash',
'paypal' => 'PayPal',
'help' => 'Help',
'all' => 'All',
'all_type' => 'All :type',
'upcoming' => 'Upcoming',
'created' => 'Created',

View File

@ -34,7 +34,7 @@
<th>@sortablelink('name', trans('general.name'))</th>
<th>@sortablelink('number', trans('accounts.number'))</th>
<th>@sortablelink('opening_balance', trans('accounts.current_balance'))</th>
<th>@sortablelink('enabled', trans('general.status'))</th>
<th>@sortablelink('enabled', trans_choice('general.statuses', 1))</th>
<th style="width: 15%;">{{ trans('general.actions') }}</th>
</tr>
</thead>

View File

@ -24,7 +24,7 @@
<th>{{ trans('invoices.invoice_number') }}</th>
<th>{{ trans_choice('general.customers', 1) }}</th>
<th>{{ trans('invoices.total_price') }}</th>
<th>{{ trans('general.status') }}</th>
<th>{{ trans_choice('general.statuses', 1) }}</th>
<th>{{ trans('invoices.invoice_date') }}</th>
<th style="width: 18%;">{{ trans('general.actions') }}</th>
</tr>

View File

@ -34,7 +34,7 @@
<th>@sortablelink('invoice_number', trans('invoices.invoice_number'))</th>
<th>@sortablelink('customer_name', trans_choice('general.customers', 1))</th>
<th>@sortablelink('amount', trans('invoices.total_price'))</th>
<th>@sortablelink('status.name', trans('general.status'))</th>
<th>@sortablelink('status.name', trans_choice('general.statuses', 1))</th>
<th>@sortablelink('invoiced_at', trans('invoices.invoice_date'))</th>
<th>@sortablelink('due_at', trans('invoices.due_date'))</th>
<th style="width: 18%;">{{ trans('general.actions') }}</th>

View File

@ -176,7 +176,7 @@
<thead>
<tr>
<th>{{ trans('general.date') }}</th>
<th>{{ trans('general.status') }}</th>
<th>{{ trans_choice('general.statuses', 1) }}</th>
<th>{{ trans('general.description') }}</th>
</tr>
</thead>

View File

@ -16,6 +16,7 @@
<div class="pull-left">
<span class="title-filter">{{ trans('general.search') }}:</span>
{!! Form::text('search', request('search'), ['class' => 'form-control input-filter input-sm', 'placeholder' => trans('general.search_placeholder')]) !!}
{!! Form::select('vendor', $vendors, request('vendor'), ['class' => 'form-control input-filter input-sm']) !!}
{!! Form::select('status', $status, request('status'), ['class' => 'form-control input-filter input-sm']) !!}
{!! Form::button('<span class="fa fa-filter"></span> &nbsp;' . trans('general.filter'), ['type' => 'submit', 'class' => 'btn btn-sm btn-default btn-filter']) !!}
</div>
@ -35,7 +36,7 @@
<th class="col-md-1">@sortablelink('bill_number', trans_choice('general.numbers', 1))</th>
<th class="col-md-3">@sortablelink('vendor_name', trans_choice('general.vendors', 1))</th>
<th class="col-md-1">@sortablelink('amount', trans('general.amount'))</th>
<th class="col-md-1">@sortablelink('status.name', trans('general.status'))</th>
<th class="col-md-1">@sortablelink('status.name', trans_choice('general.statuses', 1))</th>
<th>@sortablelink('billed_at', trans('bills.bill_date'))</th>
<th>@sortablelink('due_at', trans('bills.due_date'))</th>
<th class="col-md-3">{{ trans('general.actions') }}</th>

View File

@ -176,7 +176,7 @@
<thead>
<tr>
<th>{{ trans('general.date') }}</th>
<th>{{ trans('general.status') }}</th>
<th>{{ trans_choice('general.statuses', 1) }}</th>
<th>{{ trans('general.description') }}</th>
</tr>
</thead>

View File

@ -16,6 +16,7 @@
<div class="pull-left">
<span class="title-filter">{{ trans('general.search') }}:</span>
{!! Form::text('search', request('search'), ['class' => 'form-control input-filter input-sm', 'placeholder' => trans('general.search_placeholder')]) !!}
{!! Form::select('vendor', $vendors, request('vendor'), ['class' => 'form-control input-filter input-sm']) !!}
{!! Form::select('category', $categories, request('category'), ['class' => 'form-control input-filter input-sm']) !!}
{!! Form::select('account', $accounts, request('account'), ['class' => 'form-control input-filter input-sm']) !!}
{!! Form::button('<span class="fa fa-filter"></span> &nbsp;' . trans('general.filter'), ['type' => 'submit', 'class' => 'btn btn-sm btn-default btn-filter']) !!}

View File

@ -34,7 +34,7 @@
<th>@sortablelink('name', trans('general.name'))</th>
<th>@sortablelink('email', trans('general.email'))</th>
<th>@sortablelink('phone', trans('general.phone'))</th>
<th>@sortablelink('enabled', trans('general.status'))</th>
<th>@sortablelink('enabled', trans_choice('general.statuses', 1))</th>
<th style="width: 15%;">{{ trans('general.actions') }}</th>
</tr>
</thead>

View File

@ -34,7 +34,7 @@
<th>@sortablelink('name', trans('general.name'))</th>
<th>@sortablelink('email', trans('general.email'))</th>
<th>@sortablelink('phone', trans('general.phone'))</th>
<th>@sortablelink('enabled', trans('general.status'))</th>
<th>@sortablelink('enabled', trans_choice('general.statuses', 1))</th>
<th style="width: 15%;">{{ trans('general.actions') }}</th>
</tr>
</thead>

View File

@ -16,6 +16,7 @@
<div class="pull-left">
<span class="title-filter">{{ trans('general.search') }}:</span>
{!! Form::text('search', request('search'), ['class' => 'form-control input-filter input-sm', 'placeholder' => trans('general.search_placeholder')]) !!}
{!! Form::select('customer', $customers, request('customer'), ['class' => 'form-control input-filter input-sm']) !!}
{!! Form::select('status', $status, request('status'), ['class' => 'form-control input-filter input-sm']) !!}
{!! Form::button('<span class="fa fa-filter"></span> &nbsp;' . trans('general.filter'), ['type' => 'submit', 'class' => 'btn btn-sm btn-default btn-filter']) !!}
</div>
@ -34,7 +35,7 @@
<th class="col-md-1">@sortablelink('invoice_number', trans_choice('general.numbers', 1))</th>
<th class="col-md-3">@sortablelink('customer_name', trans_choice('general.customers', 1))</th>
<th class="col-md-1">@sortablelink('amount', trans('general.amount'))</th>
<th class="col-md-1">@sortablelink('status.name', trans('general.status'))</th>
<th class="col-md-1">@sortablelink('status.name', trans_choice('general.statuses', 1))</th>
<th>@sortablelink('invoiced_at', trans('invoices.invoice_date'))</th>
<th>@sortablelink('due_at', trans('invoices.due_date'))</th>
<th class="col-md-3">{{ trans('general.actions') }}</th>

View File

@ -179,7 +179,7 @@
<thead>
<tr>
<th>{{ trans('general.date') }}</th>
<th>{{ trans('general.status') }}</th>
<th>{{ trans_choice('general.statuses', 1) }}</th>
<th>{{ trans('general.description') }}</th>
</tr>
</thead>

View File

@ -15,6 +15,7 @@
{!! Form::open(['url' => 'incomes/revenues', 'role' => 'form', 'method' => 'GET']) !!}
<div class="pull-left">
<span class="title-filter">{{ trans('general.search') }}:</span>
{!! Form::text('search', request('search'), ['class' => 'form-control input-filter input-sm', 'placeholder' => trans('general.search_placeholder')]) !!}
{!! Form::select('customer', $customers, request('customer'), ['class' => 'form-control input-filter input-sm']) !!}
{!! Form::select('category', $categories, request('category'), ['class' => 'form-control input-filter input-sm']) !!}
{!! Form::select('account', $accounts, request('account'), ['class' => 'form-control input-filter input-sm']) !!}

View File

@ -38,7 +38,7 @@
<th class="col-md-1">@sortablelink('quantity', trans_choice('items.quantities', 1))</th>
<th>@sortablelink('sale_price', trans('items.sales_price'))</th>
<th>@sortablelink('purchase_price', trans('items.purchase_price'))</th>
<th class="col-md-1">@sortablelink('enabled', trans('general.status'))</th>
<th class="col-md-1">@sortablelink('enabled', trans_choice('general.statuses', 1))</th>
<th class="col-md-2">{{ trans('general.actions') }}</th>
</tr>
</thead>

View File

@ -35,7 +35,7 @@
<th>@sortablelink('name', trans('general.name'))</th>
<th>@sortablelink('type', trans_choice('general.types', 1))</th>
<th>{{ trans('general.color') }}</th>
<th>@sortablelink('enabled', trans('general.status'))</th>
<th>@sortablelink('enabled', trans_choice('general.statuses', 1))</th>
<th class="col-md-2">{{ trans('general.actions') }}</th>
</tr>
</thead>

View File

@ -32,7 +32,7 @@
<th>@sortablelink('name', trans('general.name'))</th>
<th>@sortablelink('code', trans('currencies.code'))</th>
<th>@sortablelink('rate', trans('currencies.rate'))</th>
<th>@sortablelink('enabled', trans('general.status'))</th>
<th>@sortablelink('enabled', trans_choice('general.statuses', 1))</th>
<th class="col-md-2">{{ trans('general.actions') }}</th>
</tr>
</thead>

View File

@ -34,7 +34,7 @@
<tr>
<th>@sortablelink('name', trans('general.name'))</th>
<th>@sortablelink('rate', trans('taxes.rate_percent'))</th>
<th>@sortablelink('enabled', trans('general.status'))</th>
<th>@sortablelink('enabled', trans_choice('general.statuses', 1))</th>
<th class="col-md-2">{{ trans('general.actions') }}</th>
</tr>
</thead>