diff --git a/app/Http/Controllers/BulkCategoriesController.php b/app/Http/Controllers/BulkCategoriesController.php index 05b3189543..449b08878d 100644 --- a/app/Http/Controllers/BulkCategoriesController.php +++ b/app/Http/Controllers/BulkCategoriesController.php @@ -24,32 +24,32 @@ class BulkCategoriesController extends Controller foreach ($request->ids as $id) { $category = Category::find($id); if (is_null($category)) { - $errors[] = 'Category not found'; + $errors[] = trans('admin/categories/message.delete.not_found'); continue; } try { DestroyCategoryAction::run(category: $category); } catch (ModelStillHasAccessories $e) { - $errors[] = "{$category->name} still has associated items"; + $errors[] = trans('admin/categories/message.delete.bulk_assoc_accessories', ['category_name' => $category->name]); } catch (ModelStillHasAssetModels) { - $errors[] = "{$category->name} still has asset models"; + $errors[] = trans('admin/categories/message.delete.bulk_assoc_models', ['category_name' => $category->name]); } catch (ModelStillHasAssets) { - $errors[] = "{$category->name} still has assets"; + $errors[] = trans('admin/categories/message.delete.bulk_assoc_assets', ['category_name' => $category->name]); } catch (ModelStillHasComponents) { - $errors[] = "{$category->name} still has components"; + $errors[] = trans('admin/categories/message.delete.bulk_assoc_components', ['category_name' => $category->name]); } catch (ModelStillHasConsumables) { - $errors[] = "{$category->name} still has consumables"; + $errors[] = trans('admin/categories/message.delete.bulk_assoc_consumables', ['category_name' => $category->name]); } catch (ModelStillHasLicenses) { - $errors[] = "{$category->name} still has licenses"; + $errors[] = trans('admin/categories/message.delete.bulk_assoc_licenses', ['category_name' => $category->name]); } catch (\Exception $e) { report($e); - $errors[] = 'Something went wrong'; + $errors[] = trans('general.something_went_wrong'); } } if (count($errors) > 0) { - return redirect()->route('categories.index')->with('error', implode(', ', $errors)); + return redirect()->route('categories.index')->with('multi_error_messages', $errors); } else { - return redirect()->route('categories.index')->with('success', trans('admin/categories/message.delete.success')); + return redirect()->route('categories.index')->with('success', trans('admin/categories/message.delete.bulk_success')); } } } diff --git a/app/Presenters/CategoryPresenter.php b/app/Presenters/CategoryPresenter.php index d4a9f01a05..3131e61ef4 100644 --- a/app/Presenters/CategoryPresenter.php +++ b/app/Presenters/CategoryPresenter.php @@ -14,6 +14,11 @@ class CategoryPresenter extends Presenter public static function dataTableLayout() { $layout = [ + [ + 'field' => 'checkbox', + 'checkbox' => true, + 'titleTooltip' => trans('general.select_all_none'), + ], [ 'field' => 'id', 'searchable' => false, diff --git a/resources/lang/en-US/admin/categories/message.php b/resources/lang/en-US/admin/categories/message.php index 4e493f68b6..e9ee739d4b 100644 --- a/resources/lang/en-US/admin/categories/message.php +++ b/resources/lang/en-US/admin/categories/message.php @@ -18,9 +18,17 @@ return array( ), 'delete' => array( - 'confirm' => 'Are you sure you wish to delete this category?', - 'error' => 'There was an issue deleting the category. Please try again.', - 'success' => 'The category was deleted successfully.' + 'not_found' => 'Category not found.', + 'confirm' => 'Are you sure you wish to delete this category?', + 'error' => 'There was an issue deleting the category. Please try again.', + 'success' => 'The category was deleted successfully.', + 'bulk_success' => 'The Categories were deleted successfully.', + 'bulk_assoc_assets' => ':category_name still has associated assets and cannot be deleted. Please update your assets to no longer reference this supplier and try again.', + 'bulk_assoc_accessories' => ':category_name still has associated accessories and cannot be deleted. Please update your accessories to no longer reference this supplier and try again.', + 'bulk_assoc_consumables' => ':category_name still has associated consumables and cannot be deleted. Please update your consumables to no longer reference this supplier and try again.', + 'bulk_assoc_components' => ':category_name still has associated components and cannot be deleted. Please update your components to no longer reference this supplier and try again.', + 'bulk_assoc_licenses' => ':category_name still has associated licenses and cannot be deleted. Please update your licenses to no longer reference this supplier and try again.', + 'bulk_assoc_models' => ':category_name still has associated asset models and cannot be deleted. Please update your asset models to no longer reference this supplier and try again.', ) ); diff --git a/resources/lang/en-US/admin/manufacturers/message.php b/resources/lang/en-US/admin/manufacturers/message.php index 40ae777a81..41063d34e4 100644 --- a/resources/lang/en-US/admin/manufacturers/message.php +++ b/resources/lang/en-US/admin/manufacturers/message.php @@ -23,7 +23,7 @@ return array( 'delete' => array( 'not_found' => 'Manufacturer not found.', - 'confirm' => 'Are you sure you wish to delete this manufacturer?', + 'confirm' => 'Are you sure you wish to delete this manufacturer?', 'error' => 'There was an issue deleting the manufacturer. Please try again.', 'success' => 'The Manufacturer was deleted successfully.', 'bulk_success' => 'The Manufacturers were deleted successfully.', diff --git a/resources/views/categories/index.blade.php b/resources/views/categories/index.blade.php index ee492af144..11dee11a41 100755 --- a/resources/views/categories/index.blade.php +++ b/resources/views/categories/index.blade.php @@ -19,6 +19,7 @@
+ @include('partials.category-bulk-actions') +
@csrf @@ -20,10 +20,9 @@ @can('delete', \App\Models\Category::class) @endcan - -
diff --git a/resources/views/suppliers/index.blade.php b/resources/views/suppliers/index.blade.php index 47371a06d4..fca1f83d14 100755 --- a/resources/views/suppliers/index.blade.php +++ b/resources/views/suppliers/index.blade.php @@ -23,7 +23,7 @@
- @include('partials.supplier-bulk-actions', []) + @include('partials.supplier-bulk-actions')