@@ -152,11 +152,12 @@ public function getCreate()
152152 $ model_list = array ('' => '' ) + Model::orderBy ('name ' , 'asc ' )->lists ('name ' , 'id ' );
153153 $ supplier_list = array ('' => '' ) + Supplier::orderBy ('name ' , 'asc ' )->lists ('name ' , 'id ' );
154154 $ assigned_to = array ('' => 'Select a User ' ) + DB ::table ('users ' )->select (DB ::raw ('concat (first_name," ",last_name) as full_name, id ' ))->whereNull ('deleted_at ' )->lists ('full_name ' , 'id ' );
155+ $ location_list = array ('' => '' ) + Location::lists ('name ' , 'id ' );
155156
156157 // Grab the dropdown list of status
157158 $ statuslabel_list = array ('' => Lang::get ('general.pending ' )) + array ('0 ' => Lang::get ('general.ready_to_deploy ' )) + Statuslabel::orderBy ('name ' , 'asc ' )->lists ('name ' , 'id ' );
158159
159- return View::make ('backend/hardware/edit ' )->with ('supplier_list ' ,$ supplier_list )->with ('model_list ' ,$ model_list )->with ('statuslabel_list ' ,$ statuslabel_list )->with ('assigned_to ' ,$ assigned_to )->with ('asset ' ,new Asset );
160+ return View::make ('backend/hardware/edit ' )->with ('supplier_list ' ,$ supplier_list )->with ('model_list ' ,$ model_list )->with ('statuslabel_list ' ,$ statuslabel_list )->with ('assigned_to ' ,$ assigned_to )->with ('location_list ' , $ location_list )-> with ( ' asset ' ,new Asset );
160161
161162 }
162163
@@ -170,13 +171,13 @@ public function postCreate()
170171 {
171172 // create a new model instance
172173 $ asset = new Asset ();
173-
174+
174175 //attempt to validate
175176 $ validator = Validator::make (Input::all (), $ asset ->validationRules ());
176177
177178 if ($ validator ->fails ())
178179 {
179- // The given data did not pass validation
180+ // The given data did not pass validation
180181 return Redirect::back ()->withInput ()->withErrors ($ validator ->messages ());
181182 }
182183 // attempt validation
@@ -211,7 +212,7 @@ public function postCreate()
211212 } else {
212213 $ asset ->assigned_to = e (Input::get ('assigned_to ' ));
213214 }
214-
215+
215216 if (e (Input::get ('supplier_id ' )) == '' ) {
216217 $ asset ->supplier_id = 0 ;
217218 } else {
@@ -231,7 +232,8 @@ public function postCreate()
231232 $ asset ->order_number = e (Input::get ('order_number ' ));
232233 $ asset ->notes = e (Input::get ('notes ' ));
233234 $ asset ->asset_tag = e (Input::get ('asset_tag ' ));
234-
235+ $ asset ->rtd_location_id = e (Input::get ('rtd_location_id ' ));
236+
235237 $ asset ->user_id = Sentry::getId ();
236238 $ asset ->archived = '0 ' ;
237239 $ asset ->physical = '1 ' ;
@@ -242,7 +244,7 @@ public function postCreate()
242244 // Redirect to the asset listing page
243245 return Redirect::to ("hardware " )->with ('success ' , Lang::get ('admin/hardware/message.create.success ' ));
244246 }
245- }
247+ }
246248
247249 // Redirect to the asset create page with an error
248250 return Redirect::to ('assets/create ' )->with ('error ' , Lang::get ('admin/hardware/message.create.error ' ));
@@ -264,14 +266,16 @@ public function getEdit($assetId = null)
264266 return Redirect::to ('hardware ' )->with ('error ' , Lang::get ('admin/hardware/message.does_not_exist ' ));
265267 }
266268
269+
267270 // Grab the dropdown list of models
268271 $ model_list = array ('' => '' ) + Model::orderBy ('name ' , 'asc ' )->lists ('name ' , 'id ' );
269272 $ supplier_list = array ('' => '' ) + Supplier::orderBy ('name ' , 'asc ' )->lists ('name ' , 'id ' );
273+ $ location_list = array ('' => '' ) + Location::lists ('name ' , 'id ' );
270274
271275 // Grab the dropdown list of status
272276 $ statuslabel_list = array ('' => Lang::get ('general.pending ' )) + array ('0 ' => Lang::get ('general.ready_to_deploy ' )) + Statuslabel::orderBy ('name ' , 'asc ' )->lists ('name ' , 'id ' );
273277
274- return View::make ('backend/hardware/edit ' , compact ('asset ' ))->with ('model_list ' ,$ model_list )->with ('supplier_list ' ,$ supplier_list )->with ('statuslabel_list ' ,$ statuslabel_list );
278+ return View::make ('backend/hardware/edit ' , compact ('asset ' ))->with ('model_list ' ,$ model_list )->with ('supplier_list ' ,$ supplier_list )->with ('location_list ' , $ location_list )-> with ( ' statuslabel_list ' ,$ statuslabel_list );
275279 }
276280
277281
@@ -287,14 +291,14 @@ public function postEdit($assetId = null)
287291 if (is_null ($ asset = Asset::find ($ assetId ))) {
288292 // Redirect to the asset management page with error
289293 return Redirect::to ('hardware ' )->with ('error ' , Lang::get ('admin/hardware/message.does_not_exist ' ));
290- }
291-
294+ }
295+
292296 //attempt to validate
293297 $ validator = Validator::make (Input::all (), $ asset ->validationRules ($ assetId ));
294298
295299 if ($ validator ->fails ())
296300 {
297- // The given data did not pass validation
301+ // The given data did not pass validation
298302 return Redirect::back ()->withInput ()->withErrors ($ validator ->messages ());
299303 }
300304 // attempt validation
@@ -330,7 +334,7 @@ public function postEdit($assetId = null)
330334 } else {
331335 $ asset ->supplier_id = e (Input::get ('supplier_id ' ));
332336 }
333-
337+
334338 if (e (Input::get ('requestable ' )) == '' ) {
335339 $ asset ->requestable = 0 ;
336340 } else {
@@ -343,8 +347,9 @@ public function postEdit($assetId = null)
343347 $ asset ->model_id = e (Input::get ('model_id ' ));
344348 $ asset ->order_number = e (Input::get ('order_number ' ));
345349 $ asset ->asset_tag = e (Input::get ('asset_tag ' ));
346- $ asset ->notes = e (Input::get ('notes ' ));
350+ $ asset ->notes = e (Input::get ('notes ' ));
347351 $ asset ->physical = '1 ' ;
352+ $ asset ->rtd_location_id = e (Input::get ('rtd_location_id ' ));
348353
349354 // Was the asset updated?
350355 if ($ asset ->save ()) {
@@ -355,7 +360,7 @@ public function postEdit($assetId = null)
355360 {
356361 return Redirect::to ('hardware ' )->with ('error ' , Lang::get ('admin/hardware/message.does_not_exist ' ));
357362 }
358- }
363+ }
359364
360365
361366 // Redirect to the asset management page with error
@@ -406,7 +411,6 @@ public function getCheckout($assetId)
406411 // Get the dropdown of users and then pass it to the checkout view
407412 $ users_list = array ('' => 'Select a User ' ) + DB ::table ('users ' )->select (DB ::raw ('concat(first_name," ",last_name) as full_name, id ' ))->whereNull ('deleted_at ' )->orderBy ('last_name ' , 'asc ' )->orderBy ('first_name ' , 'asc ' )->lists ('full_name ' , 'id ' );
408413
409- //print_r($users);
410414 return View::make ('backend/hardware/checkout ' , compact ('asset ' ))->with ('users_list ' ,$ users_list );
411415
412416 }
@@ -617,6 +621,8 @@ public function getClone($assetId = null)
617621 // Grab the dropdown list of status
618622 $ statuslabel_list = array ('' => 'Pending ' ) + array ('0 ' => 'Ready to Deploy ' ) + Statuslabel::lists ('name ' , 'id ' );
619623
624+ $ location_list = array ('' => '' ) + Location::lists ('name ' , 'id ' );
625+
620626 // get depreciation list
621627 $ depreciation_list = array ('' => '' ) + Depreciation::lists ('name ' , 'id ' );
622628 $ supplier_list = array ('' => '' ) + Supplier::orderBy ('name ' , 'asc ' )->lists ('name ' , 'id ' );
@@ -625,7 +631,7 @@ public function getClone($assetId = null)
625631 $ asset = clone $ asset_to_clone ;
626632 $ asset ->id = null ;
627633 $ asset ->asset_tag = '' ;
628- return View::make ('backend/hardware/edit ' )->with ('supplier_list ' ,$ supplier_list )->with ('model_list ' ,$ model_list )->with ('statuslabel_list ' ,$ statuslabel_list )->with ('assigned_to ' ,$ assigned_to )->with ('asset ' ,$ asset );
634+ return View::make ('backend/hardware/edit ' )->with ('supplier_list ' ,$ supplier_list )->with ('model_list ' ,$ model_list )->with ('statuslabel_list ' ,$ statuslabel_list )->with ('assigned_to ' ,$ assigned_to )->with ('asset ' ,$ asset )-> with ( ' location_list ' , $ location_list ) ;
629635
630636 }
631637}
0 commit comments