@@ -382,7 +382,7 @@ public function getClone($modelId = null)
382382
383383 public function getDatatable ($ status = null )
384384 {
385- $ models = Model::orderBy ( ' created_at ' , ' DESC ' )-> with ('category ' ,'assets ' ,'depreciation ' );
385+ $ models = Model::with ('category ' ,'assets ' ,'depreciation ' );
386386 ($ status != 'Deleted ' ) ?: $ models ->withTrashed ()->Deleted ();;
387387
388388 if (Input::has ('search ' )) {
@@ -402,7 +402,7 @@ public function getDatatable($status = null)
402402 }
403403
404404
405- $ allowed_columns = ['name ' ];
405+ $ allowed_columns = ['id ' , ' name ' , ' modelno ' ];
406406 $ order = Input::get ('order ' ) === 'asc ' ? 'asc ' : 'desc ' ;
407407 $ sort = in_array (Input::get ('sort ' ), $ allowed_columns ) ? Input::get ('sort ' ) : 'created_at ' ;
408408
@@ -415,13 +415,14 @@ public function getDatatable($status = null)
415415
416416 foreach ($ models as $ model ) {
417417 if ($ model ->deleted_at == '' ) {
418- $ actions = '<a href=" ' .route ('update/model ' , $ model ->id ).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href=" ' .route ('delete/model ' , $ model ->id ).'" data-content=" ' .Lang::get ('admin/models/message.delete.confirm ' ).'" data-title=" ' .Lang::get ('general.delete ' ).' ' .htmlspecialchars ($ model ->name ).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a> ' ;
418+ $ actions = '<div style=" white-space: nowrap;">< a href=" ' .route ('update/model ' , $ model ->id ).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href=" ' .route ('delete/model ' , $ model ->id ).'" data-content=" ' .Lang::get ('admin/models/message.delete.confirm ' ).'" data-title=" ' .Lang::get ('general.delete ' ).' ' .htmlspecialchars ($ model ->name ).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div > ' ;
419419 } else {
420420 $ actions = '<a href=" ' .route ('restore/model ' , $ model ->id ).'" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a> ' ;
421421 }
422422
423423 $ rows [] = array (
424- 'manufacturer ' => $ model ->manufacturer ->name ,
424+ 'id ' => $ model ->id ,
425+ 'manufacturer ' => link_to ('/admin/settings/manufacturers/ ' .$ model ->manufacturer ->id .'/view ' , $ model ->manufacturer ->name ),
425426 'name ' => link_to ('/hardware/models/ ' .$ model ->id .'/view ' , $ model ->name ),
426427 'modelnumber ' => $ model ->modelno ,
427428 'numassets ' => $ model ->assets ->count (),
0 commit comments