Navigation Menu

Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
JC5 committed Aug 20, 2021
1 parent 83518d7 commit 14cdce1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
9 changes: 7 additions & 2 deletions public/v1/js/ff/budgets/index.js
Expand Up @@ -133,7 +133,7 @@ function updateTotalBudgetedAmount(currencyId) {
});

// get new amount:
$.get(totalBudgetedUri.replace('REPLACEME',currencyId)).done(function (data) {
$.get(totalBudgetedUri.replace('REPLACEME', currencyId)).done(function (data) {
// set thing:
$('span.budgeted_amount[data-currency="' + currencyId + '"]')
.html(data.budgeted_formatted)
Expand Down Expand Up @@ -207,9 +207,14 @@ function createBudgetLimit(e) {
}

function deleteBudgetLimit(e) {
e.preventDefault();
var button = $(e.currentTarget);
var budgetLimitId = button.data('budget-limit-id');
var url = deleteBudgetLimitUrl.replace('REPLACEME', budgetId.toString();
var url = deleteBudgetLimitUrl.replace('REPLACEME', budgetLimitId.toString());
$.post(url, {_token: token}).then(function () {
$('.bl_entry[data-budget-limit-id="' + budgetLimitId + '"]').remove();

});
return false;
}

Expand Down
7 changes: 5 additions & 2 deletions resources/views/v1/budgets/index.twig
Expand Up @@ -285,7 +285,7 @@
{{ trans('firefly.budget_limit_not_in_range', {start: budgetLimit.start_date, end: budgetLimit.end_date}) }}
</small><br>
{% endif %}
<div class="input-group">
<div class="input-group bl_entry" data-budget-limit-id="{{ budgetLimit.id }}">
<div class="input-group-addon">{{ budgetLimit.currency_symbol }}</div>
<input class="form-control budget_amount" data-original="{{ budgetLimit.amount }}"
data-id="{{ budget.id }}" data-limit="{{ budgetLimit.id }}" value="{{ budgetLimit.amount }}"
Expand All @@ -295,7 +295,9 @@
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false"><span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href="{{ route('budget-limits.delete', [budgetLimit.id]) }}">{{ trans('firefly.remove_budgeted_amount', {currency: budgetLimit.currency_name }) }}</a></li>
<li>
<a class="delete_bl" href="#" data-budget-limit-id="{{ budgetLimit.id }}">{{ trans('firefly.remove_budgeted_amount', {currency: budgetLimit.currency_name }) }}</a>
</li>
</ul>
</div>
</div>
Expand Down Expand Up @@ -468,6 +470,7 @@
var createBudgetLimitUri = "{{ route('budget-limits.create', ['REPLACEME', start.format('Y-m-d'), end.format('Y-m-d')]) }}";
var storeBudgetLimitUri = "{{ route('budget-limits.store') }}";
var updateBudgetLimitUri = "{{ route('budget-limits.update', ['REPLACEME']) }}";
var deleteBudgetLimitUrl = "{{ route('budget-limits.delete', ['REPLACEME']) }}";
var totalBudgetedUri = "{{ route('json.budget.total-budgeted', ['REPLACEME', start.format('Y-m-d'), end.format('Y-m-d')]) }}";
// period thing:
Expand Down
2 changes: 1 addition & 1 deletion routes/web.php
Expand Up @@ -282,7 +282,7 @@ static function () {
Route::get('create/{budget}/{start_date}/{end_date}', ['uses' => 'Budget\BudgetLimitController@create', 'as' => 'create']);
Route::post('store', ['uses' => 'Budget\BudgetLimitController@store', 'as' => 'store']);

Route::get('delete/{budgetLimit}', ['uses' => 'Budget\BudgetLimitController@delete', 'as' => 'delete']);
Route::post('delete/{budgetLimit}', ['uses' => 'Budget\BudgetLimitController@delete', 'as' => 'delete']);

Route::post('update/{budgetLimit}', ['uses' => 'Budget\BudgetLimitController@update', 'as' => 'update']);
}
Expand Down

0 comments on commit 14cdce1

Please sign in to comment.