From e7165a526bafc36b165be663f9e5e852fab4e22e Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 28 Apr 2015 08:58:01 +0200 Subject: [PATCH] First attempt at basic tag functionality. --- app/Http/Controllers/TagController.php | 152 ++++++++++++++++++ app/Http/Requests/TagFormRequest.php | 43 +++++ app/Http/breadcrumbs.php | 23 ++- app/Http/routes.php | 27 ++++ app/Models/Tag.php | 77 +++++++++ app/Models/TransactionJournal.php | 8 + app/Providers/FireflyServiceProvider.php | 1 + app/Repositories/Tag/TagRepository.php | 39 +++++ .../Tag/TagRepositoryInterface.php | 20 +++ app/Support/ExpandedForm.php | 88 ++++++++-- app/User.php | 8 + app/Validation/FireflyValidator.php | 20 ++- config/app.php | 3 + .../2015_04_26_054507_changes_for_v3310.php | 87 ++++++++++ public/css/firefly.css | 5 + public/js/tags.js | 115 +++++++++++++ resources/views/form/location.blade.php | 14 ++ resources/views/form/multiRadio.blade.php | 16 ++ resources/views/form/textarea.blade.php | 7 + resources/views/home.blade.php | 3 +- resources/views/partials/menu.blade.php | 2 +- resources/views/tags/create.blade.php | 85 ++++++++++ resources/views/tags/edit.blade.php | 86 ++++++++++ resources/views/tags/index.blade.php | 63 ++++++++ resources/views/tags/show.blade.php | 77 +++++++++ resources/views/transactions/show.blade.php | 44 ----- 26 files changed, 1046 insertions(+), 67 deletions(-) create mode 100644 app/Http/Controllers/TagController.php create mode 100644 app/Http/Requests/TagFormRequest.php create mode 100644 app/Models/Tag.php create mode 100644 app/Repositories/Tag/TagRepository.php create mode 100644 app/Repositories/Tag/TagRepositoryInterface.php create mode 100644 database/migrations/2015_04_26_054507_changes_for_v3310.php create mode 100644 public/js/tags.js create mode 100644 resources/views/form/location.blade.php create mode 100644 resources/views/form/multiRadio.blade.php create mode 100644 resources/views/form/textarea.blade.php create mode 100644 resources/views/tags/create.blade.php create mode 100644 resources/views/tags/edit.blade.php create mode 100644 resources/views/tags/index.blade.php create mode 100644 resources/views/tags/show.blade.php diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php new file mode 100644 index 0000000000..d03fac2456 --- /dev/null +++ b/app/Http/Controllers/TagController.php @@ -0,0 +1,152 @@ + 'Just a regular tag.', + 'balancingAct' => 'The tag takes at most two transactions; an expense and a transfer. They\'ll balance each other out.', + 'advancePayment' => 'The tag accepts one expense and any number of deposits aimed to repay the original expense.', + ]; + View::share('tagOptions', $tagOptions); + } + + /** + * @return \Illuminate\View\View + */ + public function create() + { + $subTitle = 'New tag'; + $subTitleIcon = 'fa-tag'; + + $preFilled = [ + 'tagMode' => 'nothing' + ]; + if (!Input::old('tagMode')) { + Session::flash('preFilled', $preFilled); + } + // put previous url in session if not redirect from store (not "create another"). + if (Session::get('tags.create.fromStore') !== true) { + Session::put('tags.create.url', URL::previous()); + } + Session::forget('tags.create.fromStore'); + + return view('tags.create', compact('subTitle', 'subTitleIcon')); + } + + public function edit(Tag $tag) + { + $subTitle = 'Edit tag "' . e($tag->tag) . '"'; + $subTitleIcon = 'fa-tag'; + + return view('tags.edit', compact('tag', 'subTitle', 'subTitleIcon')); + } + + /** + * @param $state + */ + public function hideTagHelp($state) + { + + $state = $state == 'true' ? true : false; + Preferences::set('hideTagHelp', $state); + + return Response::json(true); + } + + /** + * + */ + public function index() + { + /** @var Preference $helpHiddenPref */ + $helpHiddenPref = Preferences::get('hideTagHelp', false); + $title = 'Tags'; + $mainTitleIcon = 'fa-tags'; + $helpHidden = $helpHiddenPref->data; + $tags = Auth::user()->tags()->get(); + + return view('tags.index', compact('title', 'mainTitleIcon', 'helpHidden', 'tags')); + } + + /** + * @param Tag $tag + * + * @return \Illuminate\View\View + */ + public function show(Tag $tag) + { + $subTitle = $tag->tag; + $subTitleIcon = 'fa-tag'; + + return view('tags.show', compact('tag', 'subTitle', 'subTitleIcon')); + } + + /** + * @param TagFormRequest $request + */ + public function store(TagFormRequest $request, TagRepositoryInterface $repository) + { + if (Input::get('setTag') == 'true') { + $latitude = strlen($request->get('latitude')) > 0 ? $request->get('latitude') : null; + $longitude = strlen($request->get('longitude')) > 0 ? $request->get('longitude') : null; + $zoomLevel = strlen($request->get('zoomLevel')) > 0 ? $request->get('zoomLevel') : null; + } else { + $latitude = null; + $longitude = null; + $zoomLevel = null; + } + + $data = [ + 'tag' => $request->get('tag'), + 'date' => strlen($request->get('date')) > 0 ? new Carbon($request->get('date')) : null, + 'description' => strlen($request->get('description')) > 0 ? $request->get('description') : null, + 'latitude' => $latitude, + 'longitude' => $longitude, + 'zoomLevel' => $zoomLevel, + 'tagMode' => $request->get('tagMode'), + ]; + $tag = $repository->store($data); + + Session::flash('success','The tag has been created!'); + + if (intval(Input::get('create_another')) === 1) { + // set value so create routine will not overwrite URL: + Session::put('tags.create.fromStore', true); + + return Redirect::route('tags.create')->withInput(); + } + + // redirect to previous URL. + return Redirect::to(Session::get('tags.create.url')); + + } +} \ No newline at end of file diff --git a/app/Http/Requests/TagFormRequest.php b/app/Http/Requests/TagFormRequest.php new file mode 100644 index 0000000000..8c7d1ae7c0 --- /dev/null +++ b/app/Http/Requests/TagFormRequest.php @@ -0,0 +1,43 @@ + 'required|min:1|uniqueObjectForUser:tags,tag,TRUE', + 'description' => 'min:1', + 'date' => 'date', + 'latitude' => 'numeric|min:-90|max:90', + 'longitude' => 'numeric|min:-90|max:90', + 'tagMode' => 'required|in:nothing,balancingAct,advancePayment' + ]; + } +} \ No newline at end of file diff --git a/app/Http/breadcrumbs.php b/app/Http/breadcrumbs.php index cdb6a5226e..610ad4418f 100644 --- a/app/Http/breadcrumbs.php +++ b/app/Http/breadcrumbs.php @@ -10,7 +10,7 @@ use FireflyIII\Models\LimitRepetition; use FireflyIII\Models\PiggyBank; use FireflyIII\Models\Reminder; use FireflyIII\Models\TransactionJournal; - +use FireflyIII\Models\Tag; /* * Back home. */ @@ -350,3 +350,24 @@ Breadcrumbs::register( } ); + +// tags +Breadcrumbs::register( + 'tags.index', function (Generator $breadcrumbs) { + $breadcrumbs->parent('home'); + $breadcrumbs->push('Tags', route('tags.index')); +} +); + +Breadcrumbs::register( + 'tags.create', function (Generator $breadcrumbs) { + $breadcrumbs->parent('tags.index'); + $breadcrumbs->push('Create tag', route('tags.create')); +} +); +Breadcrumbs::register( + 'tags.show', function (Generator $breadcrumbs, Tag $tag) { + $breadcrumbs->parent('tags.index'); + $breadcrumbs->push(e($tag->tag), route('tags.show', $tag)); +} +); \ No newline at end of file diff --git a/app/Http/routes.php b/app/Http/routes.php index 117edea60e..e6d4b71aa3 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -8,6 +8,7 @@ use FireflyIII\Models\PiggyBank; use FireflyIII\Models\Reminder; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionJournal; +use FireflyIII\Models\Tag; // models @@ -124,6 +125,16 @@ Route::bind( } ); +Route::bind( + 'tag', function ($value, $route) { + if (Auth::check()) { + return Tag::where('id', $value)->where('user_id', Auth::user()->id)->first(); + } + + return null; +} +); + /** * Auth\AuthController @@ -327,6 +338,22 @@ Route::group( */ Route::get('/search', ['uses' => 'SearchController@index', 'as' => 'search']); + /** + * Tag Controller + */ + Route::get('/tags', ['uses' => 'TagController@index', 'as' => 'tags.index']); + Route::get('/tags/create', ['uses' => 'TagController@create', 'as' => 'tags.create']); + Route::get('/tags/show/{tag}', ['uses' => 'TagController@show', 'as' => 'tags.show']); + Route::get('/tags/edit/{tag}', ['uses' => 'TagController@edit', 'as' => 'tags.edit']); + Route::get('/tags/delete/{tag}', ['uses' => 'TagController@delete', 'as' => 'tags.delete']); + + Route::post('/tags/store', ['uses' => 'TagController@store', 'as' => 'tags.store']); + Route::post('/tags/update/{tag}', ['uses' => 'TagController@update', 'as' => 'tags.update']); + Route::post('/tags/destroy/{tag}', ['uses' => 'TagController@destroy', 'as' => 'tags.destroy']); + + Route::post('/tags/hideTagHelp/{state}', ['uses' => 'TagController@hideTagHelp', 'as' => 'tags.hideTagHelp']); + + /** * Transaction Controller */ diff --git a/app/Models/Tag.php b/app/Models/Tag.php new file mode 100644 index 0000000000..6dcc4353ce --- /dev/null +++ b/app/Models/Tag.php @@ -0,0 +1,77 @@ +belongsToMany('FireflyIII\Models\TransactionJournal'); + } + + /** + * @param $value + * + * @return string + */ + public function getTagAttribute($value) + { + return Crypt::decrypt($value); + } + + /** + * @param $value + */ + public function setDescriptionAttribute($value) + { + $this->attributes['description'] = Crypt::encrypt($value); + } + + /** + * @param $value + */ + public function setTagAttribute($value) + { + $this->attributes['tag'] = Crypt::encrypt($value); + } + + /** + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function user() + { + return $this->belongsTo('FireflyIII\User'); + } +} \ No newline at end of file diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php index d9af19b51e..0a0170f340 100644 --- a/app/Models/TransactionJournal.php +++ b/app/Models/TransactionJournal.php @@ -241,4 +241,12 @@ class TransactionJournal extends Model return $this->belongsTo('FireflyIII\User'); } + /** + * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + */ + public function tags() + { + return $this->belongsToMany('FireflyIII\Models\Tag'); + } + } diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.php index a00ffc289e..542475d282 100644 --- a/app/Providers/FireflyServiceProvider.php +++ b/app/Providers/FireflyServiceProvider.php @@ -63,6 +63,7 @@ class FireflyServiceProvider extends ServiceProvider $this->app->bind('FireflyIII\Repositories\Bill\BillRepositoryInterface', 'FireflyIII\Repositories\Bill\BillRepository'); $this->app->bind('FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface', 'FireflyIII\Repositories\PiggyBank\PiggyBankRepository'); $this->app->bind('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface', 'FireflyIII\Repositories\Currency\CurrencyRepository'); + $this->app->bind('FireflyIII\Repositories\Tag\TagRepositoryInterface', 'FireflyIII\Repositories\Tag\TagRepository'); $this->app->bind('FireflyIII\Support\Search\SearchInterface', 'FireflyIII\Support\Search\Search'); diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php new file mode 100644 index 0000000000..8bd8accd7d --- /dev/null +++ b/app/Repositories/Tag/TagRepository.php @@ -0,0 +1,39 @@ +tag = $data['tag']; + $tag->date = $data['date']; + $tag->description = $data['description']; + $tag->latitude = $data['latitude']; + $tag->longitude = $data['longitude']; + $tag->zoomLevel = $data['zoomLevel']; + $tag->tagMode = $data['tagMode']; + $tag->user()->associate(Auth::user()); + $tag->save(); + + return $tag; + + + } +} \ No newline at end of file diff --git a/app/Repositories/Tag/TagRepositoryInterface.php b/app/Repositories/Tag/TagRepositoryInterface.php new file mode 100644 index 0000000000..a6d697be89 --- /dev/null +++ b/app/Repositories/Tag/TagRepositoryInterface.php @@ -0,0 +1,20 @@ + 'Asset account', 'budget_id' => 'Budget', 'openingBalance' => 'Opening balance', + 'tagMode' => 'Tag mode', + 'tagPosition' => 'Tag location', 'virtualBalance' => 'Virtual balance', + 'longitude_latitude' => 'Location', 'targetamount' => 'Target amount', 'accountRole' => 'Account role', 'openingBalanceDate' => 'Opening balance date', @@ -201,15 +204,17 @@ class ExpandedForm * * @return string */ - public function month($name, $value = null, array $options = []) + public function integer($name, $value = null, array $options = []) { - $label = $this->label($name, $options); - $options = $this->expandOptionArray($name, $label, $options); - $classes = $this->getHolderClasses($name); - $value = $this->fillFieldValue($name, $value); - $html = View::make('form.month', compact('classes', 'name', 'label', 'value', 'options'))->render(); + $label = $this->label($name, $options); + $options = $this->expandOptionArray($name, $label, $options); + $classes = $this->getHolderClasses($name); + $value = $this->fillFieldValue($name, $value); + $options['step'] = '1'; + $html = View::make('form.integer', compact('classes', 'name', 'label', 'value', 'options'))->render(); return $html; + } /** @@ -219,14 +224,13 @@ class ExpandedForm * * @return string */ - public function integer($name, $value = null, array $options = []) + public function location($name, $value = null, array $options = []) { - $label = $this->label($name, $options); - $options = $this->expandOptionArray($name, $label, $options); - $classes = $this->getHolderClasses($name); - $value = $this->fillFieldValue($name, $value); - $options['step'] = '1'; - $html = View::make('form.integer', compact('classes', 'name', 'label', 'value', 'options'))->render(); + $label = $this->label($name, $options); + $options = $this->expandOptionArray($name, $label, $options); + $classes = $this->getHolderClasses($name); + $value = $this->fillFieldValue($name, $value); + $html = View::make('form.location', compact('classes', 'name', 'label', 'value', 'options'))->render(); return $html; @@ -265,6 +269,44 @@ class ExpandedForm return $selectList; } + /** + * @param $name + * @param null $value + * @param array $options + * + * @return string + */ + public function month($name, $value = null, array $options = []) + { + $label = $this->label($name, $options); + $options = $this->expandOptionArray($name, $label, $options); + $classes = $this->getHolderClasses($name); + $value = $this->fillFieldValue($name, $value); + $html = View::make('form.month', compact('classes', 'name', 'label', 'value', 'options'))->render(); + + return $html; + } + + /** + * @param $name + * @param null $value + * @param array $options + * + * @return string + */ + public function multiRadio($name, array $list = [], $selected = null, array $options = []) + { + $label = $this->label($name, $options); + $options = $this->expandOptionArray($name, $label, $options); + $classes = $this->getHolderClasses($name); + $selected = $this->fillFieldValue($name, $selected); + + unset($options['class']); + $html = View::make('form.multiRadio', compact('classes', 'name', 'label', 'selected', 'options', 'list'))->render(); + + return $html; + } + /** * @param $type * @param $name @@ -336,4 +378,24 @@ class ExpandedForm return $html; } + + /** + * @param $name + * @param null $value + * @param array $options + * + * @return string + */ + public function textarea($name, $value = null, array $options = []) + { + $label = $this->label($name, $options); + $options = $this->expandOptionArray($name, $label, $options); + $classes = $this->getHolderClasses($name); + $value = $this->fillFieldValue($name, $value); + $options['rows'] = 4; + $html = View::make('form.textarea', compact('classes', 'name', 'label', 'value', 'options'))->render(); + + return $html; + + } } diff --git a/app/User.php b/app/User.php index 1631995fd7..f649708cfb 100644 --- a/app/User.php +++ b/app/User.php @@ -43,6 +43,14 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon return $this->hasMany('FireflyIII\Models\Account'); } + /** + * @return \Illuminate\Database\Eloquent\Relations\HasMany + */ + public function tags() + { + return $this->hasMany('FireflyIII\Models\Tag'); + } + /** * @return \Illuminate\Database\Eloquent\Relations\HasMany */ diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php index 3dec04fa7e..b886074aa9 100644 --- a/app/Validation/FireflyValidator.php +++ b/app/Validation/FireflyValidator.php @@ -181,10 +181,14 @@ class FireflyValidator extends Validator */ public function validateUniqueObjectForUser($attribute, $value, $parameters) { - $table = $parameters[0]; - $field = $parameters[1]; - $encrypted = isset($parameters[2]) ? $parameters[2] : 'encrypted'; - $exclude = isset($parameters[3]) ? $parameters[3] : null; + $table = $parameters[0]; + $field = $parameters[1]; + $encrypted = isset($parameters[2]) ? $parameters[2] : 'encrypted'; + $exclude = isset($parameters[3]) ? $parameters[3] : null; + $alwaysEncrypted = false; + if ($encrypted == 'TRUE') { + $alwaysEncrypted = true; + } $query = DB::table($table)->where('user_id', Auth::user()->id); @@ -195,8 +199,12 @@ class FireflyValidator extends Validator $set = $query->get(); foreach ($set as $entry) { - $isEncrypted = intval($entry->$encrypted) == 1 ? true : false; - $checkValue = $isEncrypted ? Crypt::decrypt($entry->$field) : $entry->$field; + if (!$alwaysEncrypted) { + $isEncrypted = intval($entry->$encrypted) == 1 ? true : false; + } else { + $isEncrypted = true; + } + $checkValue = $isEncrypted ? Crypt::decrypt($entry->$field) : $entry->$field; if ($checkValue == $value) { return false; } diff --git a/config/app.php b/config/app.php index fe7ad89606..17bf91779e 100644 --- a/config/app.php +++ b/config/app.php @@ -137,6 +137,9 @@ return [ 'Illuminate\View\ViewServiceProvider', 'Illuminate\Html\HtmlServiceProvider', 'DaveJamesMiller\Breadcrumbs\ServiceProvider', + 'Barryvdh\Debugbar\ServiceProvider', + 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider', + /* * Application Service Providers... diff --git a/database/migrations/2015_04_26_054507_changes_for_v3310.php b/database/migrations/2015_04_26_054507_changes_for_v3310.php new file mode 100644 index 0000000000..ee2b5a4cfe --- /dev/null +++ b/database/migrations/2015_04_26_054507_changes_for_v3310.php @@ -0,0 +1,87 @@ +dropColumn('relation'); + } + ); + + Schema::table( + 'transaction_groups', function (Blueprint $table) { + + // drop column "relation" + $table->string('relation', 50); + } + ); + // make new column "relation" + + // set all current entries to be "balance" + DB::table('transaction_groups')->update(['relation' => 'balance']); + + /* + * New table! + */ + Schema::create( + 'tags', function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->softDeletes(); + $table->integer('user_id')->unsigned(); + $table->string('tag', 1024); + $table->string('tagMode', 1024); + $table->date('date')->nullable(); + $table->text('description')->nullable(); + $table->decimal('latitude', 18, 12)->nullable(); + $table->decimal('longitude', 18, 12)->nullable(); + $table->smallInteger('zoomLevel', false, true)->nullable(); + + + // connect reminders to users + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + } + ); + + + Schema::create('tag_transaction_journal',function (Blueprint $table) { + $table->increments('id'); + $table->integer('tag_id')->unsigned(); + $table->integer('transaction_journal_id')->unsigned(); + + // link to foreign tables. + $table->foreign('tag_id', 'tag_grp_id')->references('id')->on('tags')->onDelete('cascade'); + $table->foreign('transaction_journal_id', 'tag_trj_id')->references('id')->on('transaction_journals')->onDelete('cascade'); + + // add unique. + $table->unique(['tag_id', 'transaction_journal_id'], 'tag_t_joined'); + + }); + } + +} diff --git a/public/css/firefly.css b/public/css/firefly.css index 422c9bed10..09359d29db 100644 --- a/public/css/firefly.css +++ b/public/css/firefly.css @@ -5,4 +5,9 @@ .ui-sortable-placeholder { display: inline-block; height: 1px; +} +#map-canvas { + height: 100%; + margin: 0px; + padding: 0px } \ No newline at end of file diff --git a/public/js/tags.js b/public/js/tags.js new file mode 100644 index 0000000000..f099ec1ee2 --- /dev/null +++ b/public/js/tags.js @@ -0,0 +1,115 @@ +$(function () { + + /* + Hide and show the tag index help. + */ + $('#tagHelp').on('show.bs.collapse', function () { + // set hideTagHelp = false + $.post('/tags/hideTagHelp/false', {_token: token}); + $('#tagHelpButton').text('Hide help'); + + }).on('hide.bs.collapse', function () { + // set hideTagHelp = true + $.post('/tags/hideTagHelp/true', {_token: token}); + $('#tagHelpButton').text('Show help'); + + }); + + $('#clearLocation').click(clearLocation); + +}); + +/* + Some vars as prep for the map: + */ +var map; +var markers = []; +var setTag = false; + +var mapOptions = { + zoom: zoomLevel, + center: new google.maps.LatLng(latitude, longitude), + disableDefaultUI: true +}; + +/* + Clear location and reset zoomLevel. + */ +function clearLocation() { + "use strict"; + deleteMarkers(); + $('input[name="latitude"]').val(""); + $('input[name="longitude"]').val(""); + $('input[name="zoomLevel"]').val("6"); + setTag = false; + $('input[name="setTag"]').val('false'); + return false; +} + +function initialize() { + + /* + Create new map: + */ + map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); + + /* + Respond to click event. + */ + google.maps.event.addListener(map, 'rightclick', function (event) { + placeMarker(event); + }); + + /* + Respond to zoom event. + */ + google.maps.event.addListener(map, 'zoom_changed', function () { + saveZoomLevel(event); + }); + /* + Maybe place marker? + */ + if(doPlaceMarker) { + var myLatlng = new google.maps.LatLng(latitude,longitude); + var fakeEvent = {}; + fakeEvent.latLng = myLatlng; + placeMarker(fakeEvent); + + } +} + +/** + * save zoom level of map into hidden input. + */ +function saveZoomLevel() { + "use strict"; + $('input[name="zoomLevel"]').val(map.getZoom()); +} + +/** + * Place marker on map. + * @param event + */ +function placeMarker(event) { + deleteMarkers(); + var marker = new google.maps.Marker({position: event.latLng, map: map}); + $('input[name="latitude"]').val(event.latLng.lat()); + $('input[name="longitude"]').val(event.latLng.lng()); + markers.push(marker); + setTag = true; + $('input[name="setTag"]').val('true'); +} + + +/** + * Deletes all markers in the array by removing references to them. + */ +function deleteMarkers() { + for (var i = 0; i < markers.length; i++) { + markers[i].setMap(null); + } + markers = []; +} + + +google.maps.event.addDomListener(window, 'load', initialize); \ No newline at end of file diff --git a/resources/views/form/location.blade.php b/resources/views/form/location.blade.php new file mode 100644 index 0000000000..3dce7aef14 --- /dev/null +++ b/resources/views/form/location.blade.php @@ -0,0 +1,14 @@ +
+ +
+
+

Right-click to set the tag's location. + Clear location +

+ + + + + @include('form.feedback') +
+
diff --git a/resources/views/form/multiRadio.blade.php b/resources/views/form/multiRadio.blade.php new file mode 100644 index 0000000000..3129407079 --- /dev/null +++ b/resources/views/form/multiRadio.blade.php @@ -0,0 +1,16 @@ +
+ +
+ @foreach($list as $value => $description) +
+ +
+ @endforeach + @include('form.help') + @include('form.feedback') + +
+
diff --git a/resources/views/form/textarea.blade.php b/resources/views/form/textarea.blade.php new file mode 100644 index 0000000000..48db2202ab --- /dev/null +++ b/resources/views/form/textarea.blade.php @@ -0,0 +1,7 @@ +
+ +
+ {!! Form::textarea($name, $value, $options) !!} + @include('form.feedback') +
+
diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index 8f5e705858..f266babe9a 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -1,5 +1,4 @@ -@extends('app') - +@extends('layouts.default') @section('content')
diff --git a/resources/views/partials/menu.blade.php b/resources/views/partials/menu.blade.php index 29a371045d..6dfcd89a6b 100644 --- a/resources/views/partials/menu.blade.php +++ b/resources/views/partials/menu.blade.php @@ -122,7 +122,7 @@ Categories
  • - Tags + Tags
  • Reports diff --git a/resources/views/tags/create.blade.php b/resources/views/tags/create.blade.php new file mode 100644 index 0000000000..cc51341e86 --- /dev/null +++ b/resources/views/tags/create.blade.php @@ -0,0 +1,85 @@ +@extends('layouts.default') +@section('content') +{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) !!} +{!! Form::open(['class' => 'form-horizontal','id' => 'store','route' => 'tags.store']) !!} + +
    +
    +
    +
    + Mandatory fields +
    +
    + {!! ExpandedForm::text('tag') !!} + {!! ExpandedForm::multiRadio('tagMode',$tagOptions) !!} +
    +
    +
    + +
    + +
    +
    + Optional fields +
    +
    + {!! ExpandedForm::date('date') !!} + {!! ExpandedForm::textarea('description') !!} + {!! ExpandedForm::location('tagPosition') !!} +
    +
    + + +
    +
    + Options +
    +
    + {!! ExpandedForm::optionsList('create','tag') !!} +
    +
    + +
    +
    +
    +
    +

    + +

    +
    +
    + + +@stop +@section('scripts') + + + +@stop \ No newline at end of file diff --git a/resources/views/tags/edit.blade.php b/resources/views/tags/edit.blade.php new file mode 100644 index 0000000000..1ebe1d5149 --- /dev/null +++ b/resources/views/tags/edit.blade.php @@ -0,0 +1,86 @@ +@extends('layouts.default') +@section('content') +{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $tag) !!} +{!! Form::model($tag, ['class' => 'form-horizontal','id' => 'update','url' => route('tags.update',$tag->id)]) !!} + + +
    +
    +
    +
    + Mandatory fields +
    +
    + {!! ExpandedForm::text('tag') !!} + {!! ExpandedForm::multiRadio('tagMode',$tagOptions) !!} +
    +
    +
    + +
    + +
    +
    + Optional fields +
    +
    + {!! ExpandedForm::date('date') !!} + {!! ExpandedForm::textarea('description') !!} + {!! ExpandedForm::location('tagPosition') !!} +
    +
    + + +
    +
    + Options +
    +
    + {!! ExpandedForm::optionsList('create','tag') !!} +
    +
    + +
    +
    +
    +
    +

    + +

    +
    +
    + + +@stop +@section('scripts') + + + +@stop \ No newline at end of file diff --git a/resources/views/tags/index.blade.php b/resources/views/tags/index.blade.php new file mode 100644 index 0000000000..6622f886bf --- /dev/null +++ b/resources/views/tags/index.blade.php @@ -0,0 +1,63 @@ +@extends('layouts.default') +@section('content') + +
    +
    +
    +
    Tags
    +
    +
    +

    + Usually tags are singular words, designed to quickly band items together + using things like expensive, + bill or + for-party. In Firefly III, tags can have more properties + such as a date, description and location. This allows you to join transactions together in a more meaningful + way. For example, you could make a tag called Christmas dinner with friends + and add information about the restaurant. Such tags are "singular", you would only use them for a single occasion, + perhaps with multiple transactions. +

    +

    + Tags group transactions together, which makes it possible to store reimbursements + (in case you front money for others) and other "balancing acts" where expenses + are summed up (the payments on your new TV) or where expenses and deposits + are cancelling each other out (buying something with saved money). It's all up to you. + Using tags the old-fashioned way is of course always possible. +

    +

    + Create a tag to get started or enter tags when creating new transactions. +

    +
    +

    + +

    +

    + Create new tag +

    +

    + @if(count($tags) == 0) + No tags + @else + @foreach($tags as $tag) +

    {{$tag->tag}}

    + @endforeach + @endif +

    +
    +
    +
    +
    +@endsection +@section('scripts') + +@endsection \ No newline at end of file diff --git a/resources/views/tags/show.blade.php b/resources/views/tags/show.blade.php new file mode 100644 index 0000000000..8e3a05d577 --- /dev/null +++ b/resources/views/tags/show.blade.php @@ -0,0 +1,77 @@ +@extends('layouts.default') +@section('content') +{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $tag) !!} + + @if($tag->latitude && $tag->longitude && $tag->zoomLevel) +
    +
    +
    +
    + {{{$tag->tag}}} + @if($tag->date) + on {{$tag->date->format('jS F Y')}} + @endif + +
    +
    + + +
    +
    +
    +
    + @if($tag->description) +

    + {{$tag->description}} +

    + @endif + @if($tag->latitude && $tag->longitude && $tag->zoomLevel) +

    + +

    + @endif +
    +
    +
    +
    + @endif + +
    +
    +
    +
    + Transactions + + @if(!($tag->latitude && $tag->longitude && $tag->zoomLevel)) + +
    +
    + + +
    +
    + @endif +
    + @include('list.journals-full',['journals' => $tag->transactionjournals]) +
    +
    +
    + +@stop +@section('scripts') + +@stop diff --git a/resources/views/transactions/show.blade.php b/resources/views/transactions/show.blade.php index 6c3e671dd3..fb66d9fdc4 100644 --- a/resources/views/transactions/show.blade.php +++ b/resources/views/transactions/show.blade.php @@ -53,50 +53,6 @@
  • @endif -
    -
    - - Related transactions -
    - @if($journal->transactiongroups()->count() == 0) -
    -

    - No related transactions -

    -
    - @else - - @foreach($journal->transactiongroups()->get() as $group) - - - - @foreach($group->transactionjournals()->where('transaction_journals.id','!=',$journal->id)->get() as $jrnl) - - - - - - @endforeach - - @endforeach -
    Group #{{$group->id}} ({{$group->relation}})
    - - - {{{$jrnl->description}}} - - @foreach($jrnl->transactions()->get() as $t) - @if($t->amount > 0) - {!! Amount::formatTransaction($t) !!} - @endif - @endforeach -
    - @endif - -