mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
First code for #616
This commit is contained in:
parent
40639dfa37
commit
7684e966fc
54
app/Http/Controllers/Admin/LinkController.php
Normal file
54
app/Http/Controllers/Admin/LinkController.php
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* LinkController.php
|
||||||
|
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||||
|
* This software may be modified and distributed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||||
|
*
|
||||||
|
* See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
|
||||||
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
|
use View;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class LinkController
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Http\Controllers\Admin
|
||||||
|
*/
|
||||||
|
class LinkController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
$this->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'));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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
|
* ATTACHMENTS
|
||||||
*/
|
*/
|
||||||
|
38
app/Models/LinkType.php
Normal file
38
app/Models/LinkType.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* LinkType.php
|
||||||
|
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||||
|
* This software may be modified and distributed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||||
|
*
|
||||||
|
* See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class LinkType
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Models
|
||||||
|
*/
|
||||||
|
class LinkType extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The attributes that should be casted to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts
|
||||||
|
= [
|
||||||
|
'created_at' => 'date',
|
||||||
|
'updated_at' => 'date',
|
||||||
|
'deleted_at' => 'date',
|
||||||
|
'editable' => 'boolean',
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
58
database/migrations/2017_08_20_062014_changes_for_v470.php
Normal file
58
database/migrations/2017_08_20_062014_changes_for_v470.php
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ChangesForV470
|
||||||
|
*/
|
||||||
|
class ChangesForV470 extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('link_types');
|
||||||
|
Schema::dropIfExists('journal_types');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
if (!Schema::hasTable('link_types')) {
|
||||||
|
Schema::create(
|
||||||
|
'link_types', function (Blueprint $table) {
|
||||||
|
$table->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);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -28,6 +28,7 @@ class DatabaseSeeder extends Seeder
|
|||||||
$this->call(TransactionCurrencySeeder::class);
|
$this->call(TransactionCurrencySeeder::class);
|
||||||
$this->call(TransactionTypeSeeder::class);
|
$this->call(TransactionTypeSeeder::class);
|
||||||
$this->call(PermissionSeeder::class);
|
$this->call(PermissionSeeder::class);
|
||||||
|
$this->call(LinkTypeSeeder::class);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
57
database/seeds/LinkTypeSeeder.php
Normal file
57
database/seeds/LinkTypeSeeder.php
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* LinkTypeSeeder.php
|
||||||
|
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||||
|
* This software may be modified and distributed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||||
|
*
|
||||||
|
* See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
|
||||||
|
use FireflyIII\Models\LinkType;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class LinkTypeSeeder
|
||||||
|
*/
|
||||||
|
class LinkTypeSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
$link = new LinkType;
|
||||||
|
$link->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();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -935,6 +935,8 @@ return [
|
|||||||
'block_code_bounced' => 'Email message(s) bounced',
|
'block_code_bounced' => 'Email message(s) bounced',
|
||||||
'block_code_expired' => 'Demo account expired',
|
'block_code_expired' => 'Demo account expired',
|
||||||
'no_block_code' => 'No reason for block or user not blocked',
|
'no_block_code' => 'No reason for block or user not blocked',
|
||||||
|
// links
|
||||||
|
'journal_link_configuration' => 'Transaction links configuration',
|
||||||
|
|
||||||
|
|
||||||
// split a transaction:
|
// split a transaction:
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="{{ route('admin.configuration.index') }}">{{ 'firefly_instance_configuration'|_ }}</a></li>
|
<li><a href="{{ route('admin.configuration.index') }}">{{ 'firefly_instance_configuration'|_ }}</a></li>
|
||||||
|
<li><a href="{{ route('admin.links.index') }}">{{ 'journal_link_configuration'|_ }}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -34,4 +35,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
21
resources/views/admin/link/index.twig
Normal file
21
resources/views/admin/link/index.twig
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{% extends "./layout/default" %}
|
||||||
|
|
||||||
|
{% block breadcrumbs %}
|
||||||
|
{{ Breadcrumbs.renderIfExists }}
|
||||||
|
{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
||||||
|
<div class="box box-default">
|
||||||
|
<div class="box-header with-border">
|
||||||
|
<h3 class="box-title">{{ 'journal_link_configuration'|_ }}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="box-body">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -758,6 +758,9 @@ Route::group(
|
|||||||
Route::get('users/show/{user}', ['uses' => 'UserController@show', 'as' => 'users.show']);
|
Route::get('users/show/{user}', ['uses' => 'UserController@show', 'as' => 'users.show']);
|
||||||
Route::post('users/update/{user}', ['uses' => 'UserController@update', 'as' => 'users.update']);
|
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:
|
// FF configuration:
|
||||||
Route::get('configuration', ['uses' => 'ConfigurationController@index', 'as' => 'configuration.index']);
|
Route::get('configuration', ['uses' => 'ConfigurationController@index', 'as' => 'configuration.index']);
|
||||||
Route::post('configuration', ['uses' => 'ConfigurationController@postIndex', 'as' => 'configuration.index.post']);
|
Route::post('configuration', ['uses' => 'ConfigurationController@postIndex', 'as' => 'configuration.index.post']);
|
||||||
|
Loading…
Reference in New Issue
Block a user