mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 10:33:30 +00:00
Last updates, fixes the main list.
This commit is contained in:
@@ -166,6 +166,16 @@ class TransactionJournal extends Model
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $value
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDestinationAccountNameAttribute($value)
|
||||||
|
{
|
||||||
|
return Crypt::decrypt($value);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param string $fieldName
|
* @param string $fieldName
|
||||||
@@ -183,6 +193,16 @@ class TransactionJournal extends Model
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $value
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getSourceAccountNameAttribute($value)
|
||||||
|
{
|
||||||
|
return Crypt::decrypt($value);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
@@ -319,6 +339,8 @@ class TransactionJournal extends Model
|
|||||||
// join destination account type
|
// join destination account type
|
||||||
$query->leftJoin('account_types as source_acct_type', 'source_account.account_type_id', '=', 'source_acct_type.id');
|
$query->leftJoin('account_types as source_acct_type', 'source_account.account_type_id', '=', 'source_acct_type.id');
|
||||||
|
|
||||||
|
$query->with(['categories', 'budgets', 'attachments', 'bill']);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,9 +352,6 @@ class TransactionJournal extends Model
|
|||||||
*/
|
*/
|
||||||
public function scopeTransactionTypes(EloquentBuilder $query, array $types)
|
public function scopeTransactionTypes(EloquentBuilder $query, array $types)
|
||||||
{
|
{
|
||||||
$query->leftJoin(
|
|
||||||
'transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id'
|
|
||||||
);
|
|
||||||
$query->whereIn('transaction_types.type', $types);
|
$query->whereIn('transaction_types.type', $types);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -118,14 +118,20 @@ class JournalRepository implements JournalRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function getJournalsOfTypes(array $types, int $offset, int $page, int $pagesize = 50)
|
public function getJournalsOfTypes(array $types, int $offset, int $page, int $pagesize = 50)
|
||||||
{
|
{
|
||||||
$set = Auth::user()->transactionJournals()->transactionTypes($types)->withRelevantData()->take($pagesize)->offset($offset)
|
$set = Auth::user()
|
||||||
->orderBy('date', 'DESC')
|
->transactionJournals()
|
||||||
->orderBy('order', 'ASC')
|
->expanded()
|
||||||
->orderBy('id', 'DESC')
|
->transactionTypes($types)
|
||||||
->get(
|
->take($pagesize)
|
||||||
['transaction_journals.*']
|
->offset($offset)
|
||||||
);
|
->orderBy('date', 'DESC')
|
||||||
$count = Auth::user()->transactionJournals()->transactionTypes($types)->count();
|
->orderBy('order', 'ASC')
|
||||||
|
->orderBy('id', 'DESC')
|
||||||
|
->get(TransactionJournal::QUERYFIELDS);
|
||||||
|
|
||||||
|
$count = Auth::user()->transactionJournals()
|
||||||
|
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
|
||||||
|
->transactionTypes($types)->count();
|
||||||
$journals = new LengthAwarePaginator($set, $count, $pagesize, $page);
|
$journals = new LengthAwarePaginator($set, $count, $pagesize, $page);
|
||||||
|
|
||||||
return $journals;
|
return $journals;
|
||||||
|
@@ -28,90 +28,77 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{% set _sum = 0 %}
|
{% set _sum = 0 %}
|
||||||
{% for journal in journals %}
|
{% for journal in journals %}
|
||||||
{% if invalidJournal(journal) %}
|
{% set _sum = _sum + journal.amount %}
|
||||||
<tr class="ignore">
|
<tr class="drag" data-date="{{ journal.date.format('Y-m-d') }}" data-id="{{ journal.id }}">
|
||||||
<td>
|
<td class="hidden-xs">
|
||||||
<div class="btn-group btn-group-xs">
|
<div class="btn-group btn-group-xs">
|
||||||
<a href="{{ route("transactions.delete",journal.id) }}" class="btn btn-xs btn-danger"><i class="fa fa-fw fa-trash-o"></i></a>
|
{% if sorting %}
|
||||||
</div>
|
<a href="#" class="handle btn btn-default btn-xs"><i class="fa fa-fw fa-arrows-v"></i></a>
|
||||||
</td>
|
|
||||||
<td> </td>
|
|
||||||
<td>{{ journal.description }}</td>
|
|
||||||
<td colspan="7"><em>Invalid journal: Found {{ journal.transactions|length }} transaction(s)</em></td>
|
|
||||||
</tr>
|
|
||||||
{% else %}
|
|
||||||
{% set _sum = _sum + journal.amount %}
|
|
||||||
<tr class="drag" data-date="{{ journal.date.format('Y-m-d') }}" data-id="{{ journal.id }}">
|
|
||||||
<td class="hidden-xs">
|
|
||||||
<div class="btn-group btn-group-xs">
|
|
||||||
{% if sorting %}
|
|
||||||
<a href="#" class="handle btn btn-default btn-xs"><i class="fa fa-fw fa-arrows-v"></i></a>
|
|
||||||
{% endif %}
|
|
||||||
<a href="{{ route('transactions.edit',journal.id) }}" class="btn btn-xs btn-default"><i class="fa fa-fw fa-pencil"></i></a>
|
|
||||||
<a href="{{ route('transactions.delete',journal.id) }}" class="btn btn-xs btn-danger"><i class="fa fa-fw fa-trash-o"></i></a>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td class="hidden-xs">
|
|
||||||
{{ journal|typeIcon }}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="{{ route('transactions.show',journal.id) }}" title="{{ journal.description }}">{{ journal.description }}</a>
|
|
||||||
{% if journal.attachments|length > 0 %}
|
|
||||||
<i class="fa fa-paperclip pull-right"
|
|
||||||
title="{{ Lang.choice('firefly.nr_of_attachments', journal.attachments|length, {count: journal.attachments|length}) }}"></i>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<a href="{{ route('transactions.edit',journal.id) }}" class="btn btn-xs btn-default"><i class="fa fa-fw fa-pencil"></i></a>
|
||||||
|
<a href="{{ route('transactions.delete',journal.id) }}" class="btn btn-xs btn-danger"><i class="fa fa-fw fa-trash-o"></i></a>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
</td>
|
<td class="hidden-xs">
|
||||||
<td>
|
{{ journal|typeIcon }}
|
||||||
{{ journal|formatJournal }}
|
</td>
|
||||||
</td>
|
<td>
|
||||||
<td class="hidden-sm hidden-xs">
|
<a href="{{ route('transactions.show',journal.id) }}" title="{{ journal.description }}">{{ journal.description }}</a>
|
||||||
{{ journal.date.formatLocalized(monthAndDayFormat) }}
|
{% if journal.attachments|length > 0 %}
|
||||||
</td>
|
<i class="fa fa-paperclip pull-right"
|
||||||
<td class="hidden-xs">
|
title="{{ Lang.choice('firefly.nr_of_attachments', journal.attachments|length, {count: journal.attachments|length}) }}"></i>
|
||||||
{% if journal.source_account.accountType.type == 'Cash account' %}
|
|
||||||
<span class="text-success">(cash)</span>
|
|
||||||
{% else %}
|
|
||||||
<a href="{{ route('accounts.show',journal.source_account.id) }}">{{ journal.source_account.name }}</a>
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
<td class="hidden-xs">
|
|
||||||
{% if journal.destination_account.accountType.type == 'Cash account' %}
|
|
||||||
<span class="text-success">(cash)</span>
|
|
||||||
{% else %}
|
|
||||||
<a href="{{ route('accounts.show',journal.destination_account.id) }}">{{ journal.destination_account.name }}</a>
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<!-- Do NOT hide the budget? -->
|
|
||||||
{% if not hideBudgets %}
|
|
||||||
<td class="hidden-xs">
|
|
||||||
{% if journal.budgets[0] %}
|
|
||||||
<a href="{{ route('budgets.show',journal.budgets[0].id) }}">{{ journal.budgets[0].name }}</a>
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Do NOT hide the category? -->
|
</td>
|
||||||
{% if not hideCategories %}
|
<td>
|
||||||
<td class="hidden-xs">
|
{{ journal|formatJournal }}
|
||||||
{% if journal.categories[0] %}
|
</td>
|
||||||
<a href="{{ route('categories.show',journal.categories[0].id) }}">{{ journal.categories[0].name }}</a>
|
<td class="hidden-sm hidden-xs">
|
||||||
{% endif %}
|
{{ journal.date.formatLocalized(monthAndDayFormat) }}
|
||||||
</td>
|
</td>
|
||||||
|
<td class="hidden-xs">
|
||||||
|
{% if journal.source_account_type == 'Cash account' %}
|
||||||
|
<span class="text-success">(cash)</span>
|
||||||
|
{% else %}
|
||||||
|
<a href="{{ route('accounts.show',journal.source_account_id) }}">{{ journal.source_account_name }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td class="hidden-xs">
|
||||||
|
{% if journal.destination_account_type == 'Cash account' %}
|
||||||
|
<span class="text-success">(cash)</span>
|
||||||
|
{% else %}
|
||||||
|
<a href="{{ route('accounts.show',journal.destination_account_id) }}">{{ journal.destination_account_name }}</a>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
|
||||||
<!-- Do NOT hide the bill? -->
|
<!-- Do NOT hide the budget? -->
|
||||||
{% if not hideBills %}
|
{% if not hideBudgets %}
|
||||||
<td class="hidden-xs">
|
<td class="hidden-xs">
|
||||||
{% if journal.bill %}
|
{% if journal.budgets[0] %}
|
||||||
<a href="{{ route('bills.show',journal.bill_id) }}">{{ journal.bill.name }}</a>
|
<a href="{{ route('budgets.show',journal.budgets[0].id) }}">{{ journal.budgets[0].name }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
|
||||||
{% endif %}
|
<!-- Do NOT hide the category? -->
|
||||||
|
{% if not hideCategories %}
|
||||||
|
<td class="hidden-xs">
|
||||||
|
{% if journal.categories[0] %}
|
||||||
|
<a href="{{ route('categories.show',journal.categories[0].id) }}">{{ journal.categories[0].name }}</a>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<!-- Do NOT hide the bill? -->
|
||||||
|
{% if not hideBills %}
|
||||||
|
<td class="hidden-xs">
|
||||||
|
{% if journal.bill %}
|
||||||
|
<a href="{{ route('bills.show',journal.bill_id) }}">{{ journal.bill.name }}</a>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
|
Reference in New Issue
Block a user