Added crumbs and RMB for custom fields
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
0708af7d07
commit
d330ef9919
3 changed files with 28 additions and 18 deletions
|
@ -193,10 +193,8 @@ class CustomFieldsController extends Controller
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @since [v4.0]
|
* @since [v4.0]
|
||||||
*/
|
*/
|
||||||
public function edit(Request $request, $id) : View | RedirectResponse
|
public function edit(Request $request, CustomField $field) : View | RedirectResponse
|
||||||
{
|
{
|
||||||
if ($field = CustomField::find($id)) {
|
|
||||||
|
|
||||||
$this->authorize('update', $field);
|
$this->authorize('update', $field);
|
||||||
$fieldsets = CustomFieldset::get();
|
$fieldsets = CustomFieldset::get();
|
||||||
$customFormat = '';
|
$customFormat = '';
|
||||||
|
@ -210,10 +208,6 @@ class CustomFieldsController extends Controller
|
||||||
'fieldsets' => $fieldsets,
|
'fieldsets' => $fieldsets,
|
||||||
'predefinedFormats' => Helper::predefined_formats(),
|
'predefinedFormats' => Helper::predefined_formats(),
|
||||||
]);
|
]);
|
||||||
}
|
|
||||||
|
|
||||||
return redirect()->route("fields.index")
|
|
||||||
->with("error", trans('admin/custom_fields/message.field.invalid'));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,13 +223,9 @@ class CustomFieldsController extends Controller
|
||||||
* @return \Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||||
*/
|
*/
|
||||||
public function update(CustomFieldRequest $request, $id) : RedirectResponse
|
public function update(CustomFieldRequest $request, CustomField $field) : RedirectResponse
|
||||||
{
|
{
|
||||||
$field = CustomField::find($id);
|
|
||||||
|
|
||||||
$this->authorize('update', $field);
|
$this->authorize('update', $field);
|
||||||
|
|
||||||
|
|
||||||
$show_in_email = $request->get("show_in_email", 0);
|
$show_in_email = $request->get("show_in_email", 0);
|
||||||
$display_in_user_view = $request->get("display_in_user_view", 0);
|
$display_in_user_view = $request->get("display_in_user_view", 0);
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ use App\Models\Category;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\Component;
|
use App\Models\Component;
|
||||||
use App\Models\Consumable;
|
use App\Models\Consumable;
|
||||||
|
use App\Models\CustomField;
|
||||||
use App\Models\Department;
|
use App\Models\Department;
|
||||||
use App\Models\Depreciation;
|
use App\Models\Depreciation;
|
||||||
use App\Models\Group;
|
use App\Models\Group;
|
||||||
|
@ -87,7 +88,7 @@ class BreadcrumbsServiceProvider extends ServiceProvider
|
||||||
* Asset Model Breadcrumbs
|
* Asset Model Breadcrumbs
|
||||||
*/
|
*/
|
||||||
Breadcrumbs::for('models.index', fn (Trail $trail) =>
|
Breadcrumbs::for('models.index', fn (Trail $trail) =>
|
||||||
$trail->parent('home', route('home'))
|
$trail->parent('hardware.index', route('hardware.index'))
|
||||||
->push(trans('general.asset_models'), route('models.index'))
|
->push(trans('general.asset_models'), route('models.index'))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -227,7 +228,23 @@ class BreadcrumbsServiceProvider extends ServiceProvider
|
||||||
->push(trans('general.breadcrumb_button_actions.edit_item', ['name' => $consumable->name]), route('home'))
|
->push(trans('general.breadcrumb_button_actions.edit_item', ['name' => $consumable->name]), route('home'))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom fields Breadcrumbs
|
||||||
|
*/
|
||||||
|
Breadcrumbs::for('fields.index', fn (Trail $trail) =>
|
||||||
|
$trail->parent('models.index', route('models.index'))
|
||||||
|
->push(trans('admin/custom_fields/general.custom_fields'), route('fields.index'))
|
||||||
|
);
|
||||||
|
|
||||||
|
Breadcrumbs::for('fields.create', fn (Trail $trail) =>
|
||||||
|
$trail->parent('fields.index', route('fields.index'))
|
||||||
|
->push(trans('general.create'), route('fields.create'))
|
||||||
|
);
|
||||||
|
|
||||||
|
Breadcrumbs::for('fields.edit', fn (Trail $trail, CustomField $field) =>
|
||||||
|
$trail->parent('fields.index', route('fields.index'))
|
||||||
|
->push($field->name, route('fields.edit', $field))
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Department Breadcrumbs
|
* Department Breadcrumbs
|
||||||
|
|
|
@ -33,14 +33,17 @@ Route::group([ 'prefix' => 'fields','middleware' => ['auth'] ], function () {
|
||||||
)->name('fieldsets.associate');
|
)->name('fieldsets.associate');
|
||||||
|
|
||||||
Route::resource('fieldsets', CustomFieldsetsController::class, [
|
Route::resource('fieldsets', CustomFieldsetsController::class, [
|
||||||
'parameters' => ['fieldset' => 'field_id', 'field' => 'field_id']
|
'parameters' => [
|
||||||
|
'fieldset' => 'field_id',
|
||||||
|
'field' => 'field_id'
|
||||||
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::resource('fields', CustomFieldsController::class, [
|
Route::resource('fields', CustomFieldsController::class,
|
||||||
'middleware' => ['auth'],
|
['middleware' => ['auth'],
|
||||||
'parameters' => ['field' => 'field_id', 'fieldset' => 'fieldset_id'],
|
'except' => ['show']
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue