mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 22:07:29 -08:00
Merge pull request #10279 from snipe/fixes/turn_get_into_post_for_custom_field_required
Turn custom fields required/optional/remove into POST requests
This commit is contained in:
commit
edf98cb795
|
@ -57,21 +57,28 @@
|
|||
<td>{{$field->element}}</td>
|
||||
<td>{{ $field->field_encrypted=='1' ? trans('general.yes') : trans('general.no') }}</td>
|
||||
<td>
|
||||
|
||||
@if ($field->pivot->required)
|
||||
<a href="{{ route('fields.optional', [$custom_fieldset->id, $field->id]) }}">
|
||||
<i class="fa fa-check text-success" aria-hidden="true"></i>
|
||||
<span class="sr-only">Required - click to make optional</span>
|
||||
</a>
|
||||
<form method="post" action="{{ route('fields.optional', [$custom_fieldset->id, $field->id]) }}">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-link"><i class="fa fa-check text-success" aria-hidden="true"></i></button>
|
||||
</form>
|
||||
|
||||
@else
|
||||
<a href="{{ route('fields.required', [$custom_fieldset->id, $field->id]) }}">
|
||||
<i class="fa fa-times text-danger" aria-hidden="true"></i>
|
||||
<span class="sr-only">Optional - click to make required</span>
|
||||
</a>
|
||||
|
||||
<form method="post" action="{{ route('fields.required', [$custom_fieldset->id, $field->id]) }}">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-link"><i class="fa fa-times text-danger" aria-hidden="true"></i></button>
|
||||
</form>
|
||||
@endif
|
||||
|
||||
</td>
|
||||
<td>
|
||||
@can('update', $custom_fieldset)
|
||||
<a href="{{ route('fields.disassociate', [$field, $custom_fieldset->id]) }}" class="btn btn-sm btn-danger">Remove</a>
|
||||
<form method="post" action="{{ route('fields.disassociate', [$field, $custom_fieldset->id]) }}">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm btn-danger">Remove</button>
|
||||
</form>
|
||||
@endcan
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -7,17 +7,17 @@
|
|||
|
||||
Route::group([ 'prefix' => 'fields','middleware' => ['auth'] ], function () {
|
||||
|
||||
Route::get('required/{fieldset_id}/{field_id}',
|
||||
Route::post('required/{fieldset_id}/{field_id}',
|
||||
['uses' => 'CustomFieldsetsController@makeFieldRequired',
|
||||
'as' => 'fields.required']
|
||||
);
|
||||
|
||||
Route::get('optional/{fieldset_id}/{field_id}',
|
||||
Route::post('optional/{fieldset_id}/{field_id}',
|
||||
['uses' => 'CustomFieldsetsController@makeFieldOptional',
|
||||
'as' => 'fields.optional']
|
||||
);
|
||||
|
||||
Route::get('{field_id}/fieldset/{fieldset_id}/disassociate',
|
||||
Route::post('{field_id}/fieldset/{fieldset_id}/disassociate',
|
||||
['uses' => 'CustomFieldsController@deleteFieldFromFieldset',
|
||||
'as' => 'fields.disassociate']
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue