Merge branch 'master' of github.com:akaunting/akaunting

This commit is contained in:
Cüneyt Şentürk 2022-07-20 10:24:00 +03:00
commit ef24b51142
23 changed files with 229 additions and 99 deletions

View File

@ -37,7 +37,7 @@ abstract class Controller extends BaseController
* *
* @return LengthAwarePaginator * @return LengthAwarePaginator
*/ */
public function paginate($items, $perPage = 15, $page = null, $options = []) public function paginate($items, $perPage = null, $page = null, $options = [])
{ {
$perPage = $perPage ?: (int) request('limit', setting('default.list_limit', '25')); $perPage = $perPage ?: (int) request('limit', setting('default.list_limit', '25'));

View File

@ -47,7 +47,7 @@ class Transactions extends Export implements WithColumnFormatting
public function columnFormats(): array public function columnFormats(): array
{ {
return [ return [
'B' => NumberFormat::FORMAT_DATE_YYYYMMDD, 'C' => NumberFormat::FORMAT_DATE_YYYYMMDD,
]; ];
} }
} }

View File

@ -53,7 +53,7 @@ class BillTransactions extends Export implements WithColumnFormatting
public function columnFormats(): array public function columnFormats(): array
{ {
return [ return [
'B' => NumberFormat::FORMAT_DATE_YYYYMMDD, 'C' => NumberFormat::FORMAT_DATE_YYYYMMDD,
]; ];
} }
} }

View File

@ -53,7 +53,7 @@ class InvoiceTransactions extends Export implements WithColumnFormatting
public function columnFormats(): array public function columnFormats(): array
{ {
return [ return [
'B' => NumberFormat::FORMAT_DATE_YYYYMMDD, 'C' => NumberFormat::FORMAT_DATE_YYYYMMDD,
]; ];
} }
} }

View File

@ -10,9 +10,9 @@ use App\Jobs\Banking\UpdateAccount;
use App\Models\Banking\Account; use App\Models\Banking\Account;
use App\Models\Banking\Transaction; use App\Models\Banking\Transaction;
use App\Models\Banking\Transfer; use App\Models\Banking\Transfer;
use App\Utilities\Reports as Utility; use App\Utilities\Date;
use App\Utilities\Reports;
use App\Models\Setting\Currency; use App\Models\Setting\Currency;
use Date;
class Accounts extends Controller class Accounts extends Controller
{ {
@ -35,23 +35,27 @@ class Accounts extends Controller
*/ */
public function show(Account $account) public function show(Account $account)
{ {
// Handle transactions $transactions = Transaction::with('category', 'contact', 'document')->where('account_id', $account->id)->collect(['paid_at'=> 'desc']);
$transactions = Transaction::with('account', 'category')->where('account_id', $account->id)->collect('paid_at');
$transfers = Transfer::with('expense_transaction', 'income_transaction')->get()->filter(function ($transfer) use($account) { $transfers = Transfer::with('expense_transaction', 'expense_transaction.account', 'income_transaction', 'income_transaction.account')
if ($transfer->expense_account->id == $account->id || $transfer->income_account->id == $account->id) { ->whereHas('expense_transaction', fn ($query) => $query->where('account_id', $account->id))
return true; ->orWhereHas('income_transaction', fn ($query) => $query->where('account_id', $account->id))
} ->collect(['expense_transaction.paid_at' => 'desc']);
return false; $incoming_amount = money($account->income_balance, $account->currency_code, true);
})->sortByDesc(function ($transfer) { $outgoing_amount = money($account->expense_balance, $account->currency_code, true);
return $transfer->expense_transaction->paid_at; $current_amount = money($account->balance, $account->currency_code, true);
});
$limit = (int) request('limit', setting('default.list_limit', '25')); $summary_amounts = [
$transfers = $this->paginate($transfers, $limit); 'incoming_exact' => $incoming_amount->format(),
'incoming_for_humans' => $incoming_amount->formatForHumans(),
'outgoing_exact' => $outgoing_amount->format(),
'outgoing_for_humans' => $outgoing_amount->formatForHumans(),
'current_exact' => $current_amount->format(),
'current_for_humans' => $current_amount->formatForHumans(),
];
return view('banking.accounts.show', compact('account', 'transactions', 'transfers')); return view('banking.accounts.show', compact('account', 'transactions', 'transfers', 'summary_amounts'));
} }
/** /**
@ -248,7 +252,7 @@ class Accounts extends Controller
'account_id' => $account->id, 'account_id' => $account->id,
]; ];
$report = Utility::getClassInstance('App\Reports\IncomeExpenseSummary'); $report = Reports::getClassInstance('App\Reports\IncomeExpenseSummary');
if (empty($report) || empty($report->model)) { if (empty($report) || empty($report->model)) {
$message = trans('accounts.create_report'); $message = trans('accounts.create_report');

View File

@ -155,7 +155,7 @@ class Tiles extends Controller
$modules = $this->getSearchModules($data); $modules = $this->getSearchModules($data);
$installed = Module::all()->pluck('enabled', 'alias')->toArray(); $installed = Module::all()->pluck('enabled', 'alias')->toArray();
return view('modules.tiles.index', compact('title', 'modules', 'keyword', 'installed')); return $this->response('modules.tiles.index', compact('modules', 'title', 'keyword', 'installed'));
} }
public function loadMore($type, Request $request) public function loadMore($type, Request $request)

View File

@ -20,6 +20,7 @@ class Transactions extends Import
$row['account_id'] = $this->getAccountId($row); $row['account_id'] = $this->getAccountId($row);
$row['category_id'] = $this->getCategoryId($row); $row['category_id'] = $this->getCategoryId($row);
$row['contact_id'] = $this->getContactId($row); $row['contact_id'] = $this->getContactId($row);
$row['currency_code'] = $this->getCurrencyCode($row);
$row['document_id'] = $this->getDocumentId($row); $row['document_id'] = $this->getDocumentId($row);
return $row; return $row;

View File

@ -27,6 +27,8 @@ class Transfers extends Import
$row['transferred_at'] = Date::parse($row['transferred_at'])->format('Y-m-d'); $row['transferred_at'] = Date::parse($row['transferred_at'])->format('Y-m-d');
$row['from_account_id'] = $this->getFromAccountId($row); $row['from_account_id'] = $this->getFromAccountId($row);
$row['to_account_id'] = $this->getToAccountId($row); $row['to_account_id'] = $this->getToAccountId($row);
$row['from_currency_code'] = $this->getFromCurrencyCode($row);
$row['to_currency_code'] = $this->getToCurrencyCode($row);
$row['expense_transaction_id'] = $this->getExpenseTransactionId($row); $row['expense_transaction_id'] = $this->getExpenseTransactionId($row);
$row['income_transaction_id'] = $this->getIncomeTransactionId($row); $row['income_transaction_id'] = $this->getIncomeTransactionId($row);
@ -124,4 +126,20 @@ class Transfers extends Import
return $this->getAccountId($row); return $this->getAccountId($row);
} }
private function getFromCurrencyCode($row)
{
$row['currency_code'] = $row['from_currency_code'] ?? null;
$row['currency_rate'] = $row['from_currency_rate'] ?? null;
return $this->getCurrencyCode($row);
}
private function getToCurrencyCode($row)
{
$row['currency_code'] = $row['to_currency_code'] ?? null;
$row['currency_rate'] = $row['to_currency_rate'] ?? null;
return $this->getCurrencyCode($row);
}
} }

View File

@ -25,6 +25,7 @@ class BillTransactions extends Import
$row['account_id'] = $this->getAccountId($row); $row['account_id'] = $this->getAccountId($row);
$row['category_id'] = $this->getCategoryId($row, 'expense'); $row['category_id'] = $this->getCategoryId($row, 'expense');
$row['contact_id'] = $this->getContactId($row, 'vendor'); $row['contact_id'] = $this->getContactId($row, 'vendor');
$row['currency_code'] = $this->getCurrencyCode($row);
$row['document_id'] = $this->getDocumentId($row); $row['document_id'] = $this->getDocumentId($row);
$row['number'] = $row['transaction_number']; $row['number'] = $row['transaction_number'];

View File

@ -28,6 +28,7 @@ class Bills extends Import
$row['issued_at'] = $row['billed_at']; $row['issued_at'] = $row['billed_at'];
$row['category_id'] = $this->getCategoryId($row, 'expense'); $row['category_id'] = $this->getCategoryId($row, 'expense');
$row['contact_id'] = $this->getContactId($row, 'vendor'); $row['contact_id'] = $this->getContactId($row, 'vendor');
$row['currency_code'] = $this->getCurrencyCode($row);
$row['type'] = Model::BILL_TYPE; $row['type'] = Model::BILL_TYPE;
$row['contact_country'] = !empty($country) ? $country : null; $row['contact_country'] = !empty($country) ? $country : null;

View File

@ -21,6 +21,7 @@ class Vendors extends Import
$row['type'] = 'vendor'; $row['type'] = 'vendor';
$row['country'] = !empty($country) ? $country : null; $row['country'] = !empty($country) ? $country : null;
$row['currency_code'] = $this->getCurrencyCode($row);
$row['user_id'] = null; $row['user_id'] = null;
return $row; return $row;

View File

@ -21,6 +21,7 @@ class Customers extends Import
$row['type'] = 'customer'; $row['type'] = 'customer';
$row['country'] = !empty($country) ? $country : null; $row['country'] = !empty($country) ? $country : null;
$row['currency_code'] = $this->getCurrencyCode($row);
$row['user_id'] = null; $row['user_id'] = null;
return $row; return $row;

View File

@ -25,6 +25,7 @@ class InvoiceTransactions extends Import
$row['account_id'] = $this->getAccountId($row); $row['account_id'] = $this->getAccountId($row);
$row['category_id'] = $this->getCategoryId($row, 'income'); $row['category_id'] = $this->getCategoryId($row, 'income');
$row['contact_id'] = $this->getContactId($row, 'customer'); $row['contact_id'] = $this->getContactId($row, 'customer');
$row['currency_code'] = $this->getCurrencyCode($row);
$row['document_id'] = $this->getDocumentId($row); $row['document_id'] = $this->getDocumentId($row);
$row['number'] = $row['transaction_number']; $row['number'] = $row['transaction_number'];

View File

@ -28,6 +28,7 @@ class Invoices extends Import
$row['issued_at'] = $row['invoiced_at']; $row['issued_at'] = $row['invoiced_at'];
$row['category_id'] = $this->getCategoryId($row, 'income'); $row['category_id'] = $this->getCategoryId($row, 'income');
$row['contact_id'] = $this->getContactId($row, 'customer'); $row['contact_id'] = $this->getContactId($row, 'customer');
$row['currency_code'] = $this->getCurrencyCode($row);
$row['type'] = Model::INVOICE_TYPE; $row['type'] = Model::INVOICE_TYPE;
$row['contact_country'] = !empty($country) ? $country : null; $row['contact_country'] = !empty($country) ? $country : null;

View File

@ -6,17 +6,20 @@ use App\Http\Requests\Banking\Account as AccountRequest;
use App\Http\Requests\Common\Contact as ContactRequest; use App\Http\Requests\Common\Contact as ContactRequest;
use App\Http\Requests\Common\Item as ItemRequest; use App\Http\Requests\Common\Item as ItemRequest;
use App\Http\Requests\Setting\Category as CategoryRequest; use App\Http\Requests\Setting\Category as CategoryRequest;
use App\Http\Requests\Setting\Currency as CurrencyRequest;
use App\Http\Requests\Setting\Tax as TaxRequest; use App\Http\Requests\Setting\Tax as TaxRequest;
use App\Jobs\Banking\CreateAccount; use App\Jobs\Banking\CreateAccount;
use App\Jobs\Common\CreateContact; use App\Jobs\Common\CreateContact;
use App\Jobs\Common\CreateItem; use App\Jobs\Common\CreateItem;
use App\Jobs\Setting\CreateCategory; use App\Jobs\Setting\CreateCategory;
use App\Jobs\Setting\CreateCurrency;
use App\Jobs\Setting\CreateTax; use App\Jobs\Setting\CreateTax;
use App\Models\Banking\Account; use App\Models\Banking\Account;
use App\Models\Common\Contact; use App\Models\Common\Contact;
use App\Models\Common\Item; use App\Models\Common\Item;
use App\Models\Document\Document; use App\Models\Document\Document;
use App\Models\Setting\Category; use App\Models\Setting\Category;
use App\Models\Setting\Currency;
use App\Models\Setting\Tax; use App\Models\Setting\Tax;
use App\Traits\Jobs; use App\Traits\Jobs;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
@ -74,6 +77,33 @@ trait Import
return is_null($id) ? $id : (int) $id; return is_null($id) ? $id : (int) $id;
} }
public function getCurrencyCode($row)
{
$currency = Currency::where('code', $row['currency_code'])->first();
if (!empty($currency)) {
return $currency->code;
}
$data = [
'company_id' => company_id(),
'code' => $row['currency_code'],
'name' => isset($row['currency_name']) ? $row['currency_name'] : config('money.' . $row['currency_code'] . '.name'),
'rate' => isset($row['currency_rate']) ? $row['currency_rate'] : 1,
'symbol' => isset($row['currency_symbol']) ? $row['currency_symbol'] : config('money.' . $row['currency_code'] . '.symbol'),
'precision' => isset($row['currency_precision']) ? $row['currency_precision'] : config('money.' . $row['currency_code'] . '.precision'),
'decimal_mark' => isset($row['currency_decimal_mark']) ? $row['currency_decimal_mark'] : config('money.' . $row['currency_code'] . '.decimal_mark'),
'created_from' => $row['created_from'],
'created_by' => $row['created_by'],
];
Validator::validate($data, [(new CurrencyRequest)->rules()]);
$currency = $this->dispatch(new CreateCurrency($data));
return $currency->code;
}
public function getDocumentId($row) public function getDocumentId($row)
{ {
$id = isset($row['document_id']) ? $row['document_id'] : null; $id = isset($row['document_id']) ? $row['document_id'] : null;

View File

@ -2,6 +2,7 @@
namespace App\Utilities; namespace App\Utilities;
use Akaunting\Money\Money;
use App\Models\Setting\Currency; use App\Models\Setting\Currency;
class Overrider class Overrider
@ -58,6 +59,9 @@ class Overrider
app()->setLocale($locale); app()->setLocale($locale);
} }
// Set locale for Money package
Money::setLocale(app()->getLocale());
// Set app url dynamically if empty // Set app url dynamically if empty
if (! config('app.url')) { if (! config('app.url')) {
config(['app.url' => url('/')]); config(['app.url' => url('/')]);

View File

@ -74,9 +74,8 @@ class Content extends Component
$this->totals = $totals; $this->totals = $totals;
$limit = (int) request('limit', setting('default.list_limit', '25')); $this->transactions = $this->paginate($this->transactions->sortByDesc('paid_at'));
$this->transactions = $this->paginate($this->transactions->sortByDesc('paid_at'), $limit); $this->documents = $this->paginate($this->documents->sortByDesc('issued_at'));
$this->documents = $this->paginate($this->documents->sortByDesc('issued_at'), $limit);
return view('components.contacts.show.content'); return view('components.contacts.show.content');
} }
@ -91,7 +90,7 @@ class Content extends Component
* *
* @return LengthAwarePaginator * @return LengthAwarePaginator
*/ */
public function paginate($items, $perPage = 15, $page = null, $options = []) public function paginate($items, $perPage = null, $page = null, $options = [])
{ {
$perPage = $perPage ?: (int) request('limit', setting('default.list_limit', '25')); $perPage = $perPage ?: (int) request('limit', setting('default.list_limit', '25'));

88
composer.lock generated
View File

@ -413,16 +413,16 @@
}, },
{ {
"name": "akaunting/laravel-money", "name": "akaunting/laravel-money",
"version": "3.0.1", "version": "3.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/akaunting/laravel-money.git", "url": "https://github.com/akaunting/laravel-money.git",
"reference": "22336631239eb008e26d322faa208cbc50757a38" "reference": "a4a3a204250a1185080c9cf0fe6f7f50d0e144cf"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/akaunting/laravel-money/zipball/22336631239eb008e26d322faa208cbc50757a38", "url": "https://api.github.com/repos/akaunting/laravel-money/zipball/a4a3a204250a1185080c9cf0fe6f7f50d0e144cf",
"reference": "22336631239eb008e26d322faa208cbc50757a38", "reference": "a4a3a204250a1185080c9cf0fe6f7f50d0e144cf",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -475,9 +475,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/akaunting/laravel-money/issues", "issues": "https://github.com/akaunting/laravel-money/issues",
"source": "https://github.com/akaunting/laravel-money/tree/3.0.1" "source": "https://github.com/akaunting/laravel-money/tree/3.1.0"
}, },
"time": "2022-05-11T06:34:38+00:00" "time": "2022-07-19T11:23:57+00:00"
}, },
{ {
"name": "akaunting/laravel-mutable-observer", "name": "akaunting/laravel-mutable-observer",
@ -907,16 +907,16 @@
}, },
{ {
"name": "aws/aws-sdk-php", "name": "aws/aws-sdk-php",
"version": "3.231.6", "version": "3.231.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/aws/aws-sdk-php.git", "url": "https://github.com/aws/aws-sdk-php.git",
"reference": "54c5fe6667c73010d954ce4c4d657d093f0bdcbf" "reference": "99b3e4585ac82a6e9ab6d1944d90231456fefbea"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/54c5fe6667c73010d954ce4c4d657d093f0bdcbf", "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/99b3e4585ac82a6e9ab6d1944d90231456fefbea",
"reference": "54c5fe6667c73010d954ce4c4d657d093f0bdcbf", "reference": "99b3e4585ac82a6e9ab6d1944d90231456fefbea",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -993,9 +993,9 @@
"support": { "support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues", "issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.231.6" "source": "https://github.com/aws/aws-sdk-php/tree/3.231.8"
}, },
"time": "2022-07-14T18:20:54+00:00" "time": "2022-07-18T18:20:47+00:00"
}, },
{ {
"name": "balping/json-raw-encoder", "name": "balping/json-raw-encoder",
@ -5038,16 +5038,16 @@
}, },
{ {
"name": "league/commonmark", "name": "league/commonmark",
"version": "2.3.3", "version": "2.3.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/commonmark.git", "url": "https://github.com/thephpleague/commonmark.git",
"reference": "0da1dca5781dd3cfddbe328224d9a7a62571addc" "reference": "155ec1c95626b16fda0889cf15904d24890a60d5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/0da1dca5781dd3cfddbe328224d9a7a62571addc", "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/155ec1c95626b16fda0889cf15904d24890a60d5",
"reference": "0da1dca5781dd3cfddbe328224d9a7a62571addc", "reference": "155ec1c95626b16fda0889cf15904d24890a60d5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -5140,7 +5140,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-06-07T21:28:26+00:00" "time": "2022-07-17T16:25:47+00:00"
}, },
{ {
"name": "league/config", "name": "league/config",
@ -5226,16 +5226,16 @@
}, },
{ {
"name": "league/flysystem", "name": "league/flysystem",
"version": "3.1.0", "version": "3.1.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/flysystem.git", "url": "https://github.com/thephpleague/flysystem.git",
"reference": "34a68067b7ae3b836ea5e57e1fc432478372a4f5" "reference": "1a941703dfb649f9b821e7bc425e782f576a805e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/34a68067b7ae3b836ea5e57e1fc432478372a4f5", "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/1a941703dfb649f9b821e7bc425e782f576a805e",
"reference": "34a68067b7ae3b836ea5e57e1fc432478372a4f5", "reference": "1a941703dfb649f9b821e7bc425e782f576a805e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -5296,7 +5296,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/thephpleague/flysystem/issues", "issues": "https://github.com/thephpleague/flysystem/issues",
"source": "https://github.com/thephpleague/flysystem/tree/3.1.0" "source": "https://github.com/thephpleague/flysystem/tree/3.1.1"
}, },
"funding": [ "funding": [
{ {
@ -5312,25 +5312,25 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-06-29T17:29:54+00:00" "time": "2022-07-18T09:59:40+00:00"
}, },
{ {
"name": "league/flysystem-aws-s3-v3", "name": "league/flysystem-aws-s3-v3",
"version": "3.0.22", "version": "3.1.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/flysystem-aws-s3-v3.git", "url": "https://github.com/thephpleague/flysystem-aws-s3-v3.git",
"reference": "e5fc508faf83df2fbd2a215d2b4bea9584906221" "reference": "fa46ce9fbad9bfc73d8b160ffeb2c1793fe9c73b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/e5fc508faf83df2fbd2a215d2b4bea9584906221", "url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/fa46ce9fbad9bfc73d8b160ffeb2c1793fe9c73b",
"reference": "e5fc508faf83df2fbd2a215d2b4bea9584906221", "reference": "fa46ce9fbad9bfc73d8b160ffeb2c1793fe9c73b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"aws/aws-sdk-php": "^3.132.4", "aws/aws-sdk-php": "^3.132.4",
"league/flysystem": "^2.0.0 || ^3.0.0", "league/flysystem": "^3.0.0",
"league/mime-type-detection": "^1.0.0", "league/mime-type-detection": "^1.0.0",
"php": "^8.0.2" "php": "^8.0.2"
}, },
@ -5366,9 +5366,23 @@
], ],
"support": { "support": {
"issues": "https://github.com/thephpleague/flysystem-aws-s3-v3/issues", "issues": "https://github.com/thephpleague/flysystem-aws-s3-v3/issues",
"source": "https://github.com/thephpleague/flysystem-aws-s3-v3/tree/3.0.22" "source": "https://github.com/thephpleague/flysystem-aws-s3-v3/tree/3.1.1"
}, },
"time": "2022-06-29T07:09:46+00:00" "funding": [
{
"url": "https://offset.earth/frankdejonge",
"type": "custom"
},
{
"url": "https://github.com/frankdejonge",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/league/flysystem",
"type": "tidelift"
}
],
"time": "2022-07-18T09:31:34+00:00"
}, },
{ {
"name": "league/mime-type-detection", "name": "league/mime-type-detection",
@ -7522,16 +7536,16 @@
}, },
{ {
"name": "phpoffice/phpspreadsheet", "name": "phpoffice/phpspreadsheet",
"version": "1.24.0", "version": "1.24.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHPOffice/PhpSpreadsheet.git", "url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
"reference": "ebe8745c92a7cac4514d040758393b5399633b83" "reference": "69991111e05fca3ff7398e1e7fca9ebed33efec6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/ebe8745c92a7cac4514d040758393b5399633b83", "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/69991111e05fca3ff7398e1e7fca9ebed33efec6",
"reference": "ebe8745c92a7cac4514d040758393b5399633b83", "reference": "69991111e05fca3ff7398e1e7fca9ebed33efec6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -7620,9 +7634,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues", "issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues",
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.24.0" "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.24.1"
}, },
"time": "2022-07-09T13:49:09+00:00" "time": "2022-07-18T19:50:48+00:00"
}, },
{ {
"name": "phpoption/phpoption", "name": "phpoption/phpoption",
@ -14115,5 +14129,5 @@
"ext-zip": "*" "ext-zip": "*"
}, },
"platform-dev": [], "platform-dev": [],
"plugin-api-version": "2.3.0" "plugin-api-version": "2.2.0"
} }

View File

@ -29,6 +29,10 @@ const app = new Vue({
AkauntingSlider AkauntingSlider
}, },
created() {
document.addEventListener('click', this.closeIfClickedOutside);
},
mounted() { mounted() {
if (typeof app_slug !== 'undefined') { if (typeof app_slug !== 'undefined') {
this.onReleases(1); this.onReleases(1);
@ -84,6 +88,12 @@ const app = new Vue({
addToCartLoading: false, addToCartLoading: false,
loadMoreLoading: false, loadMoreLoading: false,
live_search: {
data: [],
modal: false,
not_found: false
},
route_url: url
} }
}, },
@ -288,5 +298,34 @@ const app = new Vue({
this.loadMoreLoading = false; this.loadMoreLoading = false;
}); });
}, },
closeIfClickedOutside(event) {
let el = this.$refs.liveSearchModal;
let target = event.target;
if (el !== target && target.contains(el)) {
this.live_search.modal = false;
}
},
onLiveSearch(event) {
let target_length = event.target.value.length;
if (target_length > 2) {
window.axios.get(url + '/apps/search?keyword=' + event.target.value)
.then(response => {
this.live_search.data = response.data.data.data;
this.live_search.modal = true;
this.live_search.not_found = false;
})
.catch(error => {
this.live_search.not_found = true;
this.live_search.data = [];
console.log(error);
})
} else if (target_length == 0) {
this.live_search.modal = false;
}
}
} }
}); });

View File

@ -50,6 +50,7 @@ return [
'hosted_on_akaunting' => 'Hosted on akaunting.com', 'hosted_on_akaunting' => 'Hosted on akaunting.com',
'only_works_cloud' => 'This app is available only on <strong>Cloud</strong>.', 'only_works_cloud' => 'This app is available only on <strong>Cloud</strong>.',
'only_premium_plan' => 'This app is available only on <strong>Premium Cloud</strong>.', 'only_premium_plan' => 'This app is available only on <strong>Premium Cloud</strong>.',
'not_found' => 'No app found',
'about' => 'About', 'about' => 'About',

View File

@ -116,15 +116,15 @@
<x-show.summary.right> <x-show.summary.right>
@stack('summary_incoming_start') @stack('summary_incoming_start')
<x-slot name="first" amount="{{ money($account->income_balance, $account->currency_code, true) }}" title="{{ trans('accounts.incoming') }}"></x-slot> <x-slot name="first" amount="{{ $summary_amounts['incoming_for_humans'] }}" title="{{ trans('accounts.incoming') }}" tooltip="{{ $summary_amounts['incoming_exact'] }}"></x-slot>
@stack('summary_incoming_end') @stack('summary_incoming_end')
@stack('summary_outgoing_start') @stack('summary_outgoing_start')
<x-slot name="second" amount="{{ money($account->expense_balance, $account->currency_code, true) }}" title="{{ trans('accounts.outgoing') }}"></x-slot> <x-slot name="second" amount="{{ $summary_amounts['outgoing_for_humans'] }}" title="{{ trans('accounts.outgoing') }}" tooltip="{{ $summary_amounts['outgoing_exact'] }}"></x-slot>
@stack('summary_outgoing_end') @stack('summary_outgoing_end')
@stack('summary_current_start') @stack('summary_current_start')
<x-slot name="third" amount="{{ money($account->balance, $account->currency_code, true) }}" title="{{ trans('accounts.current_balance') }}"></x-slot> <x-slot name="third" amount="{{ $summary_amounts['current_for_humans'] }}" title="{{ trans('accounts.current_balance') }}" tooltip="{{ $summary_amounts['current_exact'] }}"></x-slot>
@stack('summary_current_end') @stack('summary_current_end')
</x-show.summary.right> </x-show.summary.right>
</x-show.summary> </x-show.summary>
@ -225,7 +225,7 @@
<x-table> <x-table>
<x-table.thead> <x-table.thead>
<x-table.tr class="flex items-center px-1"> <x-table.tr class="flex items-center px-1">
<x-table.th class="w-4/12 sm:w-3/12"> <x-table.th class="w-3/12">
<x-slot name="first"> <x-slot name="first">
<x-sortablelink column="paid_at" title="{{ trans('general.date') }}" /> <x-sortablelink column="paid_at" title="{{ trans('general.date') }}" />
</x-slot> </x-slot>
@ -243,11 +243,7 @@
</x-slot> </x-slot>
</x-table.th> </x-table.th>
<x-table.th class="w-4/12 sm:w-2/12"> <x-table.th class="w-3/12 hidden sm:table-cell">
<x-sortablelink column="account.name" title="{{ trans_choice('general.accounts', 1) }}" />
</x-table.th>
<x-table.th class="w-2/12 hidden sm:table-cell">
<x-slot name="first"> <x-slot name="first">
<x-sortablelink column="contact.name" title="{{ trans_choice('general.contacts', 1) }}" /> <x-sortablelink column="contact.name" title="{{ trans_choice('general.contacts', 1) }}" />
</x-slot> </x-slot>
@ -256,7 +252,7 @@
</x-slot> </x-slot>
</x-table.th> </x-table.th>
<x-table.th class="w-4/12 sm:w-2/12" kind="amount"> <x-table.th class="w-3/12" kind="amount">
<x-sortablelink column="amount" title="{{ trans('general.amount') }}" /> <x-sortablelink column="amount" title="{{ trans('general.amount') }}" />
</x-table.th> </x-table.th>
</x-table.tr> </x-table.tr>
@ -265,7 +261,7 @@
<x-table.tbody> <x-table.tbody>
@foreach($transactions as $item) @foreach($transactions as $item)
<x-table.tr href="{{ route('transactions.show', $item->id) }}"> <x-table.tr href="{{ route('transactions.show', $item->id) }}">
<x-table.td class="w-4/12 sm:w-3/12"> <x-table.td class="w-3/12">
<x-slot name="first" class="font-bold truncate" override="class"> <x-slot name="first" class="font-bold truncate" override="class">
<x-date date="{{ $item->paid_at }}" /> <x-date date="{{ $item->paid_at }}" />
</x-slot> </x-slot>
@ -283,11 +279,7 @@
</x-slot> </x-slot>
</x-table.td> </x-table.td>
<x-table.td class="w-4/12 sm:w-2/12"> <x-table.td class="w-3/12 hidden sm:table-cell">
{{ $item->account->name }}
</x-table.td>
<x-table.td class="w-2/12 hidden sm:table-cell">
<x-slot name="first"> <x-slot name="first">
{{ $item->contact->name }} {{ $item->contact->name }}
</x-slot> </x-slot>
@ -308,7 +300,7 @@
</x-slot> </x-slot>
</x-table.td> </x-table.td>
<x-table.td class="relative w-4/12 sm:w-2/12" kind="amount"> <x-table.td class="w-3/12 relative" kind="amount">
<x-money :amount="$item->amount" :currency="$item->currency_code" convert /> <x-money :amount="$item->amount" :currency="$item->currency_code" convert />
</x-table.td> </x-table.td>
@ -333,10 +325,6 @@
<x-table> <x-table>
<x-table.thead> <x-table.thead>
<x-table.tr class="flex items-center px-1"> <x-table.tr class="flex items-center px-1">
<x-table.th class="ltr:pr-6 rtl:pl-6 hidden sm:table-cell" override="class">
<x-index.bulkaction.all />
</x-table.th>
<x-table.th class="w-3/12 hidden sm:table-cell"> <x-table.th class="w-3/12 hidden sm:table-cell">
<x-slot name="first"> <x-slot name="first">
<x-sortablelink column="expense_transaction.paid_at" title="{{ trans('general.created_date') }}" /> <x-sortablelink column="expense_transaction.paid_at" title="{{ trans('general.created_date') }}" />
@ -346,7 +334,7 @@
</x-slot> </x-slot>
</x-table.th> </x-table.th>
<x-table.th class="w-4/12 sm:w-3/12"> <x-table.th class="w-3/12">
<x-slot name="first"> <x-slot name="first">
<x-sortablelink column="expense_transaction.name" title="{{ trans('transfers.from_account') }}" /> <x-sortablelink column="expense_transaction.name" title="{{ trans('transfers.from_account') }}" />
</x-slot> </x-slot>
@ -355,7 +343,7 @@
</x-slot> </x-slot>
</x-table.th> </x-table.th>
<x-table.th class="w-4/12 sm:w-3/12"> <x-table.th class="w-3/12">
<x-slot name="first"> <x-slot name="first">
<x-sortablelink column="expense_transaction.rate" title="{{ trans('transfers.from_rate') }}" /> <x-sortablelink column="expense_transaction.rate" title="{{ trans('transfers.from_rate') }}" />
</x-slot> </x-slot>
@ -364,7 +352,7 @@
</x-slot> </x-slot>
</x-table.th> </x-table.th>
<x-table.th class="w-4/12 sm:w-3/12" kind="amount"> <x-table.th class="w-3/12" kind="amount">
<x-slot name="first"> <x-slot name="first">
<x-sortablelink column="expense_transaction.amount" title="{{ trans('transfers.from_amount') }}" /> <x-sortablelink column="expense_transaction.amount" title="{{ trans('transfers.from_amount') }}" />
</x-slot> </x-slot>
@ -386,10 +374,6 @@
@endphp @endphp
<x-table.tr href="{{ route('transfers.show', $item->id) }}"> <x-table.tr href="{{ route('transfers.show', $item->id) }}">
<x-table.td class="ltr:pr-6 rtl:pl-6 hidden sm:table-cell" override="class">
<x-index.bulkaction.single id="{{ $item->id }}" name="{{ $item->expense_transaction->account->name }}" />
</x-table.td>
<x-table.td class="w-3/12 truncate hidden sm:table-cell"> <x-table.td class="w-3/12 truncate hidden sm:table-cell">
<x-slot name="first" class="flex items-center font-bold" override="class"> <x-slot name="first" class="flex items-center font-bold" override="class">
<x-date date="{{ $item->expense_transaction->paid_at }}" /> <x-date date="{{ $item->expense_transaction->paid_at }}" />
@ -403,7 +387,7 @@
</x-slot> </x-slot>
</x-table.td> </x-table.td>
<x-table.td class="w-4/12 sm:w-3/12 truncate"> <x-table.td class="w-3/12 truncate">
<x-slot name="first"> <x-slot name="first">
{{ $item->expense_transaction->account->name }} {{ $item->expense_transaction->account->name }}
</x-slot> </x-slot>
@ -412,7 +396,7 @@
</x-slot> </x-slot>
</x-table.td> </x-table.td>
<x-table.td class="w-4/12 sm:w-3/12 truncate"> <x-table.td class="w-3/12 truncate">
<x-slot name="first"> <x-slot name="first">
{{ $item->expense_transaction->currency_rate }} {{ $item->expense_transaction->currency_rate }}
</x-slot> </x-slot>
@ -421,7 +405,7 @@
</x-slot> </x-slot>
</x-table.td> </x-table.td>
<x-table.td class="w-4/12 sm:w-3/12" kind="amount"> <x-table.td class="w-3/12" kind="amount">
<x-slot name="first"> <x-slot name="first">
<x-money :amount="$item->expense_transaction->amount" :currency="$item->expense_transaction->currency_code" convert /> <x-money :amount="$item->expense_transaction->amount" :currency="$item->expense_transaction->currency_code" convert />
</x-slot> </x-slot>

View File

@ -61,7 +61,7 @@
</div> </div>
<div class="flex flex-col lg:flex-row w-full justify-between"> <div class="flex flex-col lg:flex-row w-full justify-between">
<div class="h-full relative"> <div class="w-8/12 h-full">
<form method="GET" action="{{ url("/" . company_id()) }}/apps/search"> <form method="GET" action="{{ url("/" . company_id()) }}/apps/search">
<div class="h-full flex items-center pl-2 gap-2"> <div class="h-full flex items-center pl-2 gap-2">
<i class="material-icons text-light-gray">search</i> <i class="material-icons text-light-gray">search</i>
@ -73,12 +73,42 @@
value="{{ isset($keyword) ? $keyword : '' }}" value="{{ isset($keyword) ? $keyword : '' }}"
placeholder="{{ trans('general.search_placeholder') }}" placeholder="{{ trans('general.search_placeholder') }}"
autocomplete="off" autocomplete="off"
v-on:keyup="onLiveSearch($event)"
/> />
</div> </div>
<div
ref="liveSearchModal"
v-if="live_search.modal"
class="absolute w-full left-0 right-0 bg-white rounded-xl shadow-md pl-4 pr-4 pt-4 top-20 z-10"
:class="live_search.data.length > 8 ? 'pb-0' : 'pb-4'"
>
<ul class="grid sm:grid-cols-6 gap-8">
<li v-for="(item, index) in live_search.data.slice(0,8)" :key="index" class="sm:col-span-3 p-3 rounded-lg hover:bg-gray-100">
<a :href="route_url + '/apps/' + item.slug" class="flex items-center space-x-4">
<img v-for="(file, indis) in item.files"
:src="file.path_string"
:alt="item.name"
class="w-16 h-12 rounded-lg object-cover"
/>
<div>
<h6 class="font-bold" v-html="item.name"></h6>
<span class="text-sm text-gray-500 line-clamp-1" v-html="item.sort_desc ? item.sort_desc : item.description"></span>
</div>
</a>
</li>
<li v-if="live_search.not_found">{{ trans('modules.not_found') }}</li>
</ul>
<div v-if="live_search.data.length > 8" class="flex item-center justify-center mt-5 -mx-4">
<x-button type="submit" class="w-full h-10 flex items-center justify-center text-purple font-medium border-y rounded-bl-xl rounded-br-xl disabled:bg-gray-200 hover:bg-gray-100" override="class">{{ trans('modules.see_more') }}</x-button>
</div>
</div>
</form> </form>
</div> </div>
<div class="flex flex-row items-end lg:items-center mb-1 divide-x divide-black-400"> <div class="flex flex-row items-end lg:items-center mb-1 divide-x divide-black-400 mt-4 lg:mt-0">
<x-link href="{{ route('apps.home.index') }}" class="text-sm font-semibold px-2 sm:mt-0 sm:mb-0 leading-4" override="class"> <x-link href="{{ route('apps.home.index') }}" class="text-sm font-semibold px-2 sm:mt-0 sm:mb-0 leading-4" override="class">
<x-link.hover color="to-black-400"> <x-link.hover color="to-black-400">
{{ trans('modules.home') }} {{ trans('modules.home') }}

View File

@ -117,12 +117,12 @@
<x-table.td class="w-3/12 sm:table-cell"> <x-table.td class="w-3/12 sm:table-cell">
@stack('document_number_td_inside_start') @stack('document_number_td_inside_start')
<x-slot name="first" class="w-20 font-normal group" data-tooltip-target="tooltip-information-{{ $item->id }}" data-tooltip-placement="left" override="class,data-tooltip-target,data-tooltip-placement"> <x-slot name="first" class="w-20 font-normal group" data-tooltip-target="tooltip-information-{{ $item->id }}" data-tooltip-placement="left" override="class">
<span class="border-black border-b border-dashed"> <span class="border-black border-b border-dashed">
{{ $item->document_number }} {{ $item->document_number }}
</span> </span>
<div class="w-full absolute h-10 -left-10 -mt-6"></div> <div class="w-28 absolute h-10 -ml-12 -mt-6"></div>
<x-documents.index.information :document="$item" show-route="portal.invoices.show"/> <x-documents.index.information :document="$item" show-route="portal.invoices.show"/>
</x-slot> </x-slot>