Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converted Form::open to blade component #15993

Draft
wants to merge 14 commits into
base: develop
Choose a base branch
from
9 changes: 7 additions & 2 deletions resources/views/account/change-password.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@

<div class="row">
<div class="col-md-9">
{{ Form::open(['method' => 'POST', 'files' => true, 'class' => 'form-horizontal', 'autocomplete' => 'off']) }}
<x-form
:route="route('account.password.index')"
autocomplete="off"
class="form-horizontal"
files
>
<!-- CSRF Token -->
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
<div class="box box-default">
Expand Down Expand Up @@ -63,7 +68,7 @@
</div>

</div> <!-- .box-default -->
{{ Form::close() }}
</x-form>
</div> <!-- .col-md-9 -->
</div> <!-- .row-->
@stop
9 changes: 7 additions & 2 deletions resources/views/account/profile.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@

<div class="row">
<div class="col-md-9">
{{ Form::open(['method' => 'POST', 'files' => true, 'class' => 'form-horizontal', 'autocomplete' => 'off']) }}
<x-form
:route="route('profile')"
class="form-horizontal"
autocomplete="off"
files
>
<!-- CSRF Token -->
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
<div class="box box-default">
Expand Down Expand Up @@ -177,7 +182,7 @@
<button type="submit" class="btn btn-primary"><x-icon type="checkmark" /> {{ trans('general.save') }}</button>
</div>
</div> <!-- .box-default -->
{{ Form::close() }}
</x-form>
</div> <!-- .col-md-9 -->
</div> <!-- .row-->

Expand Down
19 changes: 19 additions & 0 deletions resources/views/blade/form.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@props([
'route',
'method' => 'POST',
'files' => false,
])

<form
action="{{ $route }}"
method="POST"
accept-charset="UTF-8"
@if($files) enctype="multipart/form-data" @endif
{{ $attributes }}
>
@csrf
@if(in_array(strtoupper($method), ['PUT', 'PATCH', 'DELETE']))
<input type="hidden" name="_method" value="{{ strtoupper($method) }}">
@endif
{{ $slot }}
</form>
15 changes: 6 additions & 9 deletions resources/views/custom_fields/fields/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,11 @@
@section('content')

<!-- Horizontal Form -->
@if ($field->id)
{{ Form::open(['route' => ['fields.update', $field->id], 'class'=>'form-horizontal']) }}
{{ method_field('PUT') }}
@else
{{ Form::open(['route' => 'fields.store', 'class'=>'form-horizontal']) }}
@endif

@csrf
<x-form
:route="$field->id ? route('fields.update', $field->id) : route('fields.store')"
:method="$field->id ? 'PUT' : 'POST'"
class="form-horizontal"
>
<div class="row">
<div class="col-md-12">
<div class="box box-default">
Expand Down Expand Up @@ -263,7 +260,7 @@ class="fieldset"


</div>
{{ Form::close() }}
</x-form>
@stop

@section('moar_scripts')
Expand Down
11 changes: 6 additions & 5 deletions resources/views/custom_fields/fieldsets/view.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@
<tfoot>
<tr>
<td colspan="8">
{{ Form::open(['route' =>
["fieldsets.associate",$custom_fieldset->id],
'class'=>'form-inline',
'id' => 'ordering']) }}
<x-form
:route="route('fieldsets.associate', $custom_fieldset->id)"
class="form-inline"
id="ordering"
>


<div class="form-group">
Expand All @@ -118,7 +119,7 @@
<button type="submit" class="btn btn-primary"> {{ trans('general.save') }}</button>
</span>

{{ Form::close() }}
</x-form>

</td>
</tr>
Expand Down
16 changes: 12 additions & 4 deletions resources/views/custom_fields/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,17 @@ class="table table-striped snipe-table"
@endcan

@can('delete', $fieldset)
{{ Form::open(['route' => array('fieldsets.destroy', $fieldset->id), 'method' => 'delete','style' => 'display:inline-block']) }}
<x-form
:route="route('fieldsets.destroy', $fieldset->id)"
method="delete"
style="display:inline-block"
>
@if($fieldset->models->count() > 0)
<button type="submit" class="btn btn-danger btn-sm disabled" data-tooltip="true" title="{{ trans('general.cannot_be_deleted') }}" disabled><i class="fas fa-trash"></i></button>
@else
<button type="submit" class="btn btn-danger btn-sm" data-tooltip="true" title="{{ trans('general.delete') }}"><i class="fas fa-trash"></i></button>
@endif
{{ Form::close() }}
</x-form>
@endcan
</nobr>
</td>
Expand Down Expand Up @@ -192,7 +196,11 @@ class="table table-striped snipe-table"
</td>
<td>
<nobr>
{{ Form::open(array('route' => array('fields.destroy', $field->id), 'method' => 'delete', 'style' => 'display:inline-block')) }}
<x-form
:route="route('fields.destroy', $field->id)"
method="delete"
style="display:inline-block"
>
@can('update', $field)
<a href="{{ route('fields.edit', $field->id) }}" class="btn btn-warning btn-sm" data-tooltip="true" title="{{ trans('general.update') }}">
<i class="fas fa-pencil-alt" aria-hidden="true"></i>
Expand All @@ -214,7 +222,7 @@ class="table table-striped snipe-table"
@endif

@endcan
{{ Form::close() }}
</x-form>
</nobr>
</td>
</tr>
Expand Down
14 changes: 6 additions & 8 deletions resources/views/depreciations/view.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,11 @@ class="table table-striped snipe-table"
<div class="tab-pane" id="models">

<div class="row">
{{ Form::open(
[
'method' => 'POST',
'route' => ['models.bulkedit.index'],
'class' => 'form-inline',
'id' => 'bulkForm']
) }}
<x-form
:route="route('models.bulkedit.index')"
class="form-inline"
id="bulkForm"
>
<div class="col-md-12">
<div id="toolbar">
<label for="bulk_actions" class="sr-only">{{ trans('general.bulk_actions') }}</label>
Expand Down Expand Up @@ -176,7 +174,7 @@ class="table table-striped snipe-table"
</div>

</div>
{{ Form::close() }}
</x-form>

</div> <!--/.row-->
</div> <!-- /.tab-pane -->
Expand Down
12 changes: 6 additions & 6 deletions resources/views/hardware/audit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
<div class="col-md-8 col-md-offset-2">
<div class="box box-default">

{{ Form::open([
'method' => 'POST',
'route' => ['asset.audit.store', $asset->id],
'files' => true,
'class' => 'form-horizontal' ]) }}
<x-form
:route="route('asset.audit.store', $asset->id)"
files
class="form-horizontal"
>

<div class="box-header with-border">
<h2 class="box-title"> {{ trans('admin/hardware/form.tag') }} {{ $asset->asset_tag }}</h2>
Expand Down Expand Up @@ -140,7 +140,7 @@
{{ trans('general.audit') }}
</button>
</div>
</form>
</x-form>
</div>
</div> <!--/.col-md-7-->
</div>
Expand Down
9 changes: 7 additions & 2 deletions resources/views/hardware/quickscan-checkin.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@


<div class="row">
{{ Form::open(['method' => 'POST', 'class' => 'form-horizontal', 'role' => 'form', 'id' => 'checkin-form' ]) }}
<x-form
:route="route('hardware/quickscancheckin')"
class="form-horizontal"
role="form"
id="checkin-form"
>
<!-- left column -->
<div class="col-md-6">
<div class="box box-default">
Expand Down Expand Up @@ -78,7 +83,7 @@



{{Form::close()}}
</x-form>
</div> <!--/.col-md-6-->

<div class="col-md-6">
Expand Down
9 changes: 7 additions & 2 deletions resources/views/hardware/quickscan.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@


<div class="row">
{{ Form::open(['method' => 'POST', 'class' => 'form-horizontal', 'role' => 'form', 'id' => 'audit-form' ]) }}
<x-form
:route="route('assets.bulkaudit')"
class="form-horizontal"
role="form"
id="audit-form"
>
<!-- left column -->
<div class="col-md-6">
<div class="box box-default">
Expand Down Expand Up @@ -92,7 +97,7 @@



{{Form::close()}}
</x-form>
</div> <!--/.col-md-6-->

<div class="col-md-6">
Expand Down
15 changes: 4 additions & 11 deletions resources/views/hardware/requested.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,11 @@ class="table table-striped snipe-table"
</td>
<td>{{ App\Helpers\Helper::getFormattedDateObject($request->created_at, 'datetime', false) }}</td>
<td>
{{ Form::open([
'method' => 'POST',
'route' => [
'account/request-item',
$request->itemType(),
$request->requestable->id,
true,
$request->requestingUser()->id
],
]) }}
<x-form
:route="route('account/request-item', [$request->itemType(), $request->requestable->id, true, $request->requestingUser()->id])"
>
<button class="btn btn-warning btn-sm" data-tooltip="true" title="{{ trans('general.cancel_request') }}">{{ trans('button.cancel') }}</button>
{{ Form::close() }}
</x-form>
</td>
<td>
@if ($request->itemType() == "asset")
Expand Down
28 changes: 14 additions & 14 deletions resources/views/hardware/view.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,18 +249,18 @@
@endcan

<div class="col-md-12 hidden-print" style="padding-top: 5px;">
{{ Form::open([
'method' => 'POST',
'route' => ['hardware/bulkedit'],
'class' => 'form-inline',
'target'=>'_blank',
'id' => 'bulkForm']) }}
<x-form
:route="route('hardware/bulkedit')"
class="form-inline"
target="_blank"
id="bulkForm"
>
<input type="hidden" name="bulk_actions" value="labels" />
<input type="hidden" name="ids[{{$asset->id}}]" value="{{ $asset->id }}" />
<button class="btn btn-block btn-social btn-sm btn-default" id="bulkEdit"{{ (!$asset->model ? ' disabled' : '') }}{!! (!$asset->model ? ' data-tooltip="true" title="'.trans('admin/hardware/general.model_invalid').'"' : '') !!}>
<x-icon type="assets" />
{{ trans_choice('button.generate_labels', 1) }}</button>
{{ Form::close() }}
</x-form>
</div>

@can('delete', $asset)
Expand Down Expand Up @@ -1227,11 +1227,11 @@
@if ($asset->assignedAssets->count() > 0)


{{ Form::open([
'method' => 'POST',
'route' => ['hardware/bulkedit'],
'class' => 'form-inline',
'id' => 'bulkForm']) }}
<x-form
:route="route('hardware/bulkedit')"
class="form-inline"
id="bulkForm"
>
<div id="toolbar">
<label for="bulk_actions"><span class="sr-only">{{ trans('general.bulk_actions')}}</span></label>
<select name="bulk_actions" class="form-control select2" style="width: 150px;" aria-label="bulk_actions">
Expand Down Expand Up @@ -1269,7 +1269,7 @@ class="table table-striped snipe-table"
</table>


{{ Form::close() }}
</x-form>
</div>

@else
Expand Down Expand Up @@ -1417,4 +1417,4 @@ class="table table-striped snipe-table"
</script>
@include ('partials.bootstrap-table')

@stop
@stop
13 changes: 6 additions & 7 deletions resources/views/modals/upload-file.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="uploadFileModalLabel">{{ trans('general.file_upload') }}</h4>
</div>
{{ Form::open([
'method' => 'POST',
'route' => ['upload/'.$item_type, $item_id],
'files' => true,
'class' => 'form-horizontal' ]) }}
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
<x-form
:route="route('upload/' . $item_type, $item_id)"
files
class="form-horizontal"
>
<div class="modal-body">

<div class="row">
Expand Down Expand Up @@ -40,7 +39,7 @@
<a href="#" class="pull-left" data-dismiss="modal">{{ trans('button.cancel') }}</a>
<button type="submit" class="btn btn-primary">{{ trans('button.upload') }}</button>
</div>
{{ Form::close() }}
</x-form>
</div>
</div>
</div>
1 change: 0 additions & 1 deletion resources/views/models/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class="table table-striped snipe-table"
</table>
</div>
</div>
{{ Form::close() }}
</div><!-- /.box-body -->
</div><!-- /.box -->
</div>
Expand Down
1 change: 0 additions & 1 deletion resources/views/models/view.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ class="table table-striped snipe-table"
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
}'>
</table>
{{ Form::close() }}
</div> <!-- /.tab-pane assets -->


Expand Down
Loading
Loading