diff --git a/app/controllers/admin/LocationsController.php b/app/controllers/admin/LocationsController.php index a788205b50..4bb3716f5f 100644 --- a/app/controllers/admin/LocationsController.php +++ b/app/controllers/admin/LocationsController.php @@ -63,6 +63,8 @@ class LocationsController extends AdminController { // Save the location data $location->name = e(Input::get('name')); + $location->address = e(Input::get('address')); + $location->address2 = e(Input::get('address2')); $location->city = e(Input::get('city')); $location->state = e(Input::get('state')); $location->country = e(Input::get('country')); @@ -139,6 +141,8 @@ class LocationsController extends AdminController { // Update the location data $location->name = e(Input::get('name')); + $location->address = e(Input::get('address')); + $location->address2 = e(Input::get('address2')); $location->city = e(Input::get('city')); $location->state = e(Input::get('state')); $location->country = e(Input::get('country')); diff --git a/app/controllers/admin/ModelsController.php b/app/controllers/admin/ModelsController.php index 1dea8dd9f9..038c104bfc 100644 --- a/app/controllers/admin/ModelsController.php +++ b/app/controllers/admin/ModelsController.php @@ -9,6 +9,7 @@ use Setting; use Sentry; use DB; use Depreciation; +use Manufacturer; use Str; use Validator; use View; @@ -38,8 +39,14 @@ class ModelsController extends AdminController { { // Show the page $depreciation_list = array('' => 'Do Not Depreciate') + Depreciation::lists('name', 'id'); + $manufacturer_list = array('' => 'Select One') + Manufacturer::lists('name', 'id'); $category_list = array('' => '') + DB::table('categories')->lists('name', 'id'); - return View::make('backend/models/edit')->with('category_list',$category_list)->with('depreciation_list',$depreciation_list)->with('model',new Model); + $view = View::make('backend/models/edit'); + $view->with('category_list',$category_list); + $view->with('depreciation_list',$depreciation_list); + $view->with('manufacturer_list',$manufacturer_list); + $view->with('model',new Model); + return $view; } @@ -65,6 +72,7 @@ class ModelsController extends AdminController { $model->name = e(Input::get('name')); $model->modelno = e(Input::get('modelno')); $model->depreciation_id = e(Input::get('depreciation_id')); + $model->manufacturer_id = e(Input::get('manufacturer_id')); $model->category_id = e(Input::get('category_id')); $model->user_id = Sentry::getId(); @@ -99,13 +107,18 @@ class ModelsController extends AdminController { // Check if the model exists if (is_null($model = Model::find($modelId))) { - // Redirect to the blogs management page + // Redirect to the model management page return Redirect::to('assets/models')->with('error', Lang::get('admin/models/message.does_not_exist')); } $depreciation_list = array('' => 'Do Not Depreciate') + Depreciation::lists('name', 'id'); + $manufacturer_list = array('' => 'Select One') + Manufacturer::lists('name', 'id'); $category_list = array('' => '') + DB::table('categories')->lists('name', 'id'); - return View::make('backend/models/edit', compact('model'))->with('category_list',$category_list)->with('depreciation_list',$depreciation_list); + $view = View::make('backend/models/edit', compact('model')); + $view->with('category_list',$category_list); + $view->with('depreciation_list',$depreciation_list); + $view->with('manufacturer_list',$manufacturer_list); + return $view; } @@ -135,6 +148,7 @@ class ModelsController extends AdminController { $model->name = e(Input::get('name')); $model->modelno = e(Input::get('modelno')); $model->depreciation_id = e(Input::get('depreciation_id')); + $model->manufacturer_id = e(Input::get('manufacturer_id')); $model->category_id = e(Input::get('category_id')); @@ -183,9 +197,6 @@ class ModelsController extends AdminController { // Redirect to the models management page return Redirect::to('assets/models')->with('success', Lang::get('admin/models/message.delete.success')); } - - - } @@ -213,5 +224,4 @@ class ModelsController extends AdminController { } - } diff --git a/app/models/Asset.php b/app/models/Asset.php index 8d90d42702..2b8b1ac562 100644 --- a/app/models/Asset.php +++ b/app/models/Asset.php @@ -145,5 +145,9 @@ class Asset extends Elegant { return $this->belongsTo('Depreciation','id'); } + public function model() + { + return $this->belongsTo('Model','model_id'); + } } diff --git a/app/models/Location.php b/app/models/Location.php index 22e55e4b12..922207ce21 100644 --- a/app/models/Location.php +++ b/app/models/Location.php @@ -7,10 +7,12 @@ class Location extends Elegant { protected $table = 'locations'; protected $rules = array( 'name' => 'required|alpha_space|min:3', + 'address' => 'required|alpha_space|min:5', + 'address2' => 'alpha_space|min:5', 'city' => 'required|alpha_space|min:3', 'state' => 'required|alpha|min:2|max:2', 'country' => 'required|alpha|min:2|max:2', - 'zip' => 'alpha_dash|min:5', + 'zip' => 'alpha_dash|min:5', ); public function has_users() diff --git a/app/validators.php b/app/validators.php index 2232752018..046eebd898 100644 --- a/app/validators.php +++ b/app/validators.php @@ -2,5 +2,5 @@ Validator::extend('alpha_space', function($attribute,$value,$parameters) { - return preg_match("/^[-_,!. a-zA-Z0-9]+$/",$value); + return preg_match("/^[-+_,!. a-zA-Z0-9]+$/",$value); }); diff --git a/app/views/backend/assets/view.blade.php b/app/views/backend/assets/view.blade.php index b6aafe1a20..d11b90dfbd 100644 --- a/app/views/backend/assets/view.blade.php +++ b/app/views/backend/assets/view.blade.php @@ -105,6 +105,14 @@ View Asset {{ $asset->asset_tag }} ::
| @lang('admin/locations/table.name') | -Address | +@lang('admin/locations/table.name') | +Address | @lang('admin/locations/table.city'), @lang('admin/locations/table.state') @lang('admin/locations/table.country') | diff --git a/app/views/backend/models/edit.blade.php b/app/views/backend/models/edit.blade.php index 7288d48cc7..e5456361de 100755 --- a/app/views/backend/models/edit.blade.php +++ b/app/views/backend/models/edit.blade.php @@ -50,6 +50,14 @@ + +
|---|