Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
gallib committed Jun 22, 2018
2 parents 7f48f4a + 610fa14 commit 9b62a86
Show file tree
Hide file tree
Showing 74 changed files with 762 additions and 854 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
],
"minimum-stability": "dev",
"require": {
"php": ">=7.0.0",
"php": ">=7.1.3",
"felixkiss/uniquewith-validator": "^3.1.0",
"laravel/framework": ">=5.5.0",
"laravelcollective/html": "^5.5.0",
"laravel/framework": ">=5.6.0",
"laravelcollective/html": "^5.6.0",
"maatwebsite/excel": "^2.1"
},
"autoload": {
Expand Down
3 changes: 2 additions & 1 deletion src/config/macope.php → config/macope.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

return [
'month_ends_on' => 24,
'route_prefix' => 'macope',
'upload_folder' => '\m\a\c\o\p\e/\u\p\l\o\a\d\e\d/Y/m',
];
];
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public function up()
});

Schema::table('journal_entries', function (Blueprint $table) {
$table->integer('category_id')->nullable()->unsigned()->after('debit');
$table->integer('category_id')->nullable()->unsigned()->after('debit');

$table->foreign('category_id')->references('id')->on('categories');
});
$table->foreign('category_id')->references('id')->on('categories');
});
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
*/
getExpenses() {
axios
.post('/macope/expenses-by-type-category')
.post('/macope/expenses-by-type-category', {
date_from: moment().subtract(11, 'M').format('Y-M-01'),
date_to: moment().format('Y-M-D')
})
.then(response => {
response.data.forEach(data => {
this.labels.push(data.name);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 32 additions & 0 deletions resources/views/expenses/index.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@extends('layouts.app')

@section('content')
<div class="container-fluid">
<div class="row">
<div class="col">
<h1>{{ $currentYear }} expenses</h1>
</div>
</div>
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">
<div class="header-block">
{{ $currentYear }} expenses
<ul class="nav nav-tabs card-header-tabs pull-right">
@foreach ($years as $year)
<li class="nav-item">
<a class="nav-link @if($year->year == $currentYear) active @endif" href="{{ route('expenses.index', ['year' => $year->year]) }}">{{ $year->year }}</a>
</li>
@endforeach
</ul>
</div>
</div>
<div class="card-body">
@each('macope::partials.billing', $expenses, 'typeCategory')
</div>
</div>
</div>
</div>
</div>
@endsection
File renamed without changes.
32 changes: 32 additions & 0 deletions resources/views/incomes/index.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@extends('layouts.app')

@section('content')
<div class="container-fluid">
<div class="row">
<div class="col">
<h1>{{ $currentYear }} incomes</h1>
</div>
</div>
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">
<div class="header-block">
{{ $currentYear }} incomes
<ul class="nav nav-tabs card-header-tabs pull-right">
@foreach ($years as $year)
<li class="nav-item">
<a class="nav-link @if($year->year == $currentYear) active @endif" href="{{ route('incomes.index', ['year' => $year->year]) }}">{{ $year->year }}</a>
</li>
@endforeach
</ul>
</div>
</div>
<div class="card-body">
@each('macope::partials.billing', $incomes, 'typeCategory')
</div>
</div>
</div>
</div>
</div>
@endsection
File renamed without changes.
80 changes: 80 additions & 0 deletions resources/views/journal/index.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
@extends('layouts.app')

@section('content')
<div class="container-fluid">
<div class="row">
<div class="col">
<h1>Journal</h1>
</div>
</div>
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">
<div class="header-block">
Journal
</div>
</div>
<div class="card-body">
@include('macope::helpers.form-message')
<table class="table table-bordered table-condensed" id="journal-table">
<thead>
<tr>
<th>Date</th>
<th>Text</th>
<th>Category</th>
<th>Credit</th>
<th>Debit</th>
<th></th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
@endsection

@push('scripts')
<script>
$(function() {
$('#journal-table').DataTable({
order: [[0, 'desc']],
pageLength: 25,
columns: [
{data: 'date', type: 'date'},
{data: 'text'},
{data: 'category'},
{data: 'credit'},
{data: 'debit'},
{data: 'id'},
],
columnDefs: [
{
render: function (data, type, row) {
if (!data) {
return '';
}
return data.name + ' (' + data.type_category.name + ')';
},
targets: 2
},
{
orderable: false,
render: function (data, type, row) {
return '<a href="' + window.location.pathname + '/' + data + '/edit" title="Edit"><i class="fa fa-pencil"></i></a>';
},
targets: 5
}
],
processing: true,
deferRender: true,
ajax: window.location.pathname,
stateSave: true
});
});
</script>
@endpush
39 changes: 39 additions & 0 deletions resources/views/partials/billing.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<div class="d-flex">
<h2>{{ $typeCategory['type_category']->name }}</h2>

<div class="ml-auto">
<a href="{{ route('type-categories.show', $typeCategory['type_category']->id) }}" title="View details">
<i class="fa fa-eye"></i>
</a>
</div>
</div>

<table class="table table-bordered table-condensed">
<thead>
<tr>
<th></th>
<th>Jan.</th>
<th>Feb.</th>
<th>Mar.</th>
<th>Apr.</th>
<th>May</th>
<th>Jun.</th>
<th>Jul.</th>
<th>Aug.</th>
<th>Sep.</th>
<th>Oct.</th>
<th>Nov.</th>
<th>Dec.</th>
</tr>
</thead>
<tbody>
@foreach ($typeCategory['categories'] as $category)
<tr>
<td>{{ $category['category']->name }}</td>
@foreach ($category['months'] as $month => $amount)
<td>{{ $amount }}</td>
@endforeach
</tr>
@endforeach
</tbody>
</table>
14 changes: 5 additions & 9 deletions src/routes/web.php → routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
Route::group(
[
'prefix' => config('macope.route_prefix'),
'namespace' => 'Gallib\Macope\App\Http\Controllers',
'middleware' => ['web']
'namespace' => 'Gallib\Macope\Http\Controllers',
'middleware' => ['web'],
],
function() {
function () {
Route::get('/', 'DashboardController@index')->name('dashboard.index');

Route::get('/expenses/{year?}', 'ExpenseController@index')
Expand All @@ -16,9 +16,8 @@ function() {
Route::post('/expenses-sum-by-month', 'ExpenseController@sumByMonth')
->name('expenses.sumbymonth');

Route::post('/expenses-by-type-category/{months?}', 'ExpenseController@expensesByTypeCategory')
->name('expenses.by-type-category')
->where('months', '[0-9]+');
Route::post('/expenses-by-type-category', 'ExpenseController@expensesByTypeCategory')
->name('expenses.by-type-category');

Route::get('/incomes/{year?}', 'IncomeController@index')
->name('incomes.index')
Expand All @@ -33,9 +32,6 @@ function() {

Route::resource('/journal', 'JournalController');

Route::post('/journal', 'JournalController@filter')
->name('journal.filter');

Route::post('/journal/sum-by-month', 'JournalController@sumByMonth')
->name('journal.sumbymonth');

Expand Down
6 changes: 3 additions & 3 deletions src/app/Account.php → src/Account.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Gallib\Macope\App;
namespace Gallib\Macope;

use Illuminate\Database\Eloquent\Model;

Expand All @@ -16,11 +16,11 @@ class Account extends Model
'description',
'account_number',
'iban',
'currency'
'currency',
];

/**
* Define the one-to-many relationship with JournalEntry
* Define the one-to-many relationship with JournalEntry.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
Expand Down
25 changes: 17 additions & 8 deletions src/app/Categorization.php → src/Categorization.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Gallib\Macope\App;
namespace Gallib\Macope;

use Illuminate\Database\Eloquent\Model;

Expand All @@ -16,31 +16,40 @@ class Categorization extends Model
'search_type',
'entry_type',
'amount',
'category_id'
'category_id',
];

/**
* The search types values
* The relations to eager load on every query.
*
* @var array
*/
protected $with = [
'category',
];

/**
* The search types values.
*
* @var array
*/
protected $searchTypes = [
'contains',
'match'
'match',
];

/**
* The entry types values
* The entry types values.
*
* @var array
*/
protected $entryTypes = [
'debit',
'credit'
'credit',
];

/**
* Getter for search types
* Getter for search types.
*
* @return array
*/
Expand All @@ -50,7 +59,7 @@ public function getSearchTypes()
}

/**
* Getter for entry types
* Getter for entry types.
*
* @return array
*/
Expand Down
Loading

0 comments on commit 9b62a86

Please sign in to comment.