diff --git a/app/Http/Controllers/Admin/LinkController.php b/app/Http/Controllers/Admin/LinkController.php new file mode 100644 index 0000000000..ca2ce39184 --- /dev/null +++ b/app/Http/Controllers/Admin/LinkController.php @@ -0,0 +1,54 @@ +middleware( + function ($request, $next) { + View::share('title', strval(trans('firefly.administration'))); + View::share('mainTitleIcon', 'fa-hand-spock-o'); + + return $next($request); + } + ); + } + + /** + * + */ + public function index() + { + $subTitle = trans('firefly.journal_link_configuration'); + $subTitleIcon = 'fa-link'; + + return view('admin.link.index', compact('subTitle', 'subTitleIcon')); + } + +} \ No newline at end of file diff --git a/app/Http/breadcrumbs.php b/app/Http/breadcrumbs.php index 5c79e234b5..fd3bd27685 100644 --- a/app/Http/breadcrumbs.php +++ b/app/Http/breadcrumbs.php @@ -152,6 +152,14 @@ Breadcrumbs::register( ); +Breadcrumbs::register( + 'admin.links.index', function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('admin.index'); + $breadcrumbs->push(trans('firefly.journal_link_configuration'), route('admin.links.index')); +} +); + + /** * ATTACHMENTS */ diff --git a/app/Models/LinkType.php b/app/Models/LinkType.php new file mode 100644 index 0000000000..8a86779466 --- /dev/null +++ b/app/Models/LinkType.php @@ -0,0 +1,38 @@ + 'date', + 'updated_at' => 'date', + 'deleted_at' => 'date', + 'editable' => 'boolean', + ]; + +} \ No newline at end of file diff --git a/database/migrations/2017_08_20_062014_changes_for_v470.php b/database/migrations/2017_08_20_062014_changes_for_v470.php new file mode 100644 index 0000000000..1fe202c8c1 --- /dev/null +++ b/database/migrations/2017_08_20_062014_changes_for_v470.php @@ -0,0 +1,58 @@ +increments('id'); + $table->timestamps(); + $table->softDeletes(); + $table->string('name'); + $table->string('outward'); + $table->string('inward'); + $table->boolean('editable'); + } + ); + } + + if (!Schema::hasTable('journal_links')) { + Schema::create( + 'journal_links', function (Blueprint $table) { + $table->increments('id'); + $table->integer('link_type_id', false, true); + $table->integer('source_id', false, true); + $table->integer('destination_id', false, true); + $table->text('comment'); + $table->integer('sequence', false, true); + } + ); + } + } +} diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index 504c129e47..03adb0669e 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -28,6 +28,7 @@ class DatabaseSeeder extends Seeder $this->call(TransactionCurrencySeeder::class); $this->call(TransactionTypeSeeder::class); $this->call(PermissionSeeder::class); + $this->call(LinkTypeSeeder::class); } } diff --git a/database/seeds/LinkTypeSeeder.php b/database/seeds/LinkTypeSeeder.php new file mode 100644 index 0000000000..2101b3f86f --- /dev/null +++ b/database/seeds/LinkTypeSeeder.php @@ -0,0 +1,57 @@ +name = 'Related'; + $link->inward = 'relates to'; + $link->outward = 'is related to'; + $link->editable = false; + $link->save(); + + $link = new LinkType; + $link->name = 'Refund'; + $link->inward = 'refunds'; + $link->outward = 'is refunded by'; + $link->editable = false; + $link->save(); + + $link = new LinkType; + $link->name = 'PartialRefund'; + $link->inward = 'partially refunds'; + $link->outward = 'is partially refunded by'; + $link->editable = false; + $link->save(); + + $link = new LinkType; + $link->name = 'Paid'; + $link->inward = 'pays for'; + $link->outward = 'is paid for by'; + $link->editable = false; + $link->save(); + + } + +} diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index fd23d22f83..a72ba1ccc3 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -935,6 +935,8 @@ return [ 'block_code_bounced' => 'Email message(s) bounced', 'block_code_expired' => 'Demo account expired', 'no_block_code' => 'No reason for block or user not blocked', + // links + 'journal_link_configuration' => 'Transaction links configuration', // split a transaction: diff --git a/resources/views/admin/index.twig b/resources/views/admin/index.twig index 2edd7c681e..1de89abcc3 100644 --- a/resources/views/admin/index.twig +++ b/resources/views/admin/index.twig @@ -13,6 +13,7 @@
@@ -34,4 +35,6 @@ + + {% endblock %} diff --git a/resources/views/admin/link/index.twig b/resources/views/admin/link/index.twig new file mode 100644 index 0000000000..f5ac34ba4a --- /dev/null +++ b/resources/views/admin/link/index.twig @@ -0,0 +1,21 @@ +{% extends "./layout/default" %} + +{% block breadcrumbs %} + {{ Breadcrumbs.renderIfExists }} +{% endblock %} +{% block content %} +
+
+
+
+

{{ 'journal_link_configuration'|_ }}

+
+
+ +
+
+
+
+ + +{% endblock %} diff --git a/routes/web.php b/routes/web.php index 13aa3714cf..9e380fb15b 100755 --- a/routes/web.php +++ b/routes/web.php @@ -758,6 +758,9 @@ Route::group( Route::get('users/show/{user}', ['uses' => 'UserController@show', 'as' => 'users.show']); Route::post('users/update/{user}', ['uses' => 'UserController@update', 'as' => 'users.update']); + // journal links manager + Route::get('links', ['uses' => 'LinkController@index', 'as' => 'links.index']); + // FF configuration: Route::get('configuration', ['uses' => 'ConfigurationController@index', 'as' => 'configuration.index']); Route::post('configuration', ['uses' => 'ConfigurationController@postIndex', 'as' => 'configuration.index.post']);