First attempt at basic tag functionality.

This commit is contained in:
James Cole
2015-04-28 08:58:01 +02:00
parent 6081cc399f
commit e7165a526b
26 changed files with 1046 additions and 67 deletions

View File

@@ -0,0 +1,14 @@
<div class="{{{$classes}}}">
<label for="{{{$options['id']}}}" class="col-sm-4 control-label">{{{$label}}}</label>
<div class="col-sm-8">
<div id="map-canvas" style="width:100%;height:300px;"></div>
<p class="help-block">Right-click to set the tag's location.
<a href="#" id="clearLocation">Clear location</a>
</p>
<input type="hidden" name="latitude" value="" />
<input type="hidden" name="longitude" value="" />
<input type="hidden" name="zoomLevel" value="6" />
<input type="hidden" name="setTag" value="" />
@include('form.feedback')
</div>
</div>

View File

@@ -0,0 +1,16 @@
<div class="{{{$classes}}}">
<label for="{{{$options['id']}}}" class="col-sm-4 control-label">{{{$label}}}</label>
<div class="col-sm-8">
@foreach($list as $value => $description)
<div class="radio">
<label>
{!! Form::radio($name, $value, ($selected == $value), $options) !!}
{{$description}}
</label>
</div>
@endforeach
@include('form.help')
@include('form.feedback')
</div>
</div>

View File

@@ -0,0 +1,7 @@
<div class="{{{$classes}}}">
<label for="{{{$options['id']}}}" class="col-sm-4 control-label">{{{$label}}}</label>
<div class="col-sm-8">
{!! Form::textarea($name, $value, $options) !!}
@include('form.feedback')
</div>
</div>

View File

@@ -1,5 +1,4 @@
@extends('app')
@extends('layouts.default')
@section('content')
<div class="container">
<div class="row">

View File

@@ -122,7 +122,7 @@
<a @if($r == 'categories.index') class="active" @endif href="{{route('categories.index')}}"><i class="fa fa-bar-chart fa-fw"></i> Categories</a>
</li>
<li>
<a href="#"><i class="fa fa-tags fa-fw"></i> Tags</a>
<a @if($r == 'tags.index') class="active" @endif href="{{route('tags.index')}}"><i class="fa fa-tags fa-fw"></i> Tags</a>
</li>
<li>
<a @if(!(strpos($r,'reports') === false)) class="active" @endif href="{{route('reports.index')}}"><i class="fa fa-line-chart fa-fw"></i> Reports</a>

View File

@@ -0,0 +1,85 @@
@extends('layouts.default')
@section('content')
{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) !!}
{!! Form::open(['class' => 'form-horizontal','id' => 'store','route' => 'tags.store']) !!}
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-12">
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-tag"></i> Mandatory fields
</div>
<div class="panel-body">
{!! ExpandedForm::text('tag') !!}
{!! ExpandedForm::multiRadio('tagMode',$tagOptions) !!}
</div>
</div>
</div>
<div class="col-lg-7 col-md-7 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-smile-o"></i> Optional fields
</div>
<div class="panel-body">
{!! ExpandedForm::date('date') !!}
{!! ExpandedForm::textarea('description') !!}
{!! ExpandedForm::location('tagPosition') !!}
</div>
</div>
<!-- panel for options -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-bolt"></i> Options
</div>
<div class="panel-body">
{!! ExpandedForm::optionsList('create','tag') !!}
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<p>
<button type="submit" class="btn btn-lg btn-success">
<i class="fa fa-plus-circle"></i> Store new tag
</button>
</p>
</div>
</div>
</form>
@stop
@section('scripts')
<script type="text/javascript">
@if(Input::old('latitude'))
var latitude = "{{Input::old('latitude')}}";
@else
var latitude = "52.3167";
@endif
@if(Input::old('latitude') && Input::old('longitude') && Input::old('zoomLevel'))
var doPlaceMarker = true;
@else
var doPlaceMarker = false;
@endif
@if(Input::old('longitude'))
var longitude = "{{Input::old('longitude')}}";
@else
var longitude = "5.5500";
@endif
@if(Input::old('zoomLevel'))
var zoomLevel = {{intval(Input::old('zoomLevel'))}};
@else
var zoomLevel = 6;
@endif
</script>
<script src="https://maps.googleapis.com/maps/api/js?v=3"></script>
<script src="js/tags.js"></script>
@stop

View File

@@ -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)]) !!}
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-12">
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-tag"></i> Mandatory fields
</div>
<div class="panel-body">
{!! ExpandedForm::text('tag') !!}
{!! ExpandedForm::multiRadio('tagMode',$tagOptions) !!}
</div>
</div>
</div>
<div class="col-lg-7 col-md-7 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-smile-o"></i> Optional fields
</div>
<div class="panel-body">
{!! ExpandedForm::date('date') !!}
{!! ExpandedForm::textarea('description') !!}
{!! ExpandedForm::location('tagPosition') !!}
</div>
</div>
<!-- panel for options -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-bolt"></i> Options
</div>
<div class="panel-body">
{!! ExpandedForm::optionsList('create','tag') !!}
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<p>
<button type="submit" class="btn btn-lg btn-success">
<i class="fa fa-plus-circle"></i> Store new tag
</button>
</p>
</div>
</div>
</form>
@stop
@section('scripts')
<script type="text/javascript">
@if(Input::old('latitude'))
var latitude = "{{Input::old('latitude')}}";
@else
var latitude = "52.3167";
@endif
@if(Input::old('latitude') && Input::old('longitude') && Input::old('zoomLevel'))
var doPlaceMarker = true;
@else
var doPlaceMarker = false;
@endif
@if(Input::old('longitude'))
var longitude = "{{Input::old('longitude')}}";
@else
var longitude = "5.5500";
@endif
@if(Input::old('zoomLevel'))
var zoomLevel = {{intval(Input::old('zoomLevel'))}};
@else
var zoomLevel = 6;
@endif
</script>
<script src="https://maps.googleapis.com/maps/api/js?v=3"></script>
<script src="js/tags.js"></script>
@stop

View File

@@ -0,0 +1,63 @@
@extends('layouts.default')
@section('content')
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading"><i class="fa fa-fw fa-tags"></i> Tags</div>
<div class="panel-body">
<div id="tagHelp" class="collapse
@if($helpHidden === false)
in
@endif
">
<p>
Usually tags are singular words, designed to quickly band items together
using things like <span class="label label-info">expensive</span>,
<span class="label label-info">bill</span> or
<span class="label label-info">for-party</span>. 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 <span class="label label-success">Christmas dinner with friends</span>
and add information about the restaurant. Such tags are "singular", you would only use them for a single occasion,
perhaps with multiple transactions.
</p>
<p>
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.
</p>
<p>
Create a tag to get started or enter tags when creating new transactions.
</p>
</div>
<p>
<a data-toggle="collapse" id="tagHelpButton" href="#tagHelp" aria-expanded="false" aria-controls="tagHelp">
@if($helpHidden === false)
Hide help
@else
Show help
@endif
</a>
</p>
<p>
<a href="{{route('tags.create')}}" title="New tag" class="btn btn-info"><i class="fa fa-fw fa-tag"></i> Create new tag</a>
</p>
<p>
@if(count($tags) == 0)
<em>No tags</em>
@else
@foreach($tags as $tag)
<h4 style="display: inline;"><a class="label label-success" href="{{route('tags.show',$tag)}}">{{$tag->tag}}</a></h4>
@endforeach
@endif
</p>
</div>
</div>
</div>
</div>
@endsection
@section('scripts')
<script type="text/javascript" src="js/tags.js"></script>
@endsection

View File

@@ -0,0 +1,77 @@
@extends('layouts.default')
@section('content')
{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $tag) !!}
<!-- show this block only when the tag has some meta-data -->
@if($tag->latitude && $tag->longitude && $tag->zoomLevel)
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-fw {{$subTitleIcon}} fa-fw"></i> {{{$tag->tag}}}
@if($tag->date)
on {{$tag->date->format('jS F Y')}}
@endif
<!-- ACTIONS MENU -->
<div class="pull-right">
<div class="btn-group">
<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
Actions
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right" role="menu">
<li><a href="{{route('tags.edit',$tag->id)}}"><i class="fa fa-pencil fa-fw"></i> Edit</a></li>
<li><a href="{{route('tags.delete',$tag->id)}}"><i class="fa fa-trash fa-fw"></i> Delete</a></li>
</ul>
</div>
</div>
</div>
<div class="panel-body">
@if($tag->description)
<p class="text-info">
{{$tag->description}}
</p>
@endif
@if($tag->latitude && $tag->longitude && $tag->zoomLevel)
<p>
<img src="https://maps.googleapis.com/maps/api/staticmap?center={{$tag->latitude}},{{$tag->longitude}}&zoom={{$tag->zoomLevel}}&size=600x300">
</p>
@endif
</div>
</div>
</div>
</div>
@endif
<!-- if no such thing, show another block maybe? -->
<div class="row">
<div class="col-lg-612 col-md-12 col-sm-12 col-xs-12">
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-repeat fa-fw"></i> Transactions
<!-- here is the edit menu when there is no meta-data -->
@if(!($tag->latitude && $tag->longitude && $tag->zoomLevel))
<!-- ACTIONS MENU -->
<div class="pull-right">
<div class="btn-group">
<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
Actions
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right" role="menu">
<li><a href="{{route('tags.edit',$tag->id)}}"><i class="fa fa-pencil fa-fw"></i> Edit</a></li>
<li><a href="{{route('tags.delete',$tag->id)}}"><i class="fa fa-trash fa-fw"></i> Delete</a></li>
</ul>
</div>
</div>
@endif
</div>
@include('list.journals-full',['journals' => $tag->transactionjournals])
</div>
</div>
</div>
@stop
@section('scripts')
<script type="text/javascript">
var tagID = {{{$tag->id}}};
</script>
@stop

View File

@@ -53,50 +53,6 @@
</div>
</div>
@endif
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-fw fa-exchange"></i>
Related transactions
</div>
@if($journal->transactiongroups()->count() == 0)
<div class="panel-body">
<p>
<em>No related transactions</em>
</p>
</div>
@else
<table class="table">
@foreach($journal->transactiongroups()->get() as $group)
<tr>
<th colspan="2">Group #{{$group->id}} ({{$group->relation}})</th>
</tr>
@foreach($group->transactionjournals()->where('transaction_journals.id','!=',$journal->id)->get() as $jrnl)
<tr>
<td>
<a href="{{route('related.getRemoveRelation',[$journal->id, $jrnl->id])}}" class="btn btn-danger btn-xs"><span class="glyphicon glyphicon-trash"></span></a>
</td>
<td>
<a href="{{route('transactions.show',$jrnl->id)}}">{{{$jrnl->description}}}</a>
</td>
<td>
@foreach($jrnl->transactions()->get() as $t)
@if($t->amount > 0)
{!! Amount::formatTransaction($t) !!}
@endif
@endforeach
</td>
</tr>
@endforeach
</tr>
@endforeach
</table>
@endif
<div class="panel-footer">
<p>
<a href="#" data-id="{{$journal->id}}" class="relateTransaction btn btn-default"><i data-id="{{$journal->id}}" class="fa fa-compress"></i> Relate to another transaction</a>
</p>
</div>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-12">