/**
  * Generates the JSON used to display the depreciation listing.
  *
  * @see DepreciationsController::getIndex()
  * @author [A. Gianotto] [<*****@*****.**>]
  * @param  string  $status
  * @since [v1.2]
  * @return String JSON
  */
 public function getDatatable()
 {
     $depreciations = Depreciation::select(array('id', 'name', 'months'));
     if (Input::has('search')) {
         $depreciations = $depreciations->TextSearch(e(Input::get('search')));
     }
     if (Input::has('offset')) {
         $offset = e(Input::get('offset'));
     } else {
         $offset = 0;
     }
     if (Input::has('limit')) {
         $limit = e(Input::get('limit'));
     } else {
         $limit = 50;
     }
     $allowed_columns = ['id', 'name', 'months'];
     $order = Input::get('order') === 'asc' ? 'asc' : 'desc';
     $sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
     $depreciations->orderBy($sort, $order);
     $depreciationsCount = $depreciations->count();
     $depreciations = $depreciations->skip($offset)->take($limit)->get();
     $rows = array();
     foreach ($depreciations as $depreciation) {
         $actions = '<a href="' . route('update/depreciations', $depreciation->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/depreciations', $depreciation->id) . '" data-content="' . trans('admin/depreciations/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($depreciation->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
         $rows[] = array('id' => $depreciation->id, 'name' => e($depreciation->name), 'months' => e($depreciation->months), 'actions' => $actions);
     }
     $data = array('total' => $depreciationsCount, 'rows' => $rows);
     return $data;
 }