bulk actions are handled before sorting

This commit is contained in:
Godfrey M 2024-03-05 15:47:52 -08:00
parent 95a6c7058f
commit c9d54baa10

View file

@ -93,41 +93,6 @@ class BulkAssetsController extends Controller
$assets = Asset::with('assignedTo', 'location', 'model')->whereIn('assets.id', $asset_ids); $assets = Asset::with('assignedTo', 'location', 'model')->whereIn('assets.id', $asset_ids);
switch ($sort_override) {
case 'model':
$assets->OrderModels($order);
break;
case 'model_number':
$assets->OrderModelNumber($order);
break;
case 'category':
$assets->OrderCategory($order);
break;
case 'manufacturer':
$assets->OrderManufacturer($order);
break;
case 'company':
$assets->OrderCompany($order);
break;
case 'location':
$assets->OrderLocation($order);
case 'rtd_location':
$assets->OrderRtdLocation($order);
break;
case 'status_label':
$assets->OrderStatus($order);
break;
case 'supplier':
$assets->OrderSupplier($order);
break;
case 'assigned_to':
$assets->OrderAssigned($order);
break;
default:
$assets->orderBy($column_sort, $order);
break;
}
$assets = $assets->get(); $assets = $assets->get();
$models = $assets->unique('model_id'); $models = $assets->unique('model_id');
@ -176,6 +141,41 @@ class BulkAssetsController extends Controller
} }
} }
switch ($sort_override) {
case 'model':
$assets->OrderModels($order);
break;
case 'model_number':
$assets->OrderModelNumber($order);
break;
case 'category':
$assets->OrderCategory($order);
break;
case 'manufacturer':
$assets->OrderManufacturer($order);
break;
case 'company':
$assets->OrderCompany($order);
break;
case 'location':
$assets->OrderLocation($order);
case 'rtd_location':
$assets->OrderRtdLocation($order);
break;
case 'status_label':
$assets->OrderStatus($order);
break;
case 'supplier':
$assets->OrderSupplier($order);
break;
case 'assigned_to':
$assets->OrderAssigned($order);
break;
default:
$assets->orderBy($column_sort, $order);
break;
}
return redirect()->back()->with('error', 'No action selected'); return redirect()->back()->with('error', 'No action selected');
} }