Merge branch '2.1-dev' of github.com:akaunting/akaunting into 2.1-dev

This commit is contained in:
Cüneyt Şentürk 2020-11-11 18:49:19 +03:00
commit 8784dc14db
91 changed files with 1938 additions and 1814 deletions

View File

@ -2,6 +2,7 @@
namespace App\Abstracts\Http;
use App\Abstracts\Http\Response;
use App\Traits\Jobs;
use App\Traits\Relationships;
use Illuminate\Database\Eloquent\Collection;
@ -99,4 +100,25 @@ abstract class Controller extends BaseController
return new LengthAwarePaginator($items->forPage($page, $perPage), $items->count(), $perPage, $page, $options);
}
/**
* Generate a response based on request type like HTML, JSON, or anything else.
*
* @param string $view
* @param array $data
*
* @return \Illuminate\Http\Response
*/
public function response($view, $data = [])
{
$class_name = str_replace('Controllers', 'Responses', (new \ReflectionClass($this))->getName());
if (class_exists($class_name)) {
$response = new $class_name($view, $data);
} else {
$response = new class($view, $data) extends Response {};
}
return $response;
}
}

View File

@ -0,0 +1,55 @@
<?php
namespace App\Abstracts\Http;
use Illuminate\Contracts\Support\Responsable;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
abstract class Response implements Responsable
{
protected $accepts = ['json', 'rss'];
protected $view;
protected $data;
public function __construct($view, $data)
{
$this->view = $view;
$this->data = $data;
}
public function toJson()
{
return response()->json([
'success' => true,
'error' => false,
'data' => Arr::first($this->data),
'message' => '',
]);
}
public function toHtml()
{
return view($this->view, $this->data);
}
public function toResponse($request)
{
foreach ($this->accepts as $accept) {
$request_method = 'expects' . Str::studly($accept);
$response_method = 'to' . Str::studly($accept);
if (!method_exists($request, $request_method) || !method_exists($this, $response_method)) {
continue;
}
if ($request->{$request_method}()) {
return $this->{$response_method}();
}
}
return $this->toHtml();
}
}

View File

@ -70,9 +70,16 @@ abstract class Model extends Eloquent
$request = request();
$search = $request->get('search');
$query->usingSearchString($search)->sortable($sort);
if ($request->expectsJson()) {
return $query->get();
}
$limit = $request->get('limit', setting('default.list_limit', '25'));
return $query->usingSearchString($search)->sortable($sort)->paginate($limit);
return $query->paginate($limit);
}
/**

View File

@ -0,0 +1,28 @@
<?php
namespace $NAMESPACE$;
use Illuminate\View\Component;
class $CLASS$ extends Component
{
/**
* Create a new component instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|string
*/
public function render()
{
return view('$ALIAS$::$VIEW_NAME$');
}
}

View File

@ -3,7 +3,6 @@
namespace $CLASS_NAMESPACE$;
use App\Abstracts\Http\Controller;
use App\Abstracts\Http\FormRequest;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
@ -11,15 +10,17 @@ class $CLASS$ extends Controller
{
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
return view('$ALIAS$::index');
return $this->response('$ALIAS$::index');
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
@ -29,6 +30,7 @@ class $CLASS$ extends Controller
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
@ -39,6 +41,7 @@ class $CLASS$ extends Controller
/**
* Show the specified resource.
*
* @param int $id
* @return Response
*/
@ -49,6 +52,7 @@ class $CLASS$ extends Controller
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
@ -59,6 +63,7 @@ class $CLASS$ extends Controller
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
* @return Response
@ -70,6 +75,7 @@ class $CLASS$ extends Controller
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/

View File

@ -2,6 +2,7 @@
namespace $NAMESPACE$;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider as Provider;
class $NAME$ extends Provider
@ -14,6 +15,7 @@ class $NAME$ extends Provider
public function boot()
{
$this->loadViews();
$this->loadViewComponents();
$this->loadTranslations();
$this->loadMigrations();
//$this->loadConfig();
@ -39,6 +41,16 @@ class $NAME$ extends Provider
$this->loadViewsFrom(__DIR__ . '/../Resources/views', '$ALIAS$');
}
/**
* Load view components.
*
* @return void
*/
public function loadViewComponents()
{
Blade::componentNamespace('$COMPONENT_NAMESPACE$', '$ALIAS$');
}
/**
* Load translations.
*

View File

@ -20,7 +20,7 @@ class Permissions extends Controller
{
$permissions = Permission::collect();
return view('auth.permissions.index', compact('permissions'));
return $this->response('auth.permissions.index', compact('permissions'));
}
/**

View File

@ -21,7 +21,7 @@ class Roles extends Controller
{
$roles = Role::collect();
return view('auth.roles.index', compact('roles'));
return $this->response('auth.roles.index', compact('roles'));
}
/**

View File

@ -37,7 +37,7 @@ class Users extends Controller
{
$users = User::with('media', 'roles')->collect();
return view('auth.users.index', compact('users'));
return $this->response('auth.users.index', compact('users'));
}
/**
@ -58,7 +58,7 @@ class Users extends Controller
return $r->hasPermission('read-client-portal');
});
$companies = user()->companies()->take(10)->get()->sortBy('name')->pluck('name', 'id');
$companies = user()->companies()->take(setting('default.select_limit'))->get()->sortBy('name')->pluck('name', 'id');
return view('auth.users.create', compact('roles', 'companies', 'landing_pages'));
}
@ -123,7 +123,7 @@ class Users extends Controller
});
}
$companies = user()->companies()->take(10)->get()->sortBy('name')->pluck('name', 'id');
$companies = user()->companies()->take(setting('default.select_limit'))->get()->sortBy('name')->pluck('name', 'id');
return view('auth.users.edit', compact('user', 'companies', 'roles', 'landing_pages'));
}

View File

@ -21,7 +21,7 @@ class Accounts extends Controller
{
$accounts = Account::collect();
return view('banking.accounts.index', compact('accounts'));
return $this->response('banking.accounts.index', compact('accounts'));
}
/**

View File

@ -26,7 +26,7 @@ class Reconciliations extends Controller
$accounts = collect(Account::enabled()->orderBy('name')->pluck('name', 'id'));
return view('banking.reconciliations.index', compact('reconciliations', 'accounts'));
return $this->response('banking.reconciliations.index', compact('reconciliations', 'accounts'));
}
/**

View File

@ -22,7 +22,7 @@ class Transactions extends Controller
{
$accounts = Account::enabled()->orderBy('name')->pluck('name', 'id');
$types = collect(['expense' => 'Expense', 'income' => 'Income'])
$types = collect(['expense' => trans_choice('general.expenses', 1), 'income' => trans_choice('general.incomes', 1)])
->prepend(trans('general.all_type', ['type' => trans_choice('general.types', 2)]), '');
$request_type = !request()->has('type') ? ['income', 'expense'] : request('type');
@ -30,7 +30,7 @@ class Transactions extends Controller
$transactions = Transaction::with('account', 'category', 'contact')->collect(['paid_at'=> 'desc']);
return view('banking.transactions.index', compact('transactions', 'accounts', 'types', 'categories'));
return $this->response('banking.transactions.index', compact('transactions', 'accounts', 'types', 'categories'));
}
/**

View File

@ -52,10 +52,10 @@ class Transfers extends Controller
];
}
$special_key = array(
$special_key = [
'expense_transaction.name' => 'from_account',
'income_transaction.name' => 'to_account',
);
];
$request = request();
@ -77,12 +77,12 @@ class Transfers extends Controller
array_multisort($sort_order, $sort_type, $data);
}
$transfers = $this->paginate($data);
$transfers = $request->expectsJson() ? $data : $this->paginate($data);
$accounts = collect(Account::enabled()->orderBy('name')->pluck('name', 'id'))
->prepend(trans('general.all_type', ['type' => trans_choice('general.accounts', 2)]), '');
return view('banking.transfers.index', compact('transfers', 'accounts'));
return $this->response('banking.transfers.index', compact('transfers', 'accounts'));
}
/**

View File

@ -6,9 +6,7 @@ use App\Abstracts\Http\Controller;
use App\Http\Requests\Common\BulkAction as Request;
use Illuminate\Support\Str;
class
BulkActions extends Controller
class BulkActions extends Controller
{
/**

View File

@ -26,7 +26,7 @@ class Companies extends Controller
{
$companies = Company::collect();
return view('common.companies.index', compact('companies'));
return $this->response('common.companies.index', compact('companies'));
}
/**

View File

@ -40,7 +40,7 @@ class Dashboards extends Controller
{
$dashboards = user()->dashboards()->collect();
return view('common.dashboards.index', compact('dashboards'));
return $this->response('common.dashboards.index', compact('dashboards'));
}
/**

View File

@ -30,7 +30,7 @@ class Items extends Controller
{
$items = Item::with('category', 'media')->collect();
return view('common.items.index', compact('items'));
return $this->response('common.items.index', compact('items'));
}
/**
@ -50,7 +50,7 @@ class Items extends Controller
*/
public function create()
{
$categories = Category::item()->enabled()->orderBy('name')->pluck('name', 'id');
$categories = Category::item()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
$taxes = Tax::enabled()->orderBy('name')->get()->pluck('title', 'id');
@ -129,7 +129,7 @@ class Items extends Controller
*/
public function edit(Item $item)
{
$categories = Category::item()->enabled()->orderBy('name')->pluck('name', 'id');
$categories = Category::item()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
$taxes = Tax::enabled()->orderBy('name')->get()->pluck('title', 'id');

View File

@ -45,7 +45,7 @@ class Reports extends Controller
$categories[$class->getCategory()][] = $report;
}
return view('common.reports.index', compact('categories', 'totals', 'icons'));
return $this->response('common.reports.index', compact('categories', 'totals', 'icons'));
}
/**

View File

@ -30,7 +30,7 @@ class Items extends Controller
*/
public function create(IRequest $request)
{
$categories = Category::item()->enabled()->orderBy('name')->pluck('name', 'id');
$categories = Category::item()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
$taxes = Tax::enabled()->orderBy('name')->get()->pluck('title', 'id');

View File

@ -29,6 +29,6 @@ class Home extends Controller
$free = $this->getFreeModules($data);
$installed = Module::all()->pluck('enabled', 'alias')->toArray();
return view('modules.home.index', compact('pre_sale', 'paid', 'new', 'free', 'installed'));
return $this->response('modules.home.index', compact('pre_sale', 'paid', 'new', 'free', 'installed'));
}
}

View File

@ -21,6 +21,6 @@ class My extends Controller
$modules = $this->getInstalledModules();
$installed = Module::where('company_id', '=', session('company_id'))->pluck('enabled', 'alias')->toArray();
return view('modules.my.index', compact('purchased', 'modules', 'installed'));
return $this->response('modules.my.index', compact('purchased', 'modules', 'installed'));
}
}

View File

@ -32,7 +32,7 @@ class Invoices extends Controller
$statuses = $this->getInvoiceStatuses();
return view('portal.invoices.index', compact('invoices', 'categories', 'statuses'));
return $this->response('portal.invoices.index', compact('invoices', 'categories', 'statuses'));
}
/**

View File

@ -20,7 +20,7 @@ class Payments extends Controller
$payment_methods = Modules::getPaymentMethods('all');
return view('portal.payments.index', compact('payments', 'payment_methods'));
return $this->response('portal.payments.index', compact('payments', 'payment_methods'));
}
/**

View File

@ -39,13 +39,7 @@ class Bills extends Controller
{
$bills = Bill::with('contact', 'transactions')->collect(['billed_at'=> 'desc']);
$vendors = Contact::vendor()->enabled()->orderBy('name')->pluck('name', 'id');
$categories = Category::expense()->enabled()->orderBy('name')->pluck('name', 'id');
$statuses = $this->getBillStatuses();
return view('purchases.bills.index', compact('bills', 'vendors', 'categories', 'statuses'));
return $this->response('purchases.bills.index', compact('bills'));
}
/**
@ -96,7 +90,7 @@ class Bills extends Controller
*/
public function create()
{
$vendors = Contact::vendor()->enabled()->orderBy('name')->pluck('name', 'id');
$vendors = Contact::vendor()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
$currencies = Currency::enabled()->orderBy('name')->pluck('name', 'code')->toArray();
@ -106,7 +100,7 @@ class Bills extends Controller
$taxes = Tax::enabled()->orderBy('name')->get();
$categories = Category::expense()->enabled()->orderBy('name')->pluck('name', 'id');
$categories = Category::expense()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
$number = $this->getNextBillNumber();
@ -192,7 +186,7 @@ class Bills extends Controller
*/
public function edit(Bill $bill)
{
$vendors = Contact::vendor()->enabled()->orderBy('name')->pluck('name', 'id');
$vendors = Contact::vendor()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
$currencies = Currency::enabled()->orderBy('name')->pluck('name', 'code')->toArray();
@ -202,7 +196,7 @@ class Bills extends Controller
$taxes = Tax::enabled()->orderBy('name')->get();
$categories = Category::expense()->enabled()->orderBy('name')->pluck('name', 'id');
$categories = Category::expense()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
return view('purchases.bills.edit', compact('bill', 'vendors', 'currencies', 'currency', 'items', 'taxes', 'categories'));
}

View File

@ -32,13 +32,7 @@ class Payments extends Controller
{
$payments = Transaction::with('account', 'bill', 'category', 'contact')->expense()->isNotTransfer()->collect(['paid_at'=> 'desc']);
$vendors = Contact::vendor()->enabled()->orderBy('name')->pluck('name', 'id');
$categories = Category::expense()->enabled()->orderBy('name')->pluck('name', 'id');
$accounts = Account::enabled()->orderBy('name')->pluck('name', 'id');
return view('purchases.payments.index', compact('payments', 'vendors', 'categories', 'accounts'));
return $this->response('purchases.payments.index', compact('payments'));
}
/**
@ -66,9 +60,9 @@ class Payments extends Controller
$currency = Currency::where('code', $account_currency_code)->first();
$vendors = Contact::vendor()->enabled()->orderBy('name')->pluck('name', 'id');
$vendors = Contact::vendor()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
$categories = Category::expense()->enabled()->orderBy('name')->pluck('name', 'id');
$categories = Category::expense()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
$payment_methods = Modules::getPaymentMethods();
@ -154,9 +148,9 @@ class Payments extends Controller
$currency = Currency::where('code', $payment->currency_code)->first();
$vendors = Contact::vendor()->enabled()->orderBy('name')->pluck('name', 'id');
$vendors = Contact::vendor()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
$categories = Category::expense()->enabled()->orderBy('name')->pluck('name', 'id');
$categories = Category::expense()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
$payment_methods = Modules::getPaymentMethods();

View File

@ -30,7 +30,7 @@ class Vendors extends Controller
{
$vendors = Contact::with('bills.transactions')->vendor()->collect();
return view('purchases.vendors.index', compact('vendors'));
return $this->response('purchases.vendors.index', compact('vendors'));
}
/**

View File

@ -28,7 +28,7 @@ class Customers extends Controller
{
$customers = Contact::with('invoices.transactions')->customer()->collect();
return view('sales.customers.index', compact('customers'));
return $this->response('sales.customers.index', compact('customers'));
}
/**

View File

@ -40,13 +40,7 @@ class Invoices extends Controller
{
$invoices = Invoice::with('contact', 'transactions')->collect(['invoice_number'=> 'desc']);
$customers = Contact::customer()->enabled()->orderBy('name')->pluck('name', 'id');
$categories = Category::income()->enabled()->orderBy('name')->pluck('name', 'id');
$statuses = $this->getInvoiceStatuses();
return view('sales.invoices.index', compact('invoices', 'customers', 'categories', 'statuses'));
return $this->response('sales.invoices.index', compact('invoices'));
}
/**
@ -99,7 +93,7 @@ class Invoices extends Controller
*/
public function create()
{
$customers = Contact::customer()->enabled()->orderBy('name')->pluck('name', 'id');
$customers = Contact::customer()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
$currencies = Currency::enabled()->orderBy('name')->pluck('name', 'code')->toArray();
@ -109,7 +103,7 @@ class Invoices extends Controller
$taxes = Tax::enabled()->orderBy('name')->get();
$categories = Category::income()->enabled()->orderBy('name')->pluck('name', 'id');
$categories = Category::income()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
$number = $this->getNextInvoiceNumber();
@ -195,7 +189,7 @@ class Invoices extends Controller
*/
public function edit(Invoice $invoice)
{
$customers = Contact::customer()->enabled()->orderBy('name')->pluck('name', 'id');
$customers = Contact::customer()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
$currencies = Currency::enabled()->orderBy('name')->pluck('name', 'code')->toArray();
@ -205,7 +199,7 @@ class Invoices extends Controller
$taxes = Tax::enabled()->orderBy('name')->get();
$categories = Category::income()->enabled()->orderBy('name')->pluck('name', 'id');
$categories = Category::income()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
return view('sales.invoices.edit', compact('invoice', 'customers', 'currencies', 'currency', 'items', 'taxes', 'categories'));
}

View File

@ -32,13 +32,7 @@ class Revenues extends Controller
{
$revenues = Transaction::with('account', 'category', 'contact', 'invoice')->income()->isNotTransfer()->collect(['paid_at'=> 'desc']);
$customers = Contact::customer()->enabled()->orderBy('name')->pluck('name', 'id');
$categories = Category::income()->enabled()->orderBy('name')->pluck('name', 'id');
$accounts = Account::enabled()->orderBy('name')->pluck('name', 'id');
return view('sales.revenues.index', compact('revenues', 'customers', 'categories', 'accounts'));
return $this->response('sales.revenues.index', compact('revenues'));
}
/**
@ -66,9 +60,9 @@ class Revenues extends Controller
$currency = Currency::where('code', $account_currency_code)->first();
$customers = Contact::customer()->enabled()->orderBy('name')->pluck('name', 'id');
$customers = Contact::customer()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
$categories = Category::income()->enabled()->orderBy('name')->pluck('name', 'id');
$categories = Category::income()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
$payment_methods = Modules::getPaymentMethods();
@ -154,9 +148,9 @@ class Revenues extends Controller
$currency = Currency::where('code', $revenue->currency_code)->first();
$customers = Contact::customer()->enabled()->orderBy('name')->pluck('name', 'id');
$customers = Contact::customer()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
$categories = Category::income()->enabled()->orderBy('name')->pluck('name', 'id');
$categories = Category::income()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
$payment_methods = Modules::getPaymentMethods();

View File

@ -30,7 +30,7 @@ class Categories extends Controller
'other' => trans_choice('general.others', 1),
]);
return view('settings.categories.index', compact('categories', 'types', 'transfer_id'));
return $this->response('settings.categories.index', compact('categories', 'types', 'transfer_id'));
}
/**

View File

@ -21,7 +21,7 @@ class Currencies extends Controller
{
$currencies = Currency::collect();
return view('settings.currencies.index', compact('currencies'));
return $this->response('settings.currencies.index', compact('currencies'));
}
/**

View File

@ -4,6 +4,7 @@ namespace App\Http\Controllers\Settings;
use App\Abstracts\Http\Controller;
use App\Models\Banking\Account;
use App\Models\Setting\Category;
use App\Models\Setting\Currency;
use App\Models\Setting\Tax;
use App\Utilities\Modules;
@ -16,6 +17,9 @@ class Defaults extends Controller
$currencies = Currency::enabled()->orderBy('name')->pluck('name', 'code');
$sales_categories = Category::income()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
$purchases_categories = Category::expense()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
$taxes = Tax::enabled()->orderBy('name')->get()->pluck('title', 'id');
$payment_methods = Modules::getPaymentMethods();
@ -23,6 +27,8 @@ class Defaults extends Controller
return view('settings.default.edit', compact(
'accounts',
'currencies',
'sales_categories',
'purchases_categories',
'taxes',
'payment_methods'
));

View File

@ -63,7 +63,7 @@ class Settings extends Controller
$settings[$alias] = $setting;
}
return view('settings.settings.index', ['modules' => $settings]);
return $this->response('settings.settings.index', ['modules' => $settings]);
}
/**

View File

@ -29,7 +29,7 @@ class Taxes extends Controller
'compound' => trans('taxes.compound'),
];
return view('settings.taxes.index', compact('taxes', 'types'));
return $this->response('settings.taxes.index', compact('taxes', 'types'));
}
/**

View File

@ -0,0 +1,10 @@
<?php
namespace App\Http\Responses\Common;
use App\Abstracts\Http\Response;
class Items extends Response
{
//
}

View File

@ -4,6 +4,9 @@ namespace App\Listeners\Update\V21;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Models\Setting\Category;
use App\Models\Common\Company;
use App\Utilities\Overrider;
use Illuminate\Support\Facades\Artisan;
class Version210 extends Listener
@ -24,6 +27,42 @@ class Version210 extends Listener
return;
}
$this->updateCompanies();
Artisan::call('migrate', ['--force' => true]);
}
protected function updateCompanies()
{
$company_id = session('company_id');
$companies = Company::cursor();
foreach ($companies as $company) {
session(['company_id' => $company->id]);
$this->updateSettings($company);
}
setting()->forgetAll();
session(['company_id' => $company_id]);
Overrider::load('settings');
}
public function updateSettings($company)
{
$income_category = Category::income()->enabled()->first();
$expense_category = Category::expense()->enabled()->first();
// Set the active company settings
setting()->setExtraColumns(['company_id' => $company->id]);
setting()->forgetAll();
setting()->load(true);
setting()->set(['default.income_category' => setting('default.income_category', $income_category->id)]);
setting()->set(['default.expense_category' => setting('default.expense_category', $expense_category->id)]);
setting()->save();
}
}

View File

@ -275,9 +275,16 @@ class Company extends Eloquent
$request = request();
$search = $request->get('search');
$query = user()->companies()->usingSearchString($search)->sortable($sort);
if ($request->expectsJson()) {
return $query->get();
}
$limit = $request->get('limit', setting('default.list_limit', '25'));
return user()->companies()->usingSearchString($search)->sortable($sort)->paginate($limit);
return $query->paginate($limit);
}
/**

View File

@ -31,6 +31,11 @@ class BillTotal extends Model
return $this->belongsTo('App\Models\Purchase\Bill');
}
public function scopeCode($query, $code)
{
return $query->where('code', '=', $code);
}
/**
* Convert amount to double.
*

View File

@ -31,6 +31,11 @@ class InvoiceTotal extends Model
return $this->belongsTo('App\Models\Sale\Invoice');
}
public function scopeCode($query, $code)
{
return $query->where('code', '=', $code);
}
/**
* Convert amount to double.
*

View File

@ -59,6 +59,10 @@ class Form extends Provider
'name', 'text', 'icon', 'values', 'selected' => null, 'attributes' => ['required' => 'required'], 'col' => 'col-md-6', 'group_class' => null
]);
Facade::component('multiSelectRemoteAddNewGroup', 'partials.form.multi_select_remote_add_new_group', [
'name', 'text', 'icon', 'values', 'selected' => null, 'attributes' => ['required' => 'required', 'path' => ''], 'col' => 'col-md-6', 'group_class' => null
]);
Facade::component('selectGroup', 'partials.form.select_group', [
'name', 'text', 'icon', 'values', 'selected' => null, 'attributes' => ['required' => 'required'], 'col' => 'col-md-6', 'group_class' => null
]);
@ -79,6 +83,10 @@ class Form extends Provider
'name', 'text', 'icon', 'values', 'selected' => null, 'attributes' => ['required' => 'required'], 'col' => 'col-md-6', 'group_class' => null
]);
Facade::component('selectRemoteAddNewGroup', 'partials.form.select_remote_add_new_group', [
'name', 'text', 'icon', 'values', 'selected' => null, 'attributes' => ['required' => 'required', 'path' => ''], 'col' => 'col-md-6', 'group_class' => null
]);
Facade::component('textareaGroup', 'partials.form.textarea_group', [
'name', 'text', 'icon', 'value' => null, 'attributes' => ['rows' => '3'], 'col' => 'col-md-12', 'group_class' => null
]);

View File

@ -0,0 +1,196 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
use Illuminate\Support\Str;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
class SearchString extends Component
{
public $filters;
public $model;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct($model)
{
$this->model = $model;
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|string
*/
public function render()
{
$searc_string = config('search-string');
$this->filters = [];
if (!empty($searc_string[$this->model])) {
$columns = $searc_string[$this->model]['columns'];
foreach ($columns as $column => $options) {
// This column skip for filter
if (!empty($options['searchable'])) {
continue;
}
if (!is_array($options)) {
$column = $options;
}
if (!$this->isFilter($column, $options)) {
continue;
}
$this->filters[] = [
'key' => $this->getFilterKey($column, $options),
'value' => $this->getFilterName($column),
'type' => $this->getFilterType($options),
'url' => $this->getFilterUrl($column, $options),
'values' => $this->getFilterValues($column, $options),
];
}
}
return view('components.search-string');
}
protected function isFilter($column, $options)
{
$filter = true;
if (empty($this->getFilterUrl($column, $options)) && (!isset($options['date']) && !isset($options['boolean']))) {
$filter = false;
}
return $filter;
}
protected function getFilterKey($column, $options)
{
if (isset($options['relationship'])) {
$column .= '.id';
}
return $column;
}
protected function getFilterName($column)
{
if (strpos($column, '_id') !== false) {
$column = str_replace('_id', '', $column);
} else if (strpos($column, '_code') !== false) {
$column = str_replace('_code', '', $column);
}
$plural = Str::plural($column, 2);
if (trans_choice('general.' . $plural, 1) !== 'general.' . $plural) {
return trans_choice('general.' . $plural, 1);
} elseif (trans_choice('search_string.columns.' . $plural, 1) !== 'search_string.columns.' . $plural) {
return trans_choice('search_string.columns.' . $plural, 1);
}
$name = trans('general.' . $column);
if ($name == 'general.' . $column) {
$name = trans('search_string.columns.' . $column);
}
return $name;
}
protected function getFilterType($options)
{
$type = 'select';
if (isset($options['boolean'])) {
$type = 'boolean';
}
if (isset($options['date'])) {
$type = 'date';
}
return $type;
}
protected function getFilterUrl($column, $options)
{
$url = '';
if (isset($options['boolean']) || isset($options['date'])) {
return $url;
}
if (!empty($options['route'])) {
if (is_array($options['route'])) {
$url = route($options['route'][0], $options['route'][1]);
} else {
$url = route($options['route']);
}
} else {
if (strpos($this->model, 'Modules') !== false) {
$module_class = explode('\\', $this->model);
$url .= Str::slug($module_class[1], '-') . '::';
}
if (strpos($column, '_id') !== false) {
$column = str_replace('_id', '', $column);
}
$plural = Str::plural($column, 2);
try {
$url = route($url . $plural . '.index');
} catch (\Exception $e) {
$url = '';
}
}
return $url;
}
protected function getFilterValues($column, $options)
{
$values = [];
if (isset($options['boolean'])) {
$values = [
[
'key' => 0,
'value' => trans('general.no'),
],
[
'key' => 1,
'value' => trans('general.yes'),
],
];
} else if ($search = request()->get('search', false)) {
$fields = explode(' ', $search);
foreach ($fields as $field) {
if (strpos($field, ':') === false) {
continue;
}
$filters = explode(':', $field);
if ($filters[0] != $column) {
continue;
}
}
}
return $values;
}
}

View File

@ -111,7 +111,7 @@ return [
'resource' => ['path' => 'Http/Resources', 'generate' => false],
'asset' => ['path' => 'Resources/assets', 'generate' => false],
'lang' => ['path' => 'Resources/lang/en-GB', 'generate' => true],
'views' => ['path' => 'Resources/views', 'generate' => true],
'view' => ['path' => 'Resources/views', 'generate' => true],
'test' => ['path' => 'Tests', 'generate' => false],
'repository' => ['path' => 'Repositories', 'generate' => false],
'event' => ['path' => 'Events', 'generate' => false],
@ -122,6 +122,7 @@ return [
'email' => ['path' => 'Emails', 'generate' => false],
'notification' => ['path' => 'Notifications', 'generate' => false],
'route' => ['path' => 'Routes', 'generate' => true],
'component' => ['path' => 'View/Components', 'generate' => false],
],
],

View File

@ -69,7 +69,9 @@ return [
'number' => ['searchable' => true],
'bank_name' => ['searchable' => true],
'bank_address' => ['searchable' => true],
'currency' => ['relationship' => true],
'currency_code' => [
'route' => 'currencies.index'
],
'enabled' => ['boolean' => true],
],
],
@ -87,16 +89,24 @@ return [
App\Models\Banking\Transaction::class => [
'columns' => [
'type',
'account_id',
'account_id' => [
'route' => 'accounts.index'
],
'paid_at' => ['date' => true],
'amount',
'currency_code',
'currency_code' => [
'route' => 'currencies.index'
],
'document_id',
'contact_id',
'contact_id' => [
'route' => 'customers.index'
],
'description' => ['searchable' => true],
'payment_method',
'reference',
'category_id',
'category_id' => [
'route' => 'categories.index'
],
'parent_id',
],
],
@ -120,8 +130,10 @@ return [
'name' => ['searchable' => true],
'description' => ['searchable' => true],
'enabled' => ['boolean' => true],
'category_id' => ['key' => 'category_id'],
'sale_price',
'category_id' => [
'route' => ['categories.index', 'search=type:item']
],
'sales_price',
'purchase_price',
],
],
@ -135,7 +147,9 @@ return [
'phone' => ['searchable' => true],
'address' => ['searchable' => true],
'website' => ['searchable' => true],
'currency_code',
'currency_code' => [
'route' => 'currencies.index'
],
'reference',
'user_id',
'enabled' => ['boolean' => true],
@ -150,14 +164,20 @@ return [
'billed_at' => ['date' => true],
'due_at' => ['date' => true],
'amount',
'currency_code',
'contact_id',
'currency_code' => [
'route' => 'currencies.index'
],
'contact_id' => [
'route' => 'vendors.index'
],
'contact_name' => ['searchable' => true],
'contact_email' => ['searchable' => true],
'contact_tax_number',
'contact_phone' => ['searchable' => true],
'contact_address' => ['searchable' => true],
'category_id',
'category_id' => [
'route' => 'categories.index'
],
'parent_id',
],
],
@ -170,14 +190,20 @@ return [
'invoiced_at' => ['date' => true],
'due_at' => ['date' => true],
'amount',
'currency_code',
'contact_id',
'currency_code' => [
'route' => 'currencies.index'
],
'contact_id' => [
'route' => 'customer.index'
],
'contact_name' => ['searchable' => true],
'contact_email' => ['searchable' => true],
'contact_tax_number',
'contact_phone' => ['searchable' => true],
'contact_address' => ['searchable' => true],
'category_id',
'category_id' => [
'route' => 'categories.index'
],
'parent_id',
],
],

View File

@ -120,6 +120,7 @@ return [
'locale' => env('SETTING_FALLBACK_DEFAULT_LOCALE', 'en-GB'),
'list_limit' => env('SETTING_FALLBACK_DEFAULT_LIST_LIMIT', '25'),
'payment_method' => env('SETTING_FALLBACK_DEFAULT_PAYMENT_METHOD', 'offline-payments.cash.1'),
'select_limit' => env('SETTING_FALLBACK_DEFAULT_SELECT_LIMIT', '10'),
],
'email' => [
'protocol' => env('SETTING_FALLBACK_EMAIL_PROTOCOL', 'mail'),

View File

@ -64,8 +64,26 @@ class Categories extends Seeder
],
];
$income_category = $expense_category = false;
foreach ($rows as $row) {
Category::create($row);
$category = Category::create($row);
switch ($category->type) {
case 'income':
if (empty($income_category)) {
$income_category = $category;
}
break;
case 'expense':
if (empty($expense_category)) {
$expense_category = $category;
}
break;
}
}
setting()->set('default.income_category', $income_category->id);
setting()->set('default.expense_category', $expense_category->id);
}
}

View File

@ -846,3 +846,9 @@ table .align-items-center td span.badge {
border: 1px solid #3c3f72;
}
/*--lightbox Finish--*/
/*-- Search string & BulkAction Start --*/
#app > .card > .card-header {
min-height: 88px;
}
/*-- Search string & BulkAction Finish --*/

View File

@ -7,19 +7,26 @@
*/
;(function (factory) {
var registeredInModuleLoader = false;
if (typeof define === 'function' && define.amd) {
define(factory);
registeredInModuleLoader = true;
}
if (typeof exports === 'object') {
module.exports = factory();
registeredInModuleLoader = true;
}
if (!registeredInModuleLoader) {
var OldCookies = window.Cookies;
var api = window.Cookies = factory();
api.noConflict = function () {
window.Cookies = OldCookies;
return api;
};
}
@ -27,24 +34,27 @@
function extend () {
var i = 0;
var result = {};
for (; i < arguments.length; i++) {
var attributes = arguments[ i ];
for (var key in attributes) {
result[key] = attributes[key];
}
}
return result;
}
function init (converter) {
function api (key, value, attributes) {
var result;
if (typeof document === 'undefined') {
return;
}
// Write
if (arguments.length > 1) {
attributes = extend({
path: '/'
@ -52,7 +62,9 @@
if (typeof attributes.expires === 'number') {
var expires = new Date();
expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
attributes.expires = expires;
}
@ -61,6 +73,7 @@
try {
result = JSON.stringify(value);
if (/^[\{\[]/.test(result)) {
value = result;
}
@ -83,17 +96,20 @@
if (!attributes[attributeName]) {
continue;
}
stringifiedAttributes += '; ' + attributeName;
if (attributes[attributeName] === true) {
continue;
}
stringifiedAttributes += '=' + attributes[attributeName];
}
return (document.cookie = key + '=' + value + stringifiedAttributes);
}
// Read
if (!key) {
result = {};
}
@ -115,6 +131,7 @@
try {
var name = parts[0].replace(rdecode, decodeURIComponent);
cookie = converter.read ?
converter.read(cookie, name) : converter(cookie, name) ||
cookie.replace(rdecode, decodeURIComponent);
@ -140,14 +157,17 @@
}
api.set = api;
api.get = function (key) {
return api.call(api, key);
};
api.getJSON = function () {
return api.apply({
json: true
}, [].slice.call(arguments));
};
api.defaults = {};
api.remove = function (key, attributes) {

View File

@ -1,175 +1,681 @@
<template>
<div :id="'search-field-' + _uid" class="searh-field tags-input__wrapper">
<div class="tags-group" v-for="(filter, index) in filtered" :index="index">
<span v-if="filter.option" class="el-tag el-tag--primary el-tag--small el-tag--light el-tag-option">
{{ filter.option }}
</span>
<el-select
:class="'pl-20 mr-40'"
v-model="real_model"
@input="change"
filterable
remote
reserve-keyword
<span v-if="filter.operator" class="el-tag el-tag--primary el-tag--small el-tag--light el-tag-operator">
{{ (filter.operator == '=') ? operatorIsText : operatorIsNotText }}
</span>
<span v-if="filter.value" class="el-tag el-tag--primary el-tag--small el-tag--light el-tag-value">
{{ filter.value }}
<i class="el-tag__close el-icon-close" @click="onFilterDelete(index)"></i>
</span>
</div>
<div class="dropdown input-full">
<input
v-if="!show_date"
type="text"
class="form-control"
:placeholder="placeholder"
:remote-method="remoteMethod"
:loading="loading">
<div v-if="loading" class="el-select-dropdown__wrap" slot="empty">
<p class="el-select-dropdown__empty loading">
{{ loadingText }}
</p>
</div>
:ref="'input-search-field-' + _uid"
v-model="search"
@focus="onInputFocus"
@input="onInput"
@keyup.enter="onInputConfirm"
/>
<div v-else-if="options.length != 0" class="el-select-dropdown__wrap" slot="empty">
<p class="el-select-dropdown__empty">
{{ noMatchingDataText }}
</p>
</div>
<flat-picker
v-else
@on-open="onInputFocus"
:config="dateConfig"
class="form-control datepicker"
:placeholder="placeholder"
:ref="'input-search-date-field-' + _uid"
v-model="search"
@focus="onInputFocus"
@input="onInputDateSelected"
@keyup.enter="onInputConfirm"
>
</flat-picker>
<div v-else-if="options.length == 0" slot="empty">
<p class="el-select-dropdown__empty">
{{ noDataText }}
</p>
</div>
<button type="button" class="btn btn-link clear" @click="onSearchAndFilterClear">
<i class="el-tag__close el-icon-close"></i>
</button>
<template v-if="icon" slot="prefix">
<span class="el-input__suffix-inner el-select-icon">
<i :class="'select-icon-position el-input__icon fa fa-' + icon"></i>
</span>
</template>
<div :id="'search-field-option-' + _uid" class="dropdown-menu" :class="[{'show': visible.options}]">
<li ref="" class="dropdown-item" v-for="option in filteredOptions" :data-value="option.key">
<button type="button" class="btn btn-link" @click="onOptionSelected(option.key)">{{ option.value }}</button>
</li>
<li ref="" v-if="search" class="dropdown-item">
<button type="button" class="btn btn-link" @click="onInputConfirm">{{ searchText }}</button>
</li>
</div>
<el-option v-if="!group" v-for="option in selectOptions"
:key="option.id"
:label="option.name"
:value="option.id">
</el-option>
<el-option-group
v-if="group"
v-for="(options, name) in selectOptions"
:key="name"
:label="name">
<el-option
v-for="(label, value) in options"
:key="value"
:label="label"
:value="value">
</el-option>
</el-option-group>
</el-select>
<div :id="'search-field-operator-' + _uid" class="dropdown-menu" :class="[{'show': visible.operator}]">
<li ref="" class="dropdown-item">
<button type="button" class="btn btn-link" @click="onOperatorSelected('=')">{{ operatorIsText }}<span class="btn-helptext d-none">is</span></button>
</li>
<li ref="" class="dropdown-item">
<button type="button" class="btn btn-link" @click="onOperatorSelected('!=')">{{ operatorIsNotText }}<span class="btn-helptext d-none">is not</span></button>
</li>
</div>
<div :id="'search-field-value-' + _uid" class="dropdown-menu" :class="[{'show': visible.values}]">
<li ref="" class="dropdown-item" v-for="(value) in filteredValues" :data-value="value.key">
<button type="button" class="btn btn-link" @click="onValueSelected(value.key)">{{ value.value }}</button>
</li>
<li ref="" class="dropdown-item" v-if="!filteredValues.length">
<button type="button" class="btn btn-link">{{ noMatchingDataText }}</button>
</li>
</div>
</div>
</div>
</template>
<style>
.el-select {
display: inline;
}
</style>
<script>
import { Select, Option, OptionGroup } from 'element-ui';
import flatPicker from "vue-flatpickr-component";
import "flatpickr/dist/flatpickr.css";
export default {
name: 'akaunting-select',
export default {
name: 'akaunting-search',
components: {
[Select.name]: Select,
[Option.name]: Option,
[OptionGroup.name]: OptionGroup,
},
components: {
flatPicker
},
props: {
name: {
type: String,
default: null,
description: "Selectbox attribute name"
},
placeholder: {
type: String,
default: '',
description: "Selectbox input placeholder text"
},
options: null,
value: {
type: String,
default: null,
description: "Selectbox selected value"
},
props: {
placeholder: {
type: String,
default: 'Search or filter results...',
description: 'Input placeholder'
},
searchText: {
type: String,
default: 'Search for this text',
description: 'Input placeholder'
},
operatorIsText: {
type: String,
default: 'is',
description: 'Operator is "="'
},
operatorIsNotText: {
type: String,
default: 'is not',
description: 'Operator is not "!="'
},
noDataText: {
type: String,
default: 'No Data',
description: "Selectbox empty options message"
},
noMatchingDataText: {
type: String,
default: 'No Matchign Data',
description: "Selectbox search option not found item message"
},
value: {
type: String,
default: null,
description: 'Search attribute value'
},
filters: {
type: Array,
default: () => [],
description: 'List of filters'
},
icon: {
type: String,
description: "Prepend icon (left)"
},
dateConfig: null,
},
group: {
type: Boolean,
default: false,
description: "Selectbox option group status"
},
model: {
prop: 'value',
event: 'change'
},
loadingText: {
type: String,
default: 'Loading...',
description: "Selectbox loading message"
},
noDataText: {
type: String,
default: 'No Data',
description: "Selectbox empty options message"
},
noMatchingDataText: {
type: String,
default: 'No Matchign Data',
description: "Selectbox search option not found item message"
},
data() {
return {
filter_list: this.filters, // set filters prop assing it.
search: '', // search cloumn model
filtered:[], // Show selected filters
filter_index: 0, // added filter count
filter_last_step: 'options', // last fitler step
visible: { // Which visible dropdown
options: false,
operator: false,
values: false,
},
remoteAction: {
type: String,
default: null,
description: "Selectbox remote action path"
},
remoteType: {
type: String,
default: 'invoice',
description: "Ger remote item type."
},
},
option_values: [],
selected_options: [],
selected_values: [],
values: [],
current_value: null,
show_date: false,
};
},
data() {
return {
list: [],
selectOptions: this.options,
real_model: this.model,
loading: false,
methods: {
onInputFocus() {
if (!this.filter_list.length) {
return;
}
if (this.filter_last_step != 'values' || (this.filter_last_step == 'values' && this.selected_options[this.filter_index].type != 'date')) {
this.visible[this.filter_last_step] = true;
this.$nextTick(() => {
this.$refs['input-search-field-' + this._uid].focus();
});
} else {
this.show_date = true;
this.$nextTick(() => {
this.$refs['input-search-date-field-' + this._uid].focus();
});
}
console.log('Focus :' + this.filter_last_step);
},
onInputDateSelected(event) {
this.filtered[this.filter_index].value = event;
this.selected_values.push({
key: event,
value: event,
});
this.$emit('change', this.filtered);
this.show_date = false;
this.search = '';
this.$nextTick(() => {
this.$refs['input-search-field-' + this._uid].focus();
});
this.filter_index++;
if (this.filter_list.length) {
this.visible = {
options: true,
operator: false,
values: false,
};
} else {
this.visible = {
options: false,
operator: false,
values: false,
};
}
this.show_date = false;
this.filter_last_step = 'options';
},
onInput(evt) {
this.search = evt.target.value;
let option_url = this.selected_options[this.filter_index].url;
if (this.search) {
option_url += '?search=' + this.search;
}
if (option_url) {
window.axios.get(option_url)
.then(response => {
this.values = [];
let data = response.data.data;
data.forEach(function (item) {
this.values.push({
key: item.id,
value: item.name
});
}, this);
this.option_values[value] = this.values;
})
.catch(error => {
});
}
this.$emit('input', evt.target.value);
},
onInputConfirm() {
let path = window.location.href.replace(window.location.search, '');
let args = '';
if (this.search) {
args += '?search=' + this.search + ' ';
}
let now = new Date();
now.setTime(now.getTime() + 1 * 3600 * 1000);
let expires = now.toUTCString();
let serach_string = {};
serach_string[path] = {};
this.filtered.forEach(function (filter, index) {
if (!args) {
args += '?search=';
}
args += this.selected_options[index].key + ':' + this.selected_values[index].key + ' ';
serach_string[path][this.selected_options[index].key] = {
'key': this.selected_values[index].key,
'value': this.selected_values[index].value
};
}, this);
Cookies.set('search-string', serach_string, expires);
window.location = path + args;
},
onOptionSelected(value) {
this.current_value = value;
let option = false;
let option_url = false;
for (let i = 0; i < this.filter_list.length; i++) {
if (this.filter_list[i].key == value) {
option = this.filter_list[i].value;
if (typeof this.filter_list[i].url !== 'undefined' && this.filter_list[i].url) {
option_url = this.filter_list[i].url;
}
if (typeof this.filter_list[i].type !== 'undefined' && this.filter_list[i].type == 'boolean') {
this.option_values[value] = this.filter_list[i].values;
}
this.selected_options.push(this.filter_list[i]);
this.filter_list.splice(i, 1);
break;
}
}
// Set filtered select option
this.filtered.push({
option: option,
operator: false,
value: false
});
this.$emit('change', this.filtered);
this.search = '';
if (!this.option_values[value] && option_url) {
window.axios.get(option_url)
.then(response => {
let data = response.data.data;
data.forEach(function (item) {
this.values.push({
key: (item.code) ? item.code : item.id,
value: (item.title) ? item.title : (item.display_name) ? item.display_name : item.name
});
}, this);
this.option_values[value] = this.values;
})
.catch(error => {
});
} else {
this.values = (this.option_values[value]) ? this.option_values[value] : [];
}
this.$nextTick(() => {
this.$refs['input-search-field-' + this._uid].focus();
});
this.visible = {
options: false,
operator: true,
values: false,
};
this.filter_last_step = 'operator';
},
onOperatorSelected(value) {
this.filtered[this.filter_index].operator = value;
this.$emit('change', this.filtered);
if (this.selected_options[this.filter_index].type != 'date') {
this.$nextTick(() => {
this.$refs['input-search-field-' + this._uid].focus();
});
this.visible = {
options: false,
operator: false,
values: true,
};
} else {
this.show_date = true;
this.$nextTick(() => {
this.$refs['input-search-date-field-' + this._uid].focus();
});
this.visible = {
options: false,
operator: false,
values: false,
};
}
this.filter_last_step = 'values';
},
onValueSelected(value) {
let select_value = false;
for (let i = 0; i < this.values.length; i++) {
if (this.values[i].key == value) {
select_value = this.values[i].value;
this.selected_values.push(this.values[i]);
this.option_values[this.current_value].splice(i, 1);
break;
}
}
this.filtered[this.filter_index].value = select_value;
this.$emit('change', this.filtered);
this.$nextTick(() => {
this.$refs['input-search-field-' + this._uid].focus();
});
this.filter_index++;
if (this.filter_list.length) {
this.visible = {
options: true,
operator: false,
values: false,
};
} else {
this.visible = {
options: false,
operator: false,
values: false,
};
}
this.show_date = false;
this.filter_last_step = 'options';
},
onFilterDelete(index) {
this.filter_list.push(this.selected_options[index]);
this.filter_index--;
this.filtered.splice(index, 1);
this.selected_options.splice(index, 1);
},
onSearchAndFilterClear() {
this.filtered = [];
this.search = '';
Cookies.remove('search-string');
this.onInputConfirm();
},
closeIfClickedOutside(event) {
if (!document.getElementById('search-field-' + this._uid).contains(event.target) && event.target.className != 'btn btn-link') {
this.visible.options = false;
this.visible.operator = false;
this.visible.values = false;
document.removeEventListener('click', this.closeIfClickedOutside);
}
},
},
created() {
let path = window.location.href.replace(window.location.search, '');
let cookie = Cookies.get('search-string');
cookie = JSON.parse(cookie)[path];
if (this.value) {
let serach_string = this.value.split(' ');
serach_string.forEach(function (string) {
if (string.search(':') === -1) {
this.search = string;
} else {
let filter = string.split(':');
let option = '';
let value = '';
this.filter_list.forEach(function (_filter, i) {
if (_filter.key == filter[0]) {
option = _filter.value;
_filter.values.forEach(function (_value) {
if (_value.key == filter[1]) {
value = _value.value;
}
}, this);
if (!value && cookie[_filter.key]) {
value = cookie[_filter.key].value;
}
this.selected_options.push(this.filter_list[i]);
this.filter_list.splice(i, 1);
this.option_values[_filter.key] = _filter.values;
_filter.values.forEach(function (value, j) {
if (value.key == filter[1]) {
this.selected_values.push(value);
this.option_values[_filter.key].splice(j, 1);
}
}, this);
if (cookie[_filter.key]) {
this.selected_values.push(cookie[_filter.key]);
}
}
},
}, this);
mounted() {
this.real_model = this.value;
this.filtered.push({
option: option,
operator: '=',
value: value
});
this.$emit('interface', this.real_model);
},
methods: {
change() {
this.$emit('change', this.real_model);
this.$emit('interface', this.real_model);
this.selectOptions.forEach(item => {
if (item.id == this.real_model) {
this.$emit('label', item.name);
this.$emit('option', item);
return;
}
});
},
remoteMethod() {
},
},
watch: {
options: function (options) {
// update options
//this.selectOptions = options;
}
},
this.filter_index++;
}
}, this);
}
},
computed: {
filteredOptions() {
this.filter_list.sort(function (a, b) {
var nameA = a.value.toUpperCase(); // ignore upper and lowercase
var nameB = b.value.toUpperCase(); // ignore upper and lowercase
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
// names must be equal
return 0;
});
return this.filter_list.filter(option => {
return option.value.toLowerCase().includes(this.search.toLowerCase())
});
},
filteredValues() {
this.values.sort(function (a, b) {
var nameA = a.value.toUpperCase(); // ignore upper and lowercase
var nameB = b.value.toUpperCase(); // ignore upper and lowercase
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
// names must be equal
return 0;
});
return this.values.filter(value => {
return value.value.toLowerCase().includes(this.search.toLowerCase())
})
}
},
watch: {
visible: {
handler: function(newValue) {
if (newValue) {
document.addEventListener('click', this.closeIfClickedOutside);
}
},
deep: true
}
},
};
</script>
<style>
.searh-field {
border: 1px solid #dee2e6;
border-radius: 0.25rem;
}
.searh-field .tags-group {
display: contents;
}
.searh-field .el-tag.el-tag--primary {
background: #f6f9fc;
background-color: #f6f9fc;
border-color: #f6f9fc;
color: #8898aa;
margin-top: 7px;
}
.searh-field .tags-group:hover > span {
background:#cbd4de;
background-color: #cbd4de;
border-color: #cbd4de;
}
.searh-field .el-tag.el-tag--primary .el-tag__close.el-icon-close {
color: #8898aa;
}
.searh-field .el-tag-option {
border-radius: 0.25rem 0 0 0.25rem;
margin-left: 10px;
}
.searh-field .el-tag-operator {
border-radius: 0;
margin-left: -1px;
margin-right: -1px;
}
.searh-field .el-tag-value {
border-radius: 0 0.25rem 0.25rem 0;
margin-right: 10px;
}
.searh-field .el-select.input-new-tag {
width: 100%;
}
.searh-field .input-full {
width: 100%;
}
.searh-field .btn.btn-link {
width: inherit;
text-align: left;
display: flex;
margin: 0;
text-overflow: inherit;
text-align: left;
text-overflow: ellipsis;
padding: unset;
color: #212529;
}
.searh-field .btn.btn-link.clear {
position: absolute;
top: 0;
right: 0;
width: 45px;
height: 45px;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
color: #adb5bd;
opacity: 1;
}
.searh-field .btn.btn-link.clear:hover {
color: #8898aa;
}
.searh-field .btn-helptext {
margin-left: auto;
color: var(--gray);
}
.searh-field .btn:not(:disabled):not(.disabled):active:focus,
.searh-field .btn:not(:disabled):not(.disabled).active:focus {
-webkit-box-shadow: none !important;
box-shadow: none !important;
}
.searh-field .form-control.datepicker.flatpickr-input {
padding: inherit !important;
}
</style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@ const app = new Vue({
],
mounted() {
if (!this.form.permissions.length) {
if (typeof this.form.permissions !== 'undefined' && !this.form.permissions.length) {
this.form.permissions = [];
}
},

View File

@ -105,6 +105,7 @@ return [
'to' => 'To',
'print' => 'Print',
'search' => 'Search',
'search_text' => 'Search for this text',
'search_placeholder' => 'Type to search..',
'filter' => 'Filter',
'help' => 'Help',
@ -152,6 +153,8 @@ return [
'no_matching_data' => 'No matching data',
'clear_cache' => 'Clear Cache',
'go_to_dashboard' => 'Go to dashboard',
'is' => 'is',
'isnot' => 'is not',
'card' => [
'name' => 'Name on Card',
@ -181,6 +184,11 @@ return [
'no_file_selected' => 'No file selected...',
],
'placeholder' => [
'search' => 'Type to search..',
'search_and_filter' => 'Search or filter results..',
],
'date_range' => [
'today' => 'Today',
'yesterday' => 'Yesterday',

View File

@ -0,0 +1,9 @@
<?php
return [
'columns' => [
'last_logged_in_at' => 'Last Login',
],
];

View File

@ -68,6 +68,8 @@ return [
'description' => 'Default account, currency, language of your company',
'list_limit' => 'Records Per Page',
'use_gravatar' => 'Use Gravatar',
'income_category' => 'Income Category',
'expense_category' => 'Expense Category',
],
'email' => [

View File

@ -18,10 +18,7 @@
'class' => 'mb-0'
]) !!}
<div class="align-items-center" v-if="!bulk_action.show">
<akaunting-search
:placeholder="'{{ trans('general.search_placeholder') }}'"
:options="{{ json_encode([]) }}"
></akaunting-search>
<x-search-string model="App\Models\Auth\Permission" />
</div>
{{ Form::bulkActionRowGroup('general.permissions', $bulk_actions, ['group' => 'auth', 'type' => 'permissions']) }}

View File

@ -18,10 +18,7 @@
'class' => 'mb-0'
]) !!}
<div class="align-items-center" v-if="!bulk_action.show">
<akaunting-search
:placeholder="'{{ trans('general.search_placeholder') }}'"
:options="{{ json_encode([]) }}"
></akaunting-search>
<x-search-string model="App\Models\Auth\Role" />
</div>
{{ Form::bulkActionRowGroup('general.roles', $bulk_actions, ['group' => 'auth', 'type' => 'roles']) }}

View File

@ -48,7 +48,7 @@
@endif
@can('read-common-companies')
{{ Form::multiSelectRemoteGroup('companies', trans_choice('general.companies', 2), 'user', $companies, [], ['required' => 'required', 'remote_action' => route('companies.autocomplete'), 'remote_type' => 'company']) }}
{{ Form::multiSelectRemoteGroup('companies', trans_choice('general.companies', 2), 'user', $companies, [], ['required' => 'required', 'remote_action' => route('companies.index')]) }}
@endcan
@can('read-auth-roles')

View File

@ -49,7 +49,7 @@
@endif
@can('read-common-companies')
{{ Form::multiSelectRemoteGroup('companies', trans_choice('general.companies', 2), 'user', $companies, $user->company_ids, ['required' => 'required', 'disabled' => (in_array('customer', $user->roles()->pluck('name')->toArray())) ? 'true' : 'false', 'remote_action' => route('companies.autocomplete'), 'remote_type' => 'company']) }}
{{ Form::multiSelectRemoteGroup('companies', trans_choice('general.companies', 2), 'user', $companies, $user->company_ids, ['required' => 'required', 'disabled' => (in_array('customer', $user->roles()->pluck('name')->toArray())) ? 'true' : 'false', 'remote_action' => route('companies.index')]) }}
@endcan
@can('read-auth-roles')

View File

@ -11,21 +11,12 @@
@section('content')
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([
'method' => 'GET',
'route' => 'users.index',
'role' => 'form',
'class' => 'mb-0'
]) !!}
<div class="align-items-center" v-if="!bulk_action.show">
<akaunting-search
:placeholder="'{{ trans('general.search_placeholder') }}'"
:options="{{ json_encode([]) }}"
></akaunting-search>
<x-search-string model="App\Models\Auth\User" />
</div>
{{ Form::bulkActionRowGroup('general.users', $bulk_actions, ['group' => 'auth', 'type' => 'users']) }}
{!! Form::close() !!}
</div>
<div class="table-responsive">

View File

@ -18,10 +18,7 @@
'class' => 'mb-0'
]) !!}
<div class="align-items-center" v-if="!bulk_action.show">
<akaunting-search
:placeholder="'{{ trans('general.search_placeholder') }}'"
:options="{{ json_encode([]) }}"
></akaunting-search>
<x-search-string model="App\Models\Banking\Account" />
</div>
{{ Form::bulkActionRowGroup('general.accounts', $bulk_actions, ['group' => 'banking', 'type' => 'accounts']) }}

View File

@ -9,7 +9,7 @@
@endsection
@section('content')
@if ($reconciliations->count())
@if ($reconciliations->count() || request()->get('search', false))
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([
@ -19,10 +19,7 @@
'class' => 'mb-0'
]) !!}
<div class="align-items-center" v-if="!bulk_action.show">
<akaunting-search
:placeholder="'{{ trans('general.search_placeholder') }}'"
:options="{{ json_encode([]) }}"
></akaunting-search>
<x-search-string model="App\Models\Banking\Reconciliation" />
</div>
{{ Form::bulkActionRowGroup('general.reconciliations', $bulk_actions, ['group' => 'banking', 'type' => 'reconciliations']) }}

View File

@ -22,10 +22,7 @@
'role' => 'form',
'class' => 'mb-0'
]) !!}
<akaunting-search
:placeholder="'{{ trans('general.search_placeholder') }}'"
:options="{{ json_encode([]) }}"
></akaunting-search>
<x-search-string model="App\Models\Banking\Transaction" />
{!! Form::close() !!}
</div>

View File

@ -11,7 +11,7 @@
@endsection
@section('content')
@if ($transfers->count())
@if ($transfers->count() || request()->get('search', false))
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([
@ -21,10 +21,7 @@
'class' => 'mb-0'
]) !!}
<div class="align-items-center" v-if="!bulk_action.show">
<akaunting-search
:placeholder="'{{ trans('general.search_placeholder') }}'"
:options="{{ json_encode([]) }}"
></akaunting-search>
<x-search-string model="App\Models\Banking\Transfer" />
</div>
{{ Form::bulkActionRowGroup('general.transfers', $bulk_actions, ['group' => 'banking', 'type' => 'transfers']) }}

View File

@ -18,10 +18,7 @@
'class' => 'mb-0'
]) !!}
<div class="align-items-center" v-if="!bulk_action.show">
<akaunting-search
:placeholder="'{{ trans('general.search_placeholder') }}'"
:options="{{ json_encode([]) }}"
></akaunting-search>
<x-search-string model="App\Models\Common\Company" />
</div>
{{ Form::bulkActionRowGroup('general.companies', $bulk_actions, ['group' => 'common', 'type' => 'companies']) }}

View File

@ -18,10 +18,7 @@
'class' => 'mb-0'
]) !!}
<div class="align-items-center" v-if="!bulk_action.show">
<akaunting-search
:placeholder="'{{ trans('general.search_placeholder') }}'"
:options="{{ json_encode([]) }}"
></akaunting-search>
<x-search-string model="App\Models\Common\Dashboard" />
</div>
{{ Form::bulkActionRowGroup('general.dashboards', $bulk_actions, ['group' => 'common', 'type' => 'dashboards']) }}

View File

@ -28,7 +28,7 @@
{{ Form::textGroup('purchase_price', trans('items.purchase_price'), 'money-bill-wave-alt') }}
{{ Form::selectAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, $item->category_id, ['path' => route('modals.categories.create') . '?type=item']) }}
{{ Form::selectRemoteAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, $item->category_id, ['path' => route('modals.categories.create') . '?type=item', 'remote_action' => route('categories.index'). '?type=item']) }}
{{ Form::fileGroup('picture', trans_choice('general.pictures', 1)) }}

View File

@ -11,7 +11,7 @@
@endsection
@section('content')
@if ($items->count())
@if ($items->count() || request()->get('search', false))
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([
@ -21,10 +21,7 @@
'class' => 'mb-0'
]) !!}
<div class="align-items-center" v-if="!bulk_action.show">
<akaunting-search
:placeholder="'{{ trans('general.search_placeholder') }}'"
:options="{{ json_encode([]) }}"
></akaunting-search>
<x-search-string model="App\Models\Common\Item" />
</div>
{{ Form::bulkActionRowGroup('general.items', $bulk_actions, ['group' => 'common', 'type' => 'items']) }}

View File

@ -0,0 +1,22 @@
<akaunting-search
placeholder="{{ (!empty($filters)) ? trans('general.placeholder.search_and_filter') : trans('general.search_placeholder')}}"
search-text="{{ trans('general.search_text') }}"
operator-is-text="{{ trans('general.is') }}"
operator-is-not-text="{{ trans('general.isnot') }}"
no-data-text="{{ trans('general.no_data') }}"
no-matching-data-text="{{ trans('general.no_matching_data') }}"
value="{{ request()->get('search', null) }}"
:filters="{{ json_encode($filters) }}"
:date-config="{
allowInput: true,
altInput: true,
altFormat: 'Y-m-d',
dateFormat: 'Y-m-d',
@if (!empty($attributes['min-date']))
minDate: {{ $attributes['min-date'] }}
@endif
@if (!empty($attributes['max-date']))
maxDate: {{ $attributes['max-date'] }}
@endif
}"
></akaunting-search>

View File

@ -18,7 +18,7 @@
{{ Form::textGroup('purchase_price', trans('items.purchase_price'), 'money-bill-wave-alt') }}
{{ Form::selectGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, null) }}
{{ Form::selectRemoteGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, null, ['remote_action' => route('categories.index'). '?type=item']) }}
{!! Form::hidden('enabled', '1', []) !!}
</div>

View File

@ -0,0 +1,97 @@
@stack($name . '_input_start')
<akaunting-select-remote
class="{{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
id="form-select-{{ $name }}"
@if (!empty($attributes['v-error']))
:form-classes="[{'has-error': {{ $attributes['v-error'] }} }]"
@else
:form-classes="[{'has-error': form.errors.get('{{ $name }}') }]"
@endif
icon="{{ $icon }}"
title="{{ $text }}"
placeholder="{{ trans('general.form.select.field', ['field' => $text]) }}"
name="{{ $name }}"
:options="{{ json_encode($values) }}"
@if (!empty($selected) || old($name))
:value="{{ json_encode(old($name, $selected)) }}"
@endif
@if (!empty($attributes['model']))
:model="{{ $attributes['model'] }}"
@endif
:multiple="true"
:add-new="{{ json_encode([
'status' => true,
'text' => trans('general.add_new'),
'path' => isset($attributes['path']) ? $attributes['path']: false,
'type' => isset($attributes['type']) ? $attributes['type'] : 'modal',
'field' => [
'key' => isset($attributes['field']['key']) ? $attributes['field']['key'] : 'id',
'value' => isset($attributes['field']['value']) ? $attributes['field']['value'] : 'name'
],
'new_text' => trans('modules.new'),
'buttons' => [
'cancel' => [
'text' => trans('general.cancel'),
'class' => 'btn-outline-secondary'
],
'confirm' => [
'text' => trans('general.save'),
'class' => 'btn-success'
]
]
])}}"
@if (!empty($attributes['collapse']))
:collapse="true"
@endif
@if (!empty($attributes['v-model']))
@interface="form.errors.clear('{{ $attributes['v-model'] }}'); {{ $attributes['v-model'] . ' = $event' }}"
@elseif (!empty($attributes['data-field']))
@interface="form.errors.clear('{{ 'form.' . $attributes['data-field'] . '.' . $name }}'); {{ 'form.' . $attributes['data-field'] . '.' . $name . ' = $event' }}"
@else
@interface="form.errors.clear('{{ $name }}'); form.{{ $name }} = $event"
@endif
@if (!empty($attributes['change']))
@change="{{ $attributes['change'] }}($event)"
@endif
@if (isset($attributes['readonly']))
:readonly="{{ $attributes['readonly'] }}"
@endif
@if (isset($attributes['disabled']))
:disabled="{{ $attributes['disabled'] }}"
@endif
@if (isset($attributes['show']))
v-if="{{ $attributes['show'] }}"
@endif
@if (isset($attributes['v-error-message']))
:form-error="{{ $attributes['v-error-message'] }}"
@else
:form-error="form.errors.get('{{ $name }}')"
@endif
remote-action="{{ $attributes['remote_action'] }}"
@if (!empty($attributes['currecny_code']))
currency-code="{{ $attributes['currecny_code'] }}"
@endif
loading-text="{{ trans('general.loading') }}"
no-data-text="{{ trans('general.no_data') }}"
no-matching-data-text="{{ trans('general.no_matching_data') }}"
></akaunting-select-remote>
@stack($name . '_input_end')

View File

@ -62,9 +62,8 @@
@endif
remote-action="{{ $attributes['remote_action'] }}"
remote-type="{{ $attributes['remote_type'] }}"
@if (!empty($attributes['currecny_code']))
@if (!empty($attributes['currecny_code']))
currency-code="{{ $attributes['currecny_code'] }}"
@endif

View File

@ -0,0 +1,91 @@
@stack($name . '_input_start')
<akaunting-select-remote
class="{{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
id="form-select-{{ $name }}"
@if (!empty($attributes['v-error']))
:form-classes="[{'has-error': {{ $attributes['v-error'] }} }]"
@else
:form-classes="[{'has-error': form.errors.get('{{ $name }}') }]"
@endif
icon="{{ $icon }}"
title="{{ $text }}"
placeholder="{{ trans('general.form.select.field', ['field' => $text]) }}"
name="{{ $name }}"
:options="{{ json_encode($values) }}"
@if (isset($selected) || old($name))
value="{{ old($name, $selected) }}"
@endif
@if (!empty($attributes['model']))
:model="{{ $attributes['model'] }}"
@endif
:add-new="{{ json_encode([
'status' => true,
'text' => trans('general.add_new'),
'path' => isset($attributes['path']) ? $attributes['path']: false,
'type' => isset($attributes['type']) ? $attributes['type'] : 'modal',
'field' => [
'key' => isset($attributes['field']['key']) ? $attributes['field']['key'] : 'id',
'value' => isset($attributes['field']['value']) ? $attributes['field']['value'] : 'name'
],
'new_text' => trans('modules.new'),
'buttons' => [
'cancel' => [
'text' => trans('general.cancel'),
'class' => 'btn-outline-secondary'
],
'confirm' => [
'text' => trans('general.save'),
'class' => 'btn-success'
]
]
])}}"
@if (!empty($attributes['v-model']))
@interface="form.errors.clear('{{ $attributes['v-model'] }}'); {{ $attributes['v-model'] . ' = $event' }}"
@elseif (!empty($attributes['data-field']))
@interface="form.errors.clear('{{ 'form.' . $attributes['data-field'] . '.' . $name }}'); {{ 'form.' . $attributes['data-field'] . '.' . $name . ' = $event' }}"
@else
@interface="form.errors.clear('{{ $name }}'); form.{{ $name }} = $event"
@endif
@if (!empty($attributes['change']))
@change="{{ $attributes['change'] }}($event)"
@endif
@if (isset($attributes['readonly']))
:readonly="{{ $attributes['readonly'] }}"
@endif
@if (isset($attributes['disabled']))
:disabled="{{ $attributes['disabled'] }}"
@endif
@if (isset($attributes['show']))
v-if="{{ $attributes['show'] }}"
@endif
@if (isset($attributes['v-error-message']))
:form-error="{{ $attributes['v-error-message'] }}"
@else
:form-error="form.errors.get('{{ $name }}')"
@endif
remote-action="{{ $attributes['remote_action'] }}"
@if (!empty($attributes['currecny_code']))
currency-code="{{ $attributes['currecny_code'] }}"
@endif
loading-text="{{ trans('general.loading') }}"
no-data-text="{{ trans('general.no_data') }}"
no-matching-data-text="{{ trans('general.no_matching_data') }}"
></akaunting-select-remote>
@stack($name . '_input_end')

View File

@ -3,6 +3,8 @@
<akaunting-select-remote
class="{{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
id="form-select-{{ $name }}"
@if (!empty($attributes['v-error']))
:form-classes="[{'has-error': {{ $attributes['v-error'] }} }]"
@else
@ -54,9 +56,8 @@
@endif
remote-action="{{ $attributes['remote_action'] }}"
remote-type="'{{ $attributes['remote_type'] }}"
@if (!empty($attributes['currecny_code']))
@if (!empty($attributes['currecny_code']))
currency-code="{{ $attributes['currecny_code'] }}"
@endif

View File

@ -17,7 +17,7 @@
<div class="card-body">
<div class="row">
{{ Form::selectAddNewGroup('contact_id', trans_choice('general.vendors', 1), 'user', $vendors, config('general.vendors'), ['required' => 'required', 'path' => route('modals.vendors.create'), 'change' => 'onChangeContact']) }}
{{ Form::selectRemoteAddNewGroup('contact_id', trans_choice('general.vendors', 1), 'user', $vendors, setting('default.contact'), ['required' => 'required', 'change' => 'onChangeContact', 'path' => route('modals.vendors.create'), 'remote_action' => route('vendors.index')]) }}
{{ Form::selectAddNewGroup('currency_code', trans_choice('general.currencies', 1), 'exchange-alt', $currencies, setting('default.currency'), ['required' => 'required', 'model' => 'form.currency_code', 'path' => route('modals.currencies.create'), 'field' => ['key' => 'code', 'value' => 'name'], 'change' => 'onChangeCurrency']) }}
@ -194,7 +194,7 @@
{{ Form::textareaGroup('notes', trans_choice('general.notes', 2)) }}
{{ Form::selectAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, setting('default.category'), ['required' => 'required', 'path' => route('modals.categories.create') . '?type=expense']) }}
{{ Form::selectRemoteAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, setting('default.expense_category'), ['required' => 'required', 'path' => route('modals.categories.create') . '?type=expense', 'remote_action' => route('categories.index'). '?type=expense']) }}
{{ Form::recurring('create') }}

View File

@ -18,7 +18,7 @@
<div class="card-body">
<div class="row">
{{ Form::selectAddNewGroup('contact_id', trans_choice('general.vendors', 1), 'user', $vendors, $bill->contact_id, ['required' => 'required', 'path' => route('modals.vendors.create'), 'change' => 'onChangeContact']) }}
{{ Form::selectRemoteAddNewGroup('contact_id', trans_choice('general.vendors', 1), 'user', $vendors, $bill->contact_id, ['required' => 'required', 'change' => 'onChangeContact', 'path' => route('modals.vendors.create'), 'remote_action' => route('vendors.index')]) }}
{{ Form::selectAddNewGroup('currency_code', trans_choice('general.currencies', 1), 'exchange-alt', $currencies, $bill->currency_code, ['required' => 'required', 'model' => 'form.currency_code', 'path' => route('modals.currencies.create'), 'field' => ['key' => 'code', 'value' => 'name'], 'change' => 'onChangeCurrency']) }}
@ -195,7 +195,7 @@
{{ Form::textareaGroup('notes', trans_choice('general.notes', 2)) }}
{{ Form::selectAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, $bill->category_id, ['required' => 'required', 'path' => route('modals.categories.create') . '?type=expense']) }}
{{ Form::selectRemoteAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, $bill->category_id, ['required' => 'required', 'path' => route('modals.categories.create') . '?type=expense', 'remote_action' => route('categories.index'). '?type=expense']) }}
{{ Form::recurring('edit', $bill) }}

View File

@ -11,7 +11,7 @@
@endsection
@section('content')
@if ($bills->count())
@if ($bills->count() || request()->get('search', false))
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([
@ -21,10 +21,7 @@
'class' => 'mb-0'
]) !!}
<div class="align-items-center" v-if="!bulk_action.show">
<akaunting-search
:placeholder="'{{ trans('general.search_placeholder') }}'"
:options="{{ json_encode([]) }}"
></akaunting-search>
<x-search-string model="App\Models\Purchase\Bill" />
</div>
{{ Form::bulkActionRowGroup('general.bills', $bulk_actions, ['group' => 'purchases', 'type' => 'bills']) }}
@ -67,7 +64,7 @@
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow">
<a class="dropdown-item" href="{{ route('bills.show', $item->id) }}">{{ trans('general.show') }}</a>
@if (!$item->reconciled)
@if (!$item->reconciled)""
<a class="dropdown-item" href="{{ route('bills.edit', $item->id) }}">{{ trans('general.edit') }}</a>
@endif
<div class="dropdown-divider"></div>

View File

@ -26,11 +26,11 @@
{{ Form::selectAddNewGroup('account_id', trans_choice('general.accounts', 1), 'university', $accounts, setting('default.account'), ['required' => 'required', 'path' => route('modals.accounts.create'), 'change' => 'onChangeAccount']) }}
{{ Form::selectAddNewGroup('contact_id', trans_choice('general.vendors', 1), 'user', $vendors, setting('default.vendor'), ['path' => route('modals.vendors.create')]) }}
{{ Form::selectRemoteAddNewGroup('contact_id', trans_choice('general.vendors', 1), 'user', $vendors, setting('default.vendor'), ['path' => route('modals.vendors.create'), 'remote_action' => route('vendors.index')]) }}
{{ Form::textareaGroup('description', trans('general.description')) }}
{{ Form::selectAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, setting('default.category'), ['required' => 'required', 'path' => route('modals.categories.create') . '?type=expense']) }}
{{ Form::selectRemoteAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, setting('default.expense_category'), ['required' => 'required', 'path' => route('modals.categories.create') . '?type=expense', 'remote_action' => route('categories.index'). '?type=expense']) }}
{{ Form::recurring('create') }}

View File

@ -45,11 +45,11 @@
{{ Form::selectAddNewGroup('account_id', trans_choice('general.accounts', 1), 'university', $accounts, $payment->account_id, ['required' => 'required', 'path' => route('modals.accounts.create'), 'change' => 'onChangeAccount']) }}
{{ Form::selectAddNewGroup('contact_id', trans_choice('general.vendors', 1), 'user', $vendors, $payment->contact_id, ['path' => route('modals.vendors.create')]) }}
{{ Form::selectRemoteAddNewGroup('contact_id', trans_choice('general.vendors', 1), 'user', $vendors, $payment->contact_id, ['path' => route('modals.vendors.create'), 'remote_action' => route('vendors.index')]) }}
{{ Form::textareaGroup('description', trans('general.description')) }}
{{ Form::selectAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, $payment->category_id, ['required' => 'required', 'path' => route('modals.categories.create') . '?type=expense']) }}
{{ Form::selectRemoteAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, $payment->category_id, ['required' => 'required', 'path' => route('modals.categories.create') . '?type=expense', 'remote_action' => route('categories.index'). '?type=expense']) }}
{{ Form::recurring('edit', $payment) }}

View File

@ -11,7 +11,7 @@
@endsection
@section('content')
@if ($payments->count())
@if ($payments->count() || request()->get('search', false))
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([
@ -21,10 +21,7 @@
'class' => 'mb-0'
]) !!}
<div class="align-items-center" v-if="!bulk_action.show">
<akaunting-search
:placeholder="'{{ trans('general.search_placeholder') }}'"
:options="{{ json_encode([]) }}"
></akaunting-search>
<x-search-string model="App\Models\Banking\Transaction" />
</div>
{{ Form::bulkActionRowGroup('general.payments', $bulk_actions, ['group' => 'purchases', 'type' => 'payments']) }}

View File

@ -11,7 +11,7 @@
@endsection
@section('content')
@if ($vendors->count())
@if ($vendors->count() || request()->get('search', false))
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([
@ -21,10 +21,7 @@
'class' => 'mb-0'
]) !!}
<div class="align-items-center" v-if="!bulk_action.show">
<akaunting-search
:placeholder="'{{ trans('general.search_placeholder') }}'"
:options="{{ json_encode([]) }}"
></akaunting-search>
<x-search-string model="App\Models\Common\Contact" />
</div>
{{ Form::bulkActionRowGroup('general.vendors', $bulk_actions, ['group' => 'purchases', 'type' => 'vendors']) }}

View File

@ -11,7 +11,7 @@
@endsection
@section('content')
@if ($customers->count())
@if ($customers->count() || request()->get('search', false))
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([
@ -21,10 +21,7 @@
'class' => 'mb-0'
]) !!}
<div class="align-items-center" v-if="!bulk_action.show">
<akaunting-search
:placeholder="'{{ trans('general.search_placeholder') }}'"
:options="{{ json_encode([]) }}"
></akaunting-search>
<x-search-string model="App\Models\Common\Contact" />
</div>
{{ Form::bulkActionRowGroup('general.customers', $bulk_actions, ['group' => 'sales', 'type' => 'customers']) }}

View File

@ -17,7 +17,7 @@
<div class="card-body">
<div class="row">
{{ Form::selectAddNewGroup('contact_id', trans_choice('general.customers', 1), 'user', $customers, config('general.customers'), ['required' => 'required', 'path' => route('modals.customers.create'), 'change' => 'onChangeContact']) }}
{{ Form::selectRemoteAddNewGroup('contact_id', trans_choice('general.customers', 1), 'user', $customers, setting('default.contact'), ['required' => 'required', 'change' => 'onChangeContact', 'path' => route('modals.customers.create'), 'remote_action' => route('customers.index')]) }}
{{ Form::selectAddNewGroup('currency_code', trans_choice('general.currencies', 1), 'exchange-alt', $currencies, setting('default.currency'), ['required' => 'required', 'model' => 'form.currency_code', 'path' => route('modals.currencies.create'), 'field' => ['key' => 'code', 'value' => 'name'], 'change' => 'onChangeCurrency']) }}
@ -196,7 +196,7 @@
{{ Form::textareaGroup('footer', trans('general.footer'), '', setting('invoice.footer'), ['rows' => '3'], 'col-md-6') }}
{{ Form::selectAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, setting('defaults.category'), ['required' => 'required', 'path' => route('modals.categories.create') . '?type=income']) }}
{{ Form::selectRemoteAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, setting('default.income_category'), ['required' => 'required', 'path' => route('modals.categories.create') . '?type=income', 'remote_action' => route('categories.index'). '?type=income']) }}
{{ Form::recurring('create') }}

View File

@ -18,7 +18,7 @@
<div class="card-body">
<div class="row">
{{ Form::selectAddNewGroup('contact_id', trans_choice('general.customers', 1), 'user', $customers, $invoice->contact_id, ['required' => 'required', 'path' => route('modals.customers.create'), 'change' => 'onChangeContact']) }}
{{ Form::selectRemoteAddNewGroup('contact_id', trans_choice('general.customers', 1), 'user', $customers, $invoice->contact_id, ['required' => 'required', 'change' => 'onChangeContact', 'path' => route('modals.customers.create'), 'remote_action' => route('customers.index')]) }}
{{ Form::selectAddNewGroup('currency_code', trans_choice('general.currencies', 1), 'exchange-alt', $currencies, $invoice->currency_code, ['required' => 'required', 'model' => 'form.currency_code', 'path' => route('modals.currencies.create'), 'field' => ['key' => 'code', 'value' => 'name'], 'change' => 'onChangeCurrency']) }}
@ -197,7 +197,7 @@
{{ Form::textareaGroup('footer', trans('general.footer'), '', null, ['rows' => '3'], 'col-md-6') }}
{{ Form::selectAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, $invoice->category_id, ['required' => 'required', 'path' => route('modals.categories.create') . '?type=income']) }}
{{ Form::selectRemoteAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, $invoice->category_id, ['required' => 'required', 'path' => route('modals.categories.create') . '?type=income', 'remote_action' => route('categories.index'). '?type=income']) }}
{{ Form::recurring('edit', $invoice) }}

View File

@ -11,7 +11,7 @@
@endsection
@section('content')
@if ($invoices->count())
@if ($invoices->count() || request()->get('search', false))
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([
@ -21,10 +21,7 @@
'class' => 'mb-0'
]) !!}
<div class="align-items-center" v-if="!bulk_action.show">
<akaunting-search
:placeholder="'{{ trans('general.search_placeholder') }}'"
:options="{{ json_encode([]) }}"
></akaunting-search>
<x-search-string model="App\Models\Sale\Invoice" />
</div>
{{ Form::bulkActionRowGroup('general.invoices', $bulk_actions, ['group' => 'sales', 'type' => 'invoices']) }}

View File

@ -26,11 +26,11 @@
{{ Form::selectAddNewGroup('account_id', trans_choice('general.accounts', 1), 'university', $accounts, setting('default.account'), ['required' => 'required', 'path' => route('modals.accounts.create'), 'change' => 'onChangeAccount']) }}
{{ Form::selectAddNewGroup('contact_id', trans_choice('general.customers', 1), 'user', $customers, setting('default.contact'), ['path' => route('modals.customers.create')]) }}
{{ Form::selectRemoteAddNewGroup('contact_id', trans_choice('general.customers', 1), 'user', $customers, setting('default.contact'), ['path' => route('modals.customers.create'), 'remote_action' => route('customers.index')]) }}
{{ Form::textareaGroup('description', trans('general.description')) }}
{{ Form::selectAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, setting('default.category'), ['required' => 'required', 'path' => route('modals.categories.create') . '?type=income']) }}
{{ Form::selectRemoteAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, setting('default.income_category'), ['required' => 'required', 'path' => route('modals.categories.create') . '?type=income', 'remote_action' => route('categories.index'). '?type=income']) }}
{{ Form::recurring('create') }}

View File

@ -45,11 +45,11 @@
{{ Form::selectAddNewGroup('account_id', trans_choice('general.accounts', 1), 'university', $accounts, $revenue->account_id, ['required' => 'required', 'path' => route('modals.accounts.create'), 'change' => 'onChangeAccount']) }}
{{ Form::selectAddNewGroup('contact_id', trans_choice('general.customers', 1), 'user', $customers, $revenue->contact_id, ['path' => route('modals.customers.create')]) }}
{{ Form::selectRemoteAddNewGroup('contact_id', trans_choice('general.customers', 1), 'user', $customers, $revenue->contact_id, ['path' => route('modals.customers.create'), 'remote_action' => route('customers.index')]) }}
{{ Form::textareaGroup('description', trans('general.description')) }}
{{ Form::selectAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, $revenue->category_id, ['required' => 'required', 'path' => route('modals.categories.create') . '?type=income']) }}
{{ Form::selectRemoteAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, $revenue->category_id, ['required' => 'required', 'path' => route('modals.categories.create') . '?type=income', 'remote_action' => route('categories.index'). '?type=income']) }}
{{ Form::recurring('edit', $revenue) }}

View File

@ -11,7 +11,7 @@
@endsection
@section('content')
@if ($revenues->count())
@if ($revenues->count() || request()->get('search', false))
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([
@ -21,10 +21,7 @@
'class' => 'mb-0'
]) !!}
<div class="align-items-center" v-if="!bulk_action.show">
<akaunting-search
:placeholder="'{{ trans('general.search_placeholder') }}'"
:options="{{ json_encode([]) }}"
></akaunting-search>
<x-search-string model="App\Models\Banking\Transaction" />
</div>
{{ Form::bulkActionRowGroup('general.revenues', $bulk_actions, ['group' => 'sales', 'type' => 'revenues']) }}

View File

@ -18,10 +18,7 @@
'class' => 'mb-0'
]) !!}
<div class="align-items-center" v-if="!bulk_action.show">
<akaunting-search
:placeholder="'{{ trans('general.search_placeholder') }}'"
:options="{{ json_encode([]) }}"
></akaunting-search>
<x-search-string model="App\Models\Setting\Category" />
</div>
{{ Form::bulkActionRowGroup('general.categories', $bulk_actions, ['group' => 'settings', 'type' => 'categories']) }}

View File

@ -18,10 +18,7 @@
'class' => 'mb-0'
]) !!}
<div class="align-items-center" v-if="!bulk_action.show">
<akaunting-search
:placeholder="'{{ trans('general.search_placeholder') }}'"
:options="{{ json_encode([]) }}"
></akaunting-search>
<x-search-string model="App\Models\Setting\Currency" />
</div>
{{ Form::bulkActionRowGroup('general.currencies', $bulk_actions, ['group' => 'settings', 'type' => 'currencies']) }}

View File

@ -22,6 +22,10 @@
{{ Form::selectGroup('currency', trans_choice('general.currencies', 1), 'exchange-alt', $currencies, setting('default.currency'), []) }}
{{ Form::selectRemoteGroup('income_category', trans('settings.default.income_category'), 'folder', $sales_categories, setting('default.income_category'), ['remote_action' => route('categories.index'). '?type=income']) }}
{{ Form::selectRemoteGroup('expense_category', trans('settings.default.expense_category'), 'folder', $purchases_categories, setting('default.expense_category'), ['remote_action' => route('categories.index'). '?type=expense']) }}
{{ Form::selectGroup('tax', trans_choice('general.taxes', 1), 'percent', $taxes, setting('default.tax'), []) }}
{{ Form::selectGroup('payment_method', trans_choice('general.payment_methods', 1), 'credit-card', $payment_methods, setting('default.payment_method'), []) }}

View File

@ -9,7 +9,7 @@
@endcan
@section('content')
@if ($taxes->count())
@if ($taxes->count() || request()->get('search', false))
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([
@ -19,10 +19,7 @@
'class' => 'mb-0'
]) !!}
<div class="align-items-center" v-if="!bulk_action.show">
<akaunting-search
:placeholder="'{{ trans('general.search_placeholder') }}'"
:options="{{ json_encode([]) }}"
></akaunting-search>
<x-search-string model="App\Models\Setting\Tax" />
</div>
{{ Form::bulkActionRowGroup('general.taxes', $bulk_actions, ['group' => 'settings', 'type' => 'taxes']) }}