mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 05:04:07 -08:00
Merge remote-tracking branch 'origin/develop'
Some checks failed
CodeQL Security Scan / CodeQL Security Scan (javascript) (push) Has been cancelled
Codacy Security Scan / Codacy Security Scan (push) Has been cancelled
Docker images (Alpine) / docker (push) Has been cancelled
Docker images / docker (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.1) (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.2) (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.3) (push) Has been cancelled
Tests in SQLite / PHP ${{ matrix.php-version }} (8.1.1) (push) Has been cancelled
Some checks failed
CodeQL Security Scan / CodeQL Security Scan (javascript) (push) Has been cancelled
Codacy Security Scan / Codacy Security Scan (push) Has been cancelled
Docker images (Alpine) / docker (push) Has been cancelled
Docker images / docker (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.1) (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.2) (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.3) (push) Has been cancelled
Tests in SQLite / PHP ${{ matrix.php-version }} (8.1.1) (push) Has been cancelled
This commit is contained in:
commit
7f2cae4f26
|
@ -86,6 +86,9 @@ class ConsumablesController extends Controller
|
||||||
case 'company':
|
case 'company':
|
||||||
$consumables = $consumables->OrderCompany($order);
|
$consumables = $consumables->OrderCompany($order);
|
||||||
break;
|
break;
|
||||||
|
case 'remaining':
|
||||||
|
$consumables = $consumables->OrderRemaining($order);
|
||||||
|
break;
|
||||||
case 'supplier':
|
case 'supplier':
|
||||||
$consumables = $consumables->OrderSupplier($order);
|
$consumables = $consumables->OrderSupplier($order);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -425,6 +425,20 @@ class Consumable extends SnipeModel
|
||||||
return $query->leftJoin('companies', 'consumables.company_id', '=', 'companies.id')->orderBy('companies.name', $order);
|
return $query->leftJoin('companies', 'consumables.company_id', '=', 'companies.id')->orderBy('companies.name', $order);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query builder scope to order on remaining
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Database\Query\Builder $query Query builder instance
|
||||||
|
* @param string $order Order
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Database\Query\Builder Modified query builder
|
||||||
|
*/
|
||||||
|
public function scopeOrderRemaining($query, $order)
|
||||||
|
{
|
||||||
|
$order_by = 'consumables.qty - consumables_users_count ' . $order;
|
||||||
|
return $query->orderByRaw($order_by);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query builder scope to order on supplier
|
* Query builder scope to order on supplier
|
||||||
*
|
*
|
||||||
|
|
|
@ -75,13 +75,13 @@ class ConsumablePresenter extends Presenter
|
||||||
], [
|
], [
|
||||||
'field' => 'qty',
|
'field' => 'qty',
|
||||||
'searchable' => false,
|
'searchable' => false,
|
||||||
'sortable' => false,
|
'sortable' => true,
|
||||||
'title' => trans('admin/components/general.total'),
|
'title' => trans('admin/components/general.total'),
|
||||||
'visible' => true,
|
'visible' => true,
|
||||||
], [
|
], [
|
||||||
'field' => 'remaining',
|
'field' => 'remaining',
|
||||||
'searchable' => false,
|
'searchable' => false,
|
||||||
'sortable' => false,
|
'sortable' => true,
|
||||||
'title' => trans('admin/components/general.remaining'),
|
'title' => trans('admin/components/general.remaining'),
|
||||||
'visible' => true,
|
'visible' => true,
|
||||||
], [
|
], [
|
||||||
|
|
Loading…
Reference in a new issue