mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	Delete routine [skip ci]
This commit is contained in:
		| @@ -46,7 +46,7 @@ class BudgetController extends BaseController | ||||
|                 } | ||||
|                 krsort($reps); | ||||
|  | ||||
|                 return View::make('budgets.index')->with('group', $group)->with('reps',$reps); | ||||
|                 return View::make('budgets.index')->with('group', $group)->with('reps', $reps); | ||||
|  | ||||
|  | ||||
|                 break; | ||||
| @@ -133,4 +133,5 @@ class BudgetController extends BaseController | ||||
|  | ||||
|     } | ||||
|  | ||||
|  | ||||
| }  | ||||
| @@ -46,4 +46,30 @@ class LimitController extends BaseController | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public function delete($limitId) | ||||
|     { | ||||
|         $limit = $this->_limits->find($limitId); | ||||
|  | ||||
|  | ||||
|         if ($limit) { | ||||
|             return View::make('limits.delete')->with('limit', $limit); | ||||
|         } else { | ||||
|             return View::make('error')->with('message', 'No such limit!'); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public function destroy($limitId) | ||||
|     { | ||||
|         $limit = $this->_limits->find($limitId); | ||||
|  | ||||
|  | ||||
|         if ($limit) { | ||||
|             $limit->delete(); | ||||
|             return Redirect::route('budgets.index'); | ||||
|         } else { | ||||
|             return View::make('error')->with('message', 'No such limit!'); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|  | ||||
| }  | ||||
| @@ -15,7 +15,7 @@ class EloquentLimitRepository implements LimitRepositoryInterface | ||||
|     public function find($limitId) | ||||
|     { | ||||
|         return \Limit::with('limitrepetitions')->where('limits.id', $limitId)->leftJoin('components', 'components.id', '=', 'limits.component_id') | ||||
|             ->where('components.user_id', \Auth::user()->id)->first(); | ||||
|             ->where('components.user_id', \Auth::user()->id)->first(['limits.*']); | ||||
|     } | ||||
|  | ||||
|     public function store($data) | ||||
|   | ||||
| @@ -41,10 +41,7 @@ Route::group(['before' => 'auth'], function () { | ||||
|  | ||||
|  | ||||
|         // transaction controller: | ||||
|           Route::get('/transactions/create/{what}', ['uses' => 'TransactionController@create', 'as' => 'transactions.create']) | ||||
|             ->where(['what' => 'withdrawal|deposit|transfer']); | ||||
|  | ||||
|  | ||||
|           Route::get('/transactions/create/{what}', ['uses' => 'TransactionController@create', 'as' => 'transactions.create'])->where(['what' => 'withdrawal|deposit|transfer']); | ||||
|         Route::get('/transaction/show/{id}',['uses' => 'TransactionController@show','as' => 'transactions.show']); | ||||
|         Route::get('/transaction/edit/{id}',['uses' => 'TransactionController@edit','as' => 'transactions.edit']); | ||||
|         Route::get('/transaction/delete/{id}',['uses' => 'TransactionController@delete','as' => 'transactions.delete']); | ||||
| @@ -73,6 +70,7 @@ Route::group(['before' => 'csrf|auth'], function () { | ||||
|  | ||||
|         // limit controller: | ||||
|         Route::post('/limits/store', ['uses' => 'LimitController@store', 'as' => 'budgets.limits.store']); | ||||
|         Route::post('/budgets/limits/destroy/{id?}',['uses' => 'LimitController@destroy','as' => 'budgets.limits.destroy']); | ||||
|  | ||||
|         // transaction controller: | ||||
|         Route::post('/transactions/store/{what}', ['uses' => 'TransactionController@store', 'as' => 'transactions.store']) | ||||
|   | ||||
							
								
								
									
										39
									
								
								app/views/limits/delete.blade.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								app/views/limits/delete.blade.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,39 @@ | ||||
| @extends('layouts.default') | ||||
| @section('content') | ||||
| <div class="row"> | ||||
|     <div class="col-lg-12 col-md-12 col-sm-12"> | ||||
|         <h1>Firefly | ||||
|             <small>Delete limit</small> | ||||
|         </h1> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| {{Form::open(['class' => 'form-horizontal','url' => route('budgets.limits.destroy',$limit->id)])}} | ||||
|  | ||||
| <div class="row"> | ||||
|     <div class="col-lg-12"> | ||||
|         <p class="text-info"> | ||||
|             Destroying a limit (an envelope) does not remove any transactions from the budget. | ||||
|         </p> | ||||
|         <p class="text-danger"> | ||||
|             Are you sure? | ||||
|         </p> | ||||
|  | ||||
|         <div class="form-group"> | ||||
|             <div class="col-sm-8"> | ||||
|                 <input type="submit" name="submit" value="Remove limit" class="btn btn-danger" /> | ||||
|             </div> | ||||
|         </div> | ||||
|  | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
|  | ||||
| {{Form::open()}} | ||||
|  | ||||
|  | ||||
| @stop | ||||
| @section('scripts') | ||||
| <script type="text/javascript" src="assets/javascript/moment.min.js"></script> | ||||
| <script type="text/javascript" src="assets/javascript/limits.js"></script> | ||||
| @stop | ||||
		Reference in New Issue
	
	Block a user