First attempt at "create transaction"-form for v2 users.

This commit is contained in:
James Cole 2023-10-08 16:11:04 +02:00
parent 2ea9369f99
commit 1fe36044f1
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
56 changed files with 901 additions and 130 deletions

View File

@ -32,7 +32,7 @@ use FireflyIII\Models\AccountType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface as AdminAccountRepositoryInterface;
use FireflyIII\Support\Http\Api\AccountFilter;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use http\Env\Response;
use Illuminate\Http\JsonResponse;
/**
@ -41,7 +41,6 @@ use Illuminate\Http\JsonResponse;
class AccountController extends Controller
{
use AccountFilter;
use ValidatesUserGroupTrait;
private AdminAccountRepositoryInterface $adminRepository;
private array $balanceTypes;
@ -86,15 +85,14 @@ class AccountController extends Controller
*/
public function accounts(AutocompleteRequest $request): JsonResponse
{
$data = $request->getData();
$types = $data['types'];
$query = $data['query'];
$date = $this->parameters->get('date') ?? today(config('app.timezone'));
$return = [];
$data = $request->getData();
$types = $data['types'];
$query = $data['query'];
$date = $this->parameters->get('date') ?? today(config('app.timezone'));
$result = $this->adminRepository->searchAccount((string)$query, $types, $data['limit']);
$defaultCurrency = app('amount')->getDefaultCurrency();
$allItems = [];
/** @var Account $account */
foreach ($result as $account) {
$nameWithBalance = $account->name;
@ -104,11 +102,17 @@ class AccountController extends Controller
$balance = app('steam')->balance($account, $date);
$nameWithBalance = sprintf('%s (%s)', $account->name, app('amount')->formatAnything($currency, $balance, false));
}
$return[] = [
$type = (string)trans(sprintf('firefly.%s', $account->accountType->type));
$groupedResult[$type] = $groupedResult[$type] ?? [
'group ' => $type,
'items' => [],
];
$allItems[] = [
'id' => (string)$account->id,
'value' => (string)$account->id,
'name' => $account->name,
'name_with_balance' => $nameWithBalance,
'label' => $nameWithBalance,
'type' => $account->accountType->type,
'currency_id' => (string)$currency->id,
'currency_name' => $currency->name,
@ -118,10 +122,9 @@ class AccountController extends Controller
];
}
// custom order.
usort(
$return,
function ($a, $b) {
$allItems,
function (array $a, array $b): int {
$order = [AccountType::ASSET, AccountType::REVENUE, AccountType::EXPENSE];
$pos_a = array_search($a['type'], $order, true);
$pos_b = array_search($b['type'], $order, true);
@ -129,7 +132,6 @@ class AccountController extends Controller
return $pos_a - $pos_b;
}
);
return response()->json($return);
return response()->json($allItems);
}
}

View File

@ -0,0 +1,94 @@
<?php
/*
* TransactionController.php
* Copyright (c) 2023 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Api\V2\Controllers\Autocomplete;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\Autocomplete\AutocompleteRequest;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\UserGroups\Journal\JournalRepositoryInterface;
use Illuminate\Http\JsonResponse;
/**
* Class TransactionController
*/
class TransactionController extends Controller
{
private JournalRepositoryInterface $repository;
/**
* AccountController constructor.
*/
public function __construct()
{
parent::__construct();
$this->middleware(
function ($request, $next) {
$this->repository = app(JournalRepositoryInterface::class);
$userGroup = $this->validateUserGroup($request);
if (null !== $userGroup) {
$this->repository->setUserGroup($userGroup);
}
return $next($request);
}
);
}
/**
* Documentation for this endpoint:
* TODO list of checks
* 1. use dates from ParameterBag
* 2. Request validates dates
* 3. Request includes user_group_id
* 4. Endpoint is documented.
* 5. Collector uses user_group_id
*
*
* @return JsonResponse
*/
public function transactionDescriptions(AutocompleteRequest $request): JsonResponse
{
$data = $request->getData();
$result = $this->repository->searchJournalDescriptions($data['query'], $data['limit']);
// limit and unique
$filtered = $result->unique('description');
$array = [];
/** @var TransactionJournal $journal */
foreach ($filtered as $journal) {
$array[] = [
'id' => (string)$journal->id,
'transaction_group_id' => (string)$journal->transaction_group_id,
'name' => $journal->description,
'description' => $journal->description,
];
}
return response()->json($array);
}
}

View File

@ -27,6 +27,7 @@ namespace FireflyIII\Api\V2\Controllers;
use Carbon\Carbon;
use Carbon\Exceptions\InvalidDateException;
use Carbon\Exceptions\InvalidFormatException;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use FireflyIII\Transformers\V2\AbstractTransformer;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Pagination\LengthAwarePaginator;
@ -48,6 +49,8 @@ use Symfony\Component\HttpFoundation\ParameterBag;
*/
class Controller extends BaseController
{
use ValidatesUserGroupTrait;
protected const CONTENT_TYPE = 'application/vnd.api+json';
protected ParameterBag $parameters;

View File

@ -28,6 +28,7 @@ use FireflyIII\Models\AccountType;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
use FireflyIII\User;
use FireflyIII\Validation\Administration\ValidatesAdministrationAccess;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
@ -38,6 +39,7 @@ class AutocompleteRequest extends FormRequest
{
use ConvertsDataTypes;
use ChecksLogin;
protected array $acceptedRoles = [UserRoleEnum::MANAGE_TRANSACTIONS];
/**
@ -75,21 +77,4 @@ class AutocompleteRequest extends FormRequest
'limit' => 'min:0|max:1337',
];
}
/**
* Configure the validator instance with special rules for after the basic validation rules.
*
* @param Validator $validator
*
* @return void
*/
public function withValidator(Validator $validator): void
{
$validator->after(
function (Validator $validator) {
// validate if the account can access this administration
$this->validateAdministration($validator, [UserRoleEnum::MANAGE_TRANSACTIONS]);
}
);
}
}

View File

@ -31,6 +31,8 @@ use FireflyIII\Repositories\Journal\JournalCLIRepository;
use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepository;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Journal\JournalRepository as GroupJournalRepository;
use FireflyIII\Repositories\UserGroups\Journal\JournalRepositoryInterface as GroupJournalRepositoryInterface;
use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepository;
use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface;
use Illuminate\Foundation\Application;
@ -44,9 +46,7 @@ class JournalServiceProvider extends ServiceProvider
/**
* Bootstrap the application services.
*/
public function boot(): void
{
}
public function boot(): void {}
/**
* Register the application services.
@ -76,6 +76,19 @@ class JournalServiceProvider extends ServiceProvider
}
);
$this->app->bind(
GroupJournalRepositoryInterface::class,
static function (Application $app) {
/** @var GroupJournalRepositoryInterface $repository */
$repository = app(GroupJournalRepository::class);
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
$repository->setUser(auth()->user());
}
return $repository;
}
);
// also bind new API repository
$this->app->bind(
JournalAPIRepositoryInterface::class,

View File

@ -245,7 +245,7 @@ class JournalRepository implements JournalRepositoryInterface
{
$query = $this->user->transactionJournals()
->orderBy('date', 'DESC');
if ('' !== $query) {
if ('' !== $search) {
$query->where('description', 'LIKE', sprintf('%%%s%%', $search));
}

View File

@ -0,0 +1,49 @@
<?php
/*
* JournalRepository.php
* Copyright (c) 2023 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Repositories\UserGroups\Journal;
use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait;
use Illuminate\Support\Collection;
/**
* Class JournalRepository
*/
class JournalRepository implements JournalRepositoryInterface
{
use UserGroupTrait;
/**
* @inheritDoc
*/
public function searchJournalDescriptions(string $search, int $limit): Collection
{
$query = $this->userGroup->transactionJournals()
->orderBy('date', 'DESC');
if ('' !== $search) {
$query->where('description', 'LIKE', sprintf('%%%s%%', $search));
}
return $query->take($limit)->get();
}
}

View File

@ -0,0 +1,42 @@
<?php
/*
* JournalRepositoryInterface.php
* Copyright (c) 2023 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Repositories\UserGroups\Journal;
use Illuminate\Support\Collection;
/**
* Interface JournalRepositoryInterface
*/
interface JournalRepositoryInterface
{
/**
* Search in journal descriptions.
*
* @param string $search
* @param int $limit
*
* @return Collection
*/
public function searchJournalDescriptions(string $search, int $limit): Collection;
}

View File

@ -29,6 +29,9 @@ use FireflyIII\Models\UserGroup;
use FireflyIII\User;
use Illuminate\Http\Request;
/**
* Trait ValidatesUserGroupTrait
*/
trait ValidatesUserGroupTrait
{
/**

File diff suppressed because one or more lines are too long

View File

@ -30,10 +30,10 @@
"integrity": "sha384-B73JAwYNSgI4rwb14zwxigHgAkg1Ms+j6+9sJoDpiL11+VW5RjQCLfIh0RVoi0h6"
},
"resources/assets/v2/pages/dashboard/dashboard.js": {
"file": "assets/dashboard-2100f404.js",
"file": "assets/dashboard-808f5a4b.js",
"isEntry": true,
"src": "resources/assets/v2/pages/dashboard/dashboard.js",
"integrity": "sha384-V9FlCSPQuNaRj8izLok2N3wJYIFCKB/T3n+8gr7HB1r90GH086BF99Wrwel2tHnQ"
"integrity": "sha384-U4rVOcapDLBADgB4Ncgli3+XocCBhndwzaHVmlnYUANCL7GRsVwJsF1/Y50wRHxj"
},
"resources/assets/v2/sass/app.scss": {
"file": "assets/app-28a195fd.css",

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "No budget",
"expense_account": "Expense account",
"revenue_account": "Revenue account",
"budget": "\u0411\u044e\u0434\u0436\u0435\u0442"
"budget": "\u0411\u044e\u0434\u0436\u0435\u0442",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "\u0414\u044a\u043b\u0433",
"account_type_Loan": "\u0417\u0430\u0435\u043c",
"account_type_Mortgage": "\u0418\u043f\u043e\u0442\u0435\u043a\u0430"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "Cap pressupost",
"expense_account": "Compte de despeses",
"revenue_account": "Compte d'ingressos",
"budget": "Pressupost"
"budget": "Pressupost",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "Deute",
"account_type_Loan": "Cr\u00e8dit",
"account_type_Mortgage": "Hipoteca"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "No budget",
"expense_account": "Expense account",
"revenue_account": "Revenue account",
"budget": "Rozpo\u010det"
"budget": "Rozpo\u010det",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "Dluh",
"account_type_Loan": "P\u016fj\u010dka",
"account_type_Mortgage": "Hypot\u00e9ka"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "No budget",
"expense_account": "Expense account",
"revenue_account": "Revenue account",
"budget": "Budget"
"budget": "Budget",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "G\u00e6ld",
"account_type_Loan": "L\u00e5n",
"account_type_Mortgage": "Pant"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "Kein Budget",
"expense_account": "Ausgabenkonto",
"revenue_account": "Einnahmekonto",
"budget": "Budget"
"budget": "Budget",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "Schuld",
"account_type_Loan": "Darlehen",
"account_type_Mortgage": "Hypothek"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "No budget",
"expense_account": "Expense account",
"revenue_account": "Revenue account",
"budget": "\u03a0\u03c1\u03bf\u03cb\u03c0\u03bf\u03bb\u03bf\u03b3\u03b9\u03c3\u03bc\u03cc\u03c2"
"budget": "\u03a0\u03c1\u03bf\u03cb\u03c0\u03bf\u03bb\u03bf\u03b3\u03b9\u03c3\u03bc\u03cc\u03c2",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "\u03a7\u03c1\u03ad\u03bf\u03c2",
"account_type_Loan": "\u0394\u03ac\u03bd\u03b5\u03b9\u03bf",
"account_type_Mortgage": "\u03a5\u03c0\u03bf\u03b8\u03ae\u03ba\u03b7"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "No budget",
"expense_account": "Expense account",
"revenue_account": "Revenue account",
"budget": "Budget"
"budget": "Budget",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "Debt",
"account_type_Loan": "Loan",
"account_type_Mortgage": "Mortgage"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "No budget",
"expense_account": "Expense account",
"revenue_account": "Revenue account",
"budget": "Budget"
"budget": "Budget",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "Debt",
"account_type_Loan": "Loan",
"account_type_Mortgage": "Mortgage"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "Sin presupuesto",
"expense_account": "Cuenta de gastos",
"revenue_account": "Cuenta de ingresos",
"budget": "Presupuesto"
"budget": "Presupuesto",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "Deuda",
"account_type_Loan": "Pr\u00e9stamo",
"account_type_Mortgage": "Hipoteca"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "No budget",
"expense_account": "Expense account",
"revenue_account": "Revenue account",
"budget": "Budjetti"
"budget": "Budjetti",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "Velka",
"account_type_Loan": "Laina",
"account_type_Mortgage": "Kiinnelaina"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "Pas de budget",
"expense_account": "Compte de d\u00e9penses",
"revenue_account": "Compte de recettes",
"budget": "Budget"
"budget": "Budget",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "Dette",
"account_type_Loan": "Pr\u00eat",
"account_type_Mortgage": "Pr\u00eat hypoth\u00e9caire"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "No budget",
"expense_account": "Expense account",
"revenue_account": "Revenue account",
"budget": "K\u00f6lts\u00e9gkeret"
"budget": "K\u00f6lts\u00e9gkeret",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "Ad\u00f3ss\u00e1g",
"account_type_Loan": "Hitel",
"account_type_Mortgage": "Jelz\u00e1log"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "No budget",
"expense_account": "Expense account",
"revenue_account": "Revenue account",
"budget": "Anggaran"
"budget": "Anggaran",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "Debt",
"account_type_Loan": "Loan",
"account_type_Mortgage": "Mortgage"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "No budget",
"expense_account": "Expense account",
"revenue_account": "Revenue account",
"budget": "Budget"
"budget": "Budget",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "Debito",
"account_type_Loan": "Prestito",
"account_type_Mortgage": "Mutuo"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "\u4e88\u7b97\u306a\u3057",
"expense_account": "\u652f\u51fa\u53e3\u5ea7",
"revenue_account": "\u53ce\u5165\u53e3\u5ea7",
"budget": "\u4e88\u7b97"
"budget": "\u4e88\u7b97",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "\u501f\u91d1",
"account_type_Loan": "\u30ed\u30fc\u30f3",
"account_type_Mortgage": "\u4f4f\u5b85\u30ed\u30fc\u30f3"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "\uc608\uc0b0 \uc5c6\uc74c",
"expense_account": "\uc9c0\ucd9c \uacc4\uc815",
"revenue_account": "\uc218\uc775 \uacc4\uc815",
"budget": "\uc608\uc0b0"
"budget": "\uc608\uc0b0",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "\ub300\ucd9c",
"account_type_Loan": "\ube5a",
"account_type_Mortgage": "\ubaa8\uae30\uc9c0"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "No budget",
"expense_account": "Expense account",
"revenue_account": "Revenue account",
"budget": "Busjett"
"budget": "Busjett",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "Gjeld",
"account_type_Loan": "L\u00e5n",
"account_type_Mortgage": "Boligl\u00e5n"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "Geen budget",
"expense_account": "Crediteur",
"revenue_account": "Debiteur",
"budget": "Budget"
"budget": "Budget",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "Schuld",
"account_type_Loan": "Lening",
"account_type_Mortgage": "Hypotheek"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "No budget",
"expense_account": "Expense account",
"revenue_account": "Revenue account",
"budget": "Budsjett"
"budget": "Budsjett",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "Gjeld",
"account_type_Loan": "L\u00e5n",
"account_type_Mortgage": "Boligl\u00e5n"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "Brak bud\u017cetu",
"expense_account": "Konto wydatk\u00f3w",
"revenue_account": "Konto przychod\u00f3w",
"budget": "Bud\u017cet"
"budget": "Bud\u017cet",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "D\u0142ug",
"account_type_Loan": "Po\u017cyczka",
"account_type_Mortgage": "Hipoteka"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "Nenhum or\u00e7amento",
"expense_account": "Conta de despesas",
"revenue_account": "Conta de Receitas",
"budget": "Or\u00e7amento"
"budget": "Or\u00e7amento",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "D\u00edvida",
"account_type_Loan": "Empr\u00e9stimo",
"account_type_Mortgage": "Hipoteca"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "No budget",
"expense_account": "Expense account",
"revenue_account": "Revenue account",
"budget": "Or\u00e7amento"
"budget": "Or\u00e7amento",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "D\u00edvida",
"account_type_Loan": "Empr\u00e9stimo",
"account_type_Mortgage": "Hipoteca"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "No budget",
"expense_account": "Expense account",
"revenue_account": "Revenue account",
"budget": "Buget"
"budget": "Buget",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "Datorie",
"account_type_Loan": "\u00cemprumut",
"account_type_Mortgage": "Credit ipotecar"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "No budget",
"expense_account": "Expense account",
"revenue_account": "Revenue account",
"budget": "\u0411\u044e\u0434\u0436\u0435\u0442"
"budget": "\u0411\u044e\u0434\u0436\u0435\u0442",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "\u0414\u0435\u0431\u0438\u0442",
"account_type_Loan": "\u0417\u0430\u0451\u043c",
"account_type_Mortgage": "\u0418\u043f\u043e\u0442\u0435\u043a\u0430"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "No budget",
"expense_account": "Expense account",
"revenue_account": "Revenue account",
"budget": "Rozpo\u010det"
"budget": "Rozpo\u010det",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "Dlh",
"account_type_Loan": "P\u00f4\u017ei\u010dka",
"account_type_Mortgage": "Hypot\u00e9ka"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "Ni prora\u010duna",
"expense_account": "Ra\u010dun stro\u0161kov",
"revenue_account": "Ra\u010dun prihodkov",
"budget": "Prora\u010dun"
"budget": "Prora\u010dun",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "Dolg",
"account_type_Loan": "Posojilo",
"account_type_Mortgage": "Hipoteka"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "No budget",
"expense_account": "Expense account",
"revenue_account": "Revenue account",
"budget": "Budget"
"budget": "Budget",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "Skuld",
"account_type_Loan": "L\u00e5n",
"account_type_Mortgage": "Bol\u00e5n"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "No budget",
"expense_account": "Expense account",
"revenue_account": "Revenue account",
"budget": "B\u00fct\u00e7e"
"budget": "B\u00fct\u00e7e",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "Debt",
"account_type_Loan": "Loan",
"account_type_Mortgage": "Mortgage"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "No budget",
"expense_account": "Expense account",
"revenue_account": "Revenue account",
"budget": "Budget"
"budget": "Budget",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "\u0414\u0435\u0431\u0456\u0442",
"account_type_Loan": "\u041f\u043e\u0437\u0438\u043a\u0430",
"account_type_Mortgage": "\u0406\u043f\u043e\u0442\u0435\u043a\u0430"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "No budget",
"expense_account": "Expense account",
"revenue_account": "Revenue account",
"budget": "Ng\u00e2n s\u00e1ch"
"budget": "Ng\u00e2n s\u00e1ch",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "M\u00f3n n\u1ee3",
"account_type_Loan": "Ti\u1ec1n vay",
"account_type_Mortgage": "Th\u1ebf ch\u1ea5p"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "No budget",
"expense_account": "Expense account",
"revenue_account": "Revenue account",
"budget": "\u9884\u7b97"
"budget": "\u9884\u7b97",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "\u6b20\u6b3e",
"account_type_Loan": "\u8d37\u6b3e",
"account_type_Mortgage": "\u62b5\u62bc"
}
}
}

View File

@ -23,7 +23,13 @@
"unknown_budget_plain": "No budget",
"expense_account": "Expense account",
"revenue_account": "Revenue account",
"budget": "\u9810\u7b97"
"budget": "\u9810\u7b97",
"account_type_Asset account": "Asset account",
"account_type_Expense account": "Expense account",
"account_type_Revenue account": "Revenue account",
"account_type_Debt": "\u8ca0\u50b5",
"account_type_Loan": "\u8cb8\u6b3e",
"account_type_Mortgage": "\u62b5\u62bc"
}
}
}

View File

@ -259,7 +259,7 @@ export default () => ({
init() {
// console.log('accounts init');
Promise.all([getVariable('viewRange', '1M'), getVariable('autoConversion', false), getVariable('language', 'en-US')]).then((values) => {
Promise.all([getVariable('viewRange', '1M'), getVariable('autoConversion', false), getVariable('language', 'en_US')]).then((values) => {
//console.log('accounts after promises');
this.autoConversion = values[1];
afterPromises = true;

View File

@ -175,11 +175,12 @@ export default () => ({
init() {
// console.log('budgets init');
Promise.all([getVariable('autoConversion', false), getVariable('language', 'en-US')]).then((values) => {
Promise.all([getVariable('autoConversion', false), getVariable('language', 'en_US')]).then((values) => {
i18n = new I18n();
i18n.locale = values[1];
loadTranslations(i18n, values[1]).then(() => {
const locale = values[1].replace('-', '_');
i18n.locale = locale;
loadTranslations(i18n, locale).then(() => {
this.autoConversion = values[0];
afterPromises = true;
if (false === this.loading) {

View File

@ -130,11 +130,12 @@ export default () => ({
init() {
// console.log('piggies init');
apiData = [];
Promise.all([getVariable('autoConversion', false), getVariable('language', 'en-US')]).then((values) => {
Promise.all([getVariable('autoConversion', false), getVariable('language', 'en_US')]).then((values) => {
i18n = new I18n();
i18n.locale = values[1];
loadTranslations(i18n, values[1]).then(() => {
const locale = values[1].replace('-', '_');
i18n.locale = locale;
loadTranslations(i18n, locale).then(() => {
// console.log('piggies after promises');
afterPromises = true;
this.autoConversion = values[0];

View File

@ -350,12 +350,13 @@ export default () => ({
init() {
// console.log('sankey init');
transactions = [];
Promise.all([getVariable('autoConversion', false), getVariable('language', 'en-US')]).then((values) => {
Promise.all([getVariable('autoConversion', false), getVariable('language', 'en_US')]).then((values) => {
this.autoConversion = values[0];
autoConversion = values[0];
i18n = new I18n();
i18n.locale = values[1];
loadTranslations(i18n, values[1]).then(() => {
const locale = values[1].replace('-', '_');
i18n.locale = locale;
loadTranslations(i18n, locale).then(() => {
// some translations:
translations.all_money = i18n.t('firefly.all_money');
translations.category = i18n.t('firefly.category');

View File

@ -274,14 +274,15 @@ export default () => ({
init() {
console.log('subscriptions init');
Promise.all([getVariable('autoConversion', false), getVariable('language', 'en-US')]).then((values) => {
Promise.all([getVariable('autoConversion', false), getVariable('language', 'en_US')]).then((values) => {
console.log('subscriptions after promises');
this.autoConversion = values[0];
afterPromises = true;
i18n = new I18n();
i18n.locale = values[1];
loadTranslations(i18n, values[1]).then(() => {
const locale = values[1].replace('-', '_');
i18n.locale = locale;
loadTranslations(i18n, locale).then(() => {
if (false === this.loading) {
this.startSubscriptions();
}

View File

@ -41,7 +41,7 @@ export default () => ({
defaultRange: {
start: null, end: null
},
language: 'en-US',
language: 'en_US',
init() {
// console.log('Dates init');

View File

@ -25,14 +25,135 @@ import {parseFromEntries} from "./shared/parse-from-entries.js";
import formatMoney from "../../util/format-money.js";
import Autocomplete from "bootstrap5-autocomplete";
import Post from "../../api/v2/model/transaction/post.js";
import {getVariable} from "../../store/get-variable.js";
import {I18n} from "i18n-js";
import {loadTranslations} from "../../support/load-translations.js";
let i18n;
const urls = {
description: '/api/v2/autocomplete/transaction-descriptions',
account: '/api/v2/autocomplete/accounts',
};
let transactions = function () {
return {
count: 0,
totalAmount: 0,
transactionType: 'unknown',
showSuccessMessage: false,
showErrorMessage: false,
entries: [],
filters: {
source: [],
destination: [],
},
detectTransactionType() {
const sourceType = this.entries[0].source_account.type ?? 'unknown';
const destType = this.entries[0].destination_account.type ?? 'unknown';
if ('unknown' === sourceType && 'unknown' === destType) {
this.transactionType = 'unknown';
console.warn('Cannot infer transaction type from two unknown accounts.');
return;
}
// transfer: both are the same and in strict set of account types
if (sourceType === destType && ['Asset account', 'Loan', 'Debt', 'Mortgage'].includes(sourceType)) {
this.transactionType = 'transfer';
console.log('Transaction type is detected to be "' + this.transactionType + '".');
return;
}
// withdrawals:
if ('Asset account' === sourceType && ['Expense account', 'Debt', 'Loan', 'Mortgage'].includes(destType)) {
this.transactionType = 'withdrawal';
console.log('Transaction type is detected to be "' + this.transactionType + '".');
return;
}
if ('Asset account' === sourceType && 'unknown' === destType) {
this.transactionType = 'withdrawal';
console.log('Transaction type is detected to be "' + this.transactionType + '".');
return;
}
if (['Debt', 'Loan', 'Mortgage'].includes(sourceType) && 'Expense account' === destType) {
this.transactionType = 'withdrawal';
console.log('Transaction type is detected to be "' + this.transactionType + '".');
return;
}
// deposits:
if ('Revenue account' === sourceType && ['Asset account', 'Debt', 'Loan', 'Mortgage'].includes(destType)) {
this.transactionType = 'deposit';
console.log('Transaction type is detected to be "' + this.transactionType + '".');
return;
}
if (['Debt', 'Loan', 'Mortgage'].includes(sourceType) && 'Asset account' === destType) {
this.transactionType = 'deposit';
console.log('Transaction type is detected to be "' + this.transactionType + '".');
return;
}
console.warn('Unknown account combination between "' + sourceType + '" and "' + destType + '".');
},
selectSourceAccount(item, ac) {
const index = parseInt(ac._searchInput.attributes['data-index'].value);
document.querySelector('#form')._x_dataStack[0].$data.entries[index].source_account =
{
id: item.id,
name: item.name,
type: item.type,
};
console.log('Changed source account into a known ' + item.type.toLowerCase());
},
changedAmount(e) {
const index = parseInt(e.target.dataset.index);
this.entries[index].amount = parseFloat(e.target.value);
this.totalAmount = 0;
for (let i in this.entries) {
if (this.entries.hasOwnProperty(i)) {
this.totalAmount = this.totalAmount + parseFloat(this.entries[i].amount);
}
}
console.log('Changed amount to ' + this.totalAmount);
},
selectDestAccount(item, ac) {
const index = parseInt(ac._searchInput.attributes['data-index'].value);
document.querySelector('#form')._x_dataStack[0].$data.entries[index].destination_account =
{
id: item.id,
name: item.name,
type: item.type,
};
console.log('Changed destination account into a known ' + item.type.toLowerCase());
},
changeSourceAccount(item, ac) {
if (typeof item === 'undefined') {
const index = parseInt(ac._searchInput.attributes['data-index'].value);
let source = document.querySelector('#form')._x_dataStack[0].$data.entries[index].source_account;
if (source.name === ac._searchInput.value) {
console.warn('Ignore hallucinated source account name change to "' + ac._searchInput.value + '"');
return;
}
document.querySelector('#form')._x_dataStack[0].$data.entries[index].source_account =
{
name: ac._searchInput.value,
};
console.log('Changed source account into a unknown account called "' + ac._searchInput.value + '"');
}
},
changeDestAccount(item, ac) {
if (typeof item === 'undefined') {
const index = parseInt(ac._searchInput.attributes['data-index'].value);
let destination = document.querySelector('#form')._x_dataStack[0].$data.entries[index].destination_account;
if (destination.name === ac._searchInput.value) {
console.warn('Ignore hallucinated destination account name change to "' + ac._searchInput.value + '"');
return;
}
document.querySelector('#form')._x_dataStack[0].$data.entries[index].destination_account =
{
name: ac._searchInput.value,
};
console.log('Changed destination account into a unknown account called "' + ac._searchInput.value + '"');
}
},
// error and success messages:
showError: false,
@ -40,62 +161,85 @@ let transactions = function () {
addedSplit() {
console.log('addedSplit');
const opts = {
onSelectItem: console.log,
};
var src = [];
for (let i = 0; i < 50; i++) {
src.push({
title: "Option " + i,
id: "opt" + i,
data: {
key: i,
},
});
}
Autocomplete.init("input.ac-source", {
server: urls.account,
serverParams: {
types: this.filters.source,
},
fetchOptions: {
headers: {
'X-CSRF-TOKEN': document.head.querySelector('meta[name="csrf-token"]').content
}
},
hiddenInput: true,
preventBrowserAutocomplete: true,
highlightTyped: true,
liveServer: true,
onChange: this.changeSourceAccount,
onSelectItem: this.selectSourceAccount,
onRenderItem: function (item, b, c) {
return item.name_with_balance + '<br><small class="text-muted">' + i18n.t('firefly.account_type_' + item.type) + '</small>';
}
});
Autocomplete.init("input.autocomplete", {
items: src,
Autocomplete.init("input.ac-dest", {
server: urls.account,
serverParams: {
types: this.filters.destination,
},
fetchOptions: {
headers: {
'X-CSRF-TOKEN': document.head.querySelector('meta[name="csrf-token"]').content
}
},
hiddenInput: true,
preventBrowserAutocomplete: true,
liveServer: true,
highlightTyped: true,
onSelectItem: this.selectDestAccount,
onChange: this.changeDestAccount,
onRenderItem: function (item, b, c) {
return item.name_with_balance + '<br><small class="text-muted">' + i18n.t('firefly.account_type_' + item.type) + '</small>';
}
});
this.filters.destination = [];
Autocomplete.init('input.ac-description', {
server: urls.description,
fetchOptions: {
headers: {
'X-CSRF-TOKEN': document.head.querySelector('meta[name="csrf-token"]').content
}
},
valueField: "id",
labelField: "title",
labelField: "description",
highlightTyped: true,
onSelectItem: console.log,
});
// setTimeout(() => {
// console.log('timed out');
// console.log(document.querySelector('input.autocomplete'));
// }, 1500);
},
init() {
console.log('init()');
this.addSplit();
Promise.all([getVariable('language', 'en_US')]).then((values) => {
i18n = new I18n();
const locale = values[0].replace('-', '_');
i18n.locale = locale;
loadTranslations(i18n, locale).then(() => {
this.addSplit();
});
// // We can use regular objects as source and customize label
// new Autocomplete(document.getElementById("autocompleteRegularInput"), {
// items: {
// opt_some: "Some",
// opt_value: "Value",
// opt_here: "Here is a very long element that should be truncated",
// opt_dia: "çaça"
// },
// onRenderItem: (item, label) => {
// return label + " (" + item.value + ")";
// },
// });
// new Autocomplete(document.getElementById("autocompleteDatalist"), opts);
//new Autocomplete(document.getElementById("autocompleteRemote"), opts);
// new Autocomplete(document.getElementById("autocompleteLiveRemote"), opts);
});
// source can never be expense account
this.filters.source = ['Asset account', 'Loan', 'Debt', 'Mortgage', 'Revenue account'];
// destination can never be revenue account
this.filters.destination = ['Expense account', 'Loan', 'Debt', 'Mortgage', 'Asset account'];
},
submitTransaction() {
this.detectTransactionType();
// todo disable buttons
let transactions = parseFromEntries(this.entries);
let transactions = parseFromEntries(this.entries, this.transactionType);
let submission = {
// todo process all options
group_title: null,

View File

@ -32,7 +32,7 @@ export function createEmptySplit() {
let now = new Date();
let formatted = format(now, 'yyyy-MM-dd HH:mm');
return {
description: 'OK then',
description: '',
amount: '',
source_account: getAccount(),
destination_account: getAccount(),

View File

@ -22,7 +22,7 @@
*
* @param entries
*/
export function parseFromEntries(entries) {
export function parseFromEntries(entries, transactionType) {
let returnArray = [];
for (let i in entries) {
if (entries.hasOwnProperty(i)) {
@ -36,8 +36,16 @@ export function parseFromEntries(entries) {
current.amount = entry.amount;
current.date = entry.date;
// if ID is set:
if ('' !== entry.source_account.id.toString()) {
current.source_id = entry.source_account.id;
}
if ('' !== entry.destination_account.id.toString()) {
current.destination_id = entry.destination_account.id;
}
// TODO transaction type is hard coded:
current.type = 'withdrawal';
current.type = transactionType;
returnArray.push(current);

View File

@ -22,6 +22,7 @@ let loaded = false;
async function loadTranslations(i18n, locale) {
if (false === loaded) {
locale = locale.replace('-', '_');
const response = await fetch(`./v2/i18n/${locale}.json`);
const translations = await response.json();
i18n.store(translations);

View File

@ -2047,6 +2047,9 @@ return [
'Expense account' => 'Expense account',
'Revenue account' => 'Revenue account',
'Initial balance account' => 'Initial balance account',
'account_type_Asset account' => 'Asset account',
'account_type_Expense account' => 'Expense account',
'account_type_Revenue account' => 'Revenue account',
'account_type_Debt' => 'Debt',
'account_type_Loan' => 'Loan',
'account_type_Mortgage' => 'Mortgage',

View File

@ -0,0 +1,227 @@
@extends('layout.v2')
@section('vite')
@vite(['resources/assets/v2/sass/app.scss', 'resources/assets/v2/pages/transactions/create.js'])
@endsection
@section('content')
<div class="app-content">
<!--begin::Container-->
<div class="container-fluid" x-data="transactions" id="form">
<div class="row mb-2">
<div class="col">
<template x-if="showSuccessMessage">
<div class="alert alert-success alert-dismissible fade show" role="alert">
A simple success alert with <a href="#" class="alert-link">an example link</a>. Give it a
click
if you like.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
</template>
<template x-if="showErrorMessage">
<div class="alert alert-danger alert-dismissible fade show" role="alert">
A simple ERROR alert with <a href="#" class="alert-link">an example link</a>. Give it a
click
if you like.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
</template>
</div>
</div>
<div class="row">
<div class="col">
<ul class="nav nav-tabs" id="splitTabs" role="tablist">
<template x-for="transaction,index in entries">
<li class="nav-item" role="presentation">
<button :id="'split-'+index+'-tab'"
:class="{'nav-link': true, 'active': index === 0 }"
data-bs-toggle="tab"
:data-bs-target="'#split-'+index+'-pane'"
type="button" role="tab"
:aria-controls="'split-'+index+'-pane'"
aria-selected="true">Split #
<span x-text="index"></span>
</button>
</li>
</template>
<li class="nav-item" role="presentation">
<button class="nav-link" type="button" role="tab" @click="addSplit()"
><em class="fa-solid fa-plus-circle"></em>
</button>
</li>
<li class="nav-item">
<a class="nav-link disabled" aria-disabled="true">
Total:
<span x-text="formattedTotalAmount()"></span>
</a>
</li>
</ul>
</div>
</div>
<div class="tab-content" id="splitTabsContent">
<template x-for="transaction,index in entries">
<div
:class="{'tab-pane fade pt-2':true, 'show active': index ===0}"
:id="'split-'+index+'-pane'"
role="tabpanel"
:aria-labelledby="'split-'+index+'-tab'"
tabindex="0"
x-init="addedSplit()"
>
<div class="row mb-2">
<div class="col-xl-6 col-lg-6 col-md-12 col-xs-12 mb-2">
<div class="card">
<div class="card-header">
<h3 class="card-title">{{ __('firefly.basic_journal_information') }}</h3>
</div>
<div class="card-body">
<div class="row mb-3">
<label for="description_0"
class="col-sm-1 col-form-label d-none d-sm-block">
<em class="fa-solid fa-font"></em>
</label>
<div class="col-sm-10">
<input type="text" class="form-control ac-description"
:id="'description_' + index"
@change="detectTransactionType"
x-model="transaction.description"
placeholder="Transaction description">
</div>
</div>
<div class="row mb-3">
<label for="source_0" class="col-sm-1 col-form-label d-none d-sm-block">
<i class="fa-solid fa-arrow-right"></i>
</label>
<div class="col-sm-10">
<input type="text" class="form-control ac-source" id="source_0"
x-model="transaction.source_account.name"
:data-index="index"
placeholder="Source account">
</div>
</div>
<div class="row mb-3">
<label for="dest_0" class="col-sm-1 col-form-label d-none d-sm-block">
<i class="fa-solid fa-arrow-left"></i>
</label>
<div class="col-sm-10">
<input type="text" class="form-control ac-dest" id="dest_0"
x-model="transaction.destination_account.name"
:data-index="index"
placeholder="Destination account">
</div>
</div>
<div class="row mb-3">
<label for="date_0" class="col-sm-1 col-form-label d-none d-sm-block">
<i class="fa-solid fa-calendar"></i>
</label>
<div class="col-sm-10">
<input type="datetime-local" class="form-control" id="date_0"
@change="detectTransactionType"
x-model="transaction.date"
>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-6 col-lg-6 col-md-12 col-xs-12 mb-2">
<div class="card">
<div class="card-header">
<h3 class="card-title">
{{ __('firefly.transaction_journal_amount') }}
</h3>
</div>
<div class="card-body">
<div class="row mb-3">
<label for="dest_0" class="col-sm-1 col-form-label d-none d-sm-block">
EUR
</label>
<div class="col-sm-10">
<input type="number" step="any" min="0" class="form-control"
:id="'amount_' + index"
:data-index="index"
x-model="transaction.amount"
@change="changedAmount"
placeholder="Amount">
</div>
</div>
</div>
<div class="card-footer">
amount card
</div>
</div>
</div>
<div class="col-xl-4 col-lg-6 col-md-12 col-xs-12 mb-2">
<div class="card">
<div class="card-header">
<h3 class="card-title">
{{ __('firefly.transaction_journal_meta') }}
</h3>
</div>
<div class="card-body">
important meta info card
</div>
<div class="card-footer">
important meta info card
</div>
</div>
</div>
<div class="col-xl-4 col-lg-6 col-md-12 col-xs-12 mb-2">
<div class="card">
<div class="card-header">
<h3 class="card-title">
{{ __('firefly.transaction_journal_extra') }}
</h3>
</div>
<div class="card-body">
Less important meta
</div>
<div class="card-footer">
Less important meta
</div>
</div>
</div>
<div class="col-xl-4 col-lg-6 col-md-12 col-xs-12 mb-2">
<div class="card">
<div class="card-header">
<h3 class="card-title">
{{ __('firefly.submission_options') }}
</h3>
</div>
<div class="card-body">
submission options
</div>
<div class="card-footer">
submission options
</div>
</div>
</div>
<div class="col-12">
<template x-if="0 !== index">
<button class="btn btn-danger" @click="removeSplit(index)">Remove this split
</button>
</template>
<button class="btn btn-info">Add another split</button>
</div>
</div>
</div>
</template>
</div>
<div class="row">
<div class="col text-end">
<button class="btn btn-success" @click="submitTransaction()">Submit</button>
</div>
</div>
</div>
</div>
@endsection

View File

@ -75,6 +75,7 @@ Route::group(
static function () {
// Auto complete routes
Route::get('accounts', ['uses' => 'AccountController@accounts', 'as' => 'accounts']);
Route::get('transaction-descriptions', ['uses' => 'TransactionController@transactionDescriptions', 'as' => 'transaction-descriptions']);
}
);