fix: 🐛 Number Input steps

This commit is contained in:
IceToast 2023-05-12 15:52:58 +02:00
parent 0f67661aa7
commit 21529ddf65
2 changed files with 347 additions and 359 deletions

View file

@ -51,8 +51,8 @@
<div class="col-lg-6"> <div class="col-lg-6">
<div class="form-group"> <div class="form-group">
<label for="name">{{ __('Name') }}</label> <label for="name">{{ __('Name') }}</label>
<input value="{{$product->name ?? old('name')}}" id="name" name="name" <input value="{{ $product->name ?? old('name') }}" id="name"
type="text" name="name" type="text"
class="form-control @error('name') is-invalid @enderror" class="form-control @error('name') is-invalid @enderror"
required="required"> required="required">
@error('name') @error('name')
@ -64,9 +64,8 @@
<div class="form-group"> <div class="form-group">
<label for="price">{{ __('Price in') }} {{ $credits_display_name }}</label> <label for="price">{{ __('Price in') }} {{ $credits_display_name }}</label>
<input value="{{$product->price ?? old('price')}}" id="price" name="price" step=".01" <input value="{{ $product->price ?? old('price') }}" id="price"
type="number" name="price" step=".0001" type="number"
step="0.0001"
class="form-control @error('price') is-invalid @enderror" class="form-control @error('price') is-invalid @enderror"
required="required"> required="required">
@error('price') @error('price')
@ -80,8 +79,7 @@
<div class="form-group"> <div class="form-group">
<label for="memory">{{ __('Memory') }}</label> <label for="memory">{{ __('Memory') }}</label>
<input value="{{ $product->memory ?? old('memory') }}" id="memory" <input value="{{ $product->memory ?? old('memory') }}" id="memory"
name="memory" name="memory" type="number"
type="number"
class="form-control @error('memory') is-invalid @enderror" class="form-control @error('memory') is-invalid @enderror"
required="required"> required="required">
@error('memory') @error('memory')
@ -94,8 +92,7 @@
<div class="form-group"> <div class="form-group">
<label for="cpu">{{ __('Cpu') }}</label> <label for="cpu">{{ __('Cpu') }}</label>
<input value="{{ $product->cpu ?? old('cpu') }}" id="cpu" name="cpu" <input value="{{ $product->cpu ?? old('cpu') }}" id="cpu" name="cpu"
type="number" type="number" class="form-control @error('cpu') is-invalid @enderror"
class="form-control @error('cpu') is-invalid @enderror"
required="required"> required="required">
@error('cpu') @error('cpu')
<div class="invalid-feedback"> <div class="invalid-feedback">
@ -106,8 +103,8 @@
<div class="form-group"> <div class="form-group">
<label for="swap">{{ __('Swap') }}</label> <label for="swap">{{ __('Swap') }}</label>
<input value="{{$product->swap ?? old('swap')}}" id="swap" name="swap" <input value="{{ $product->swap ?? old('swap') }}" id="swap"
type="number" name="swap" type="number"
class="form-control @error('swap') is-invalid @enderror" class="form-control @error('swap') is-invalid @enderror"
required="required"> required="required">
@error('swap') @error('swap')
@ -119,9 +116,8 @@
<div class="form-group"> <div class="form-group">
<label for="allocations">{{ __('Allocations') }}</label> <label for="allocations">{{ __('Allocations') }}</label>
<input value="{{$product->allocations ?? old('allocations') ?? 0}}" <input value="{{ $product->allocations ?? (old('allocations') ?? 0) }}"
id="allocations" name="allocations" id="allocations" name="allocations" type="number"
type="number"
class="form-control @error('allocations') is-invalid @enderror" class="form-control @error('allocations') is-invalid @enderror"
required="required"> required="required">
@error('allocations') @error('allocations')
@ -136,10 +132,8 @@
data-trigger="hover" data-trigger="hover"
data-content="{{ __('This is what the users sees') }}" data-content="{{ __('This is what the users sees') }}"
class="fas fa-info-circle"></i></label> class="fas fa-info-circle"></i></label>
<textarea id="description" name="description" <textarea id="description" name="description" type="text"
type="text" class="form-control @error('description') is-invalid @enderror" required="required">{{ $product->description ?? old('description') }}</textarea>
class="form-control @error('description') is-invalid @enderror"
required="required">{{$product->description ?? old('description')}}</textarea>
@error('description') @error('description')
<div class="invalid-feedback"> <div class="invalid-feedback">
{{ $message }} {{ $message }}
@ -150,8 +144,8 @@
<input type="checkbox" value="1" id="oom" name="oom_killer" <input type="checkbox" value="1" id="oom" name="oom_killer"
class=""> class="">
<label for="oom_killer">{{__('OOM Killer')}} <i <label for="oom_killer">{{ __('OOM Killer') }} <i data-toggle="popover"
data-toggle="popover" data-trigger="hover" data-trigger="hover"
data-content="{{ __('Enable or Disable the OOM Killer for this Product.') }}" data-content="{{ __('Enable or Disable the OOM Killer for this Product.') }}"
class="fas fa-info-circle"></i></label> class="fas fa-info-circle"></i></label>
</div> </div>
@ -159,9 +153,8 @@
<div class="col-lg-6"> <div class="col-lg-6">
<div class="form-group"> <div class="form-group">
<label for="disk">{{ __('Disk') }}</label> <label for="disk">{{ __('Disk') }}</label>
<input value="{{$product->disk ?? old('disk') ?? 1000}}" id="disk" <input value="{{ $product->disk ?? (old('disk') ?? 1000) }}" id="disk"
name="disk" name="disk" type="number"
type="number"
class="form-control @error('disk') is-invalid @enderror" class="form-control @error('disk') is-invalid @enderror"
required="required"> required="required">
@error('disk') @error('disk')
@ -177,8 +170,9 @@
data-content="{{ __('Period when the user will be charged for the given price') }}" data-content="{{ __('Period when the user will be charged for the given price') }}"
class="fas fa-info-circle"></i></label> class="fas fa-info-circle"></i></label>
<select id="billing_period" style="width:100%" class="custom-select" name="billing_period" required <select id="billing_period" style="width:100%" class="custom-select"
autocomplete="off" @error('billing_period') is-invalid @enderror> name="billing_period" required autocomplete="off"
@error('billing_period') is-invalid @enderror>
<option value="hourly" selected> <option value="hourly" selected>
{{ __('Hourly') }} {{ __('Hourly') }}
</option> </option>
@ -209,14 +203,13 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="minimum_credits">{{__('Minimum')}} {{ $credits_display_name }} <i <label for="minimum_credits">{{ __('Minimum') }} {{ $credits_display_name }}
data-toggle="popover" data-trigger="hover" <i data-toggle="popover" data-trigger="hover"
data-content="{{ __('Setting to -1 will use the value from configuration.') }}" data-content="{{ __('Setting to -1 will use the value from configuration.') }}"
class="fas fa-info-circle"></i></label> class="fas fa-info-circle"></i></label>
<input <input
value="{{ $product->minimum_credits ?? old('minimum_credits') ?? -1 }}" value="{{ $product->minimum_credits ?? (old('minimum_credits') ?? -1) }}"
id="minimum_credits" id="minimum_credits" name="minimum_credits" type="number"
name="minimum_credits" type="number"
class="form-control @error('minimum_credits') is-invalid @enderror" class="form-control @error('minimum_credits') is-invalid @enderror"
required="required"> required="required">
@error('minimum_credits') @error('minimum_credits')
@ -228,8 +221,8 @@
<div class="form-group"> <div class="form-group">
<label for="io">{{ __('IO') }}</label> <label for="io">{{ __('IO') }}</label>
<input value="{{$product->io ?? old('io') ?? 500}}" id="io" name="io" <input value="{{ $product->io ?? (old('io') ?? 500) }}" id="io"
type="number" name="io" type="number"
class="form-control @error('io') is-invalid @enderror" class="form-control @error('io') is-invalid @enderror"
required="required"> required="required">
@error('io') @error('io')
@ -240,10 +233,8 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="databases">{{ __('Databases') }}</label> <label for="databases">{{ __('Databases') }}</label>
<input value="{{$product->databases ?? old('databases') ?? 1}}" <input value="{{ $product->databases ?? (old('databases') ?? 1) }}"
id="databases" id="databases" name="databases" type="number"
name="databases"
type="number"
class="form-control @error('databases') is-invalid @enderror" class="form-control @error('databases') is-invalid @enderror"
required="required"> required="required">
@error('databases') @error('databases')
@ -254,9 +245,8 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="backups">{{ __('Backups') }}</label> <label for="backups">{{ __('Backups') }}</label>
<input value="{{$product->backups ?? old('backups') ?? 1}}" id="backups" <input value="{{ $product->backups ?? (old('backups') ?? 1) }}"
name="backups" id="backups" name="backups" type="number"
type="number"
class="form-control @error('backups') is-invalid @enderror" class="form-control @error('backups') is-invalid @enderror"
required="required"> required="required">
@error('backups') @error('backups')
@ -282,24 +272,25 @@
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<h5 class="card-title">{{ __('Product Linking') }} <h5 class="card-title">{{ __('Product Linking') }}
<i data-toggle="popover" <i data-toggle="popover" data-trigger="hover"
data-trigger="hover"
data-content="{{ __('Link your products to nodes and eggs to create dynamic pricing for each option') }}" data-content="{{ __('Link your products to nodes and eggs to create dynamic pricing for each option') }}"
class="fas fa-info-circle"></i></h5> class="fas fa-info-circle"></i>
</h5>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="form-group"> <div class="form-group">
<label for="nodes">{{ __('Nodes') }}</label> <label for="nodes">{{ __('Nodes') }}</label>
<select id="nodes" style="width:100%" <select id="nodes" style="width:100%"
class="custom-select @error('nodes') is-invalid @enderror" class="custom-select @error('nodes') is-invalid @enderror" name="nodes[]"
name="nodes[]" multiple="multiple" autocomplete="off"> multiple="multiple" autocomplete="off">
@foreach ($locations as $location) @foreach ($locations as $location)
<optgroup label="{{ $location->name }}"> <optgroup label="{{ $location->name }}">
@foreach ($location->nodes as $node) @foreach ($location->nodes as $node)
<option <option
@if(isset($product)) @if($product->nodes->contains('id' , $node->id)) selected @if (isset($product)) @if ($product->nodes->contains('id', $node->id)) selected @endif
@endif @endif value="{{$node->id}}">{{$node->name}}</option> @endif
value="{{ $node->id }}">{{ $node->name }}</option>
@endforeach @endforeach
</optgroup> </optgroup>
@endforeach @endforeach
@ -318,14 +309,15 @@
<div class="form-group"> <div class="form-group">
<label for="eggs">{{ __('Eggs') }}</label> <label for="eggs">{{ __('Eggs') }}</label>
<select id="eggs" style="width:100%" <select id="eggs" style="width:100%"
class="custom-select @error('eggs') is-invalid @enderror" class="custom-select @error('eggs') is-invalid @enderror" name="eggs[]"
name="eggs[]" multiple="multiple" autocomplete="off"> multiple="multiple" autocomplete="off">
@foreach ($nests as $nest) @foreach ($nests as $nest)
<optgroup label="{{ $nest->name }}"> <optgroup label="{{ $nest->name }}">
@foreach ($nest->eggs as $egg) @foreach ($nest->eggs as $egg)
<option <option
@if(isset($product)) @if($product->eggs->contains('id' , $egg->id)) selected @if (isset($product)) @if ($product->eggs->contains('id', $egg->id)) selected @endif
@endif @endif value="{{$egg->id}}">{{$egg->name}}</option> @endif
value="{{ $egg->id }}">{{ $egg->name }}</option>
@endforeach @endforeach
</optgroup> </optgroup>
@endforeach @endforeach
@ -340,7 +332,8 @@
</div> </div>
</div> </div>
<div class="text-muted"> <div class="text-muted">
{{__('No Eggs or Nodes shown?')}} <a href="{{route('admin.overview.sync')}}">{{__("Sync now")}}</a> {{ __('No Eggs or Nodes shown?') }} <a
href="{{ route('admin.overview.sync') }}">{{ __('Sync now') }}</a>
</div> </div>
</div> </div>
</div> </div>

View file

@ -36,9 +36,12 @@
@if ($product->servers()->count() > 0) @if ($product->servers()->count() > 0)
<div class="callout callout-danger"> <div class="callout callout-danger">
<h4>{{ __('Editing the resource options will not automatically update the servers on <h4>{{ __('Editing the resource options will not automatically update the servers on
pterodactyls side!')}}'</h4> pterodactyls side!') }}'
<p class="text-muted">{{__('Automatically updating resource options on pterodactyl side is on </h4>
my todo list :)')}}</p> <p class="text-muted">
{{ __('Automatically updating resource options on pterodactyl side is on
my todo list :)') }}
</p>
</div> </div>
@endif @endif
@ -50,8 +53,9 @@
<div class="d-flex flex-row-reverse"> <div class="d-flex flex-row-reverse">
<div class="custom-control custom-switch"> <div class="custom-control custom-switch">
<input type="checkbox" @if($product->disabled) checked @endif name="disabled" <input type="checkbox" @if ($product->disabled) checked @endif
class="custom-control-input custom-control-input-danger" id="switch1"> name="disabled" class="custom-control-input custom-control-input-danger"
id="switch1">
<label class="custom-control-label" for="switch1">{{ __('Disabled') }} <i <label class="custom-control-label" for="switch1">{{ __('Disabled') }} <i
data-toggle="popover" data-trigger="hover" data-toggle="popover" data-trigger="hover"
data-content="{{ __('Will hide this option from being selected') }}" data-content="{{ __('Will hide this option from being selected') }}"
@ -64,8 +68,8 @@
<div class="form-group"> <div class="form-group">
<label for="name">{{ __('Name') }}</label> <label for="name">{{ __('Name') }}</label>
<input value="{{ $product->name }}" id="name" name="name" type="text" <input value="{{ $product->name }}" id="name" name="name"
class="form-control @error('name') is-invalid @enderror" type="text" class="form-control @error('name') is-invalid @enderror"
required="required"> required="required">
@error('name') @error('name')
<div class="invalid-feedback"> <div class="invalid-feedback">
@ -77,8 +81,7 @@
<div class="form-group"> <div class="form-group">
<label for="price">{{ __('Price in') }} {{ $credits_display_name }}</label> <label for="price">{{ __('Price in') }} {{ $credits_display_name }}</label>
<input value="{{ $product->price }}" id="price" name="price" <input value="{{ $product->price }}" id="price" name="price"
type="number" type="number" step=".0001"
step="0.0001"
class="form-control @error('price') is-invalid @enderror" class="form-control @error('price') is-invalid @enderror"
required="required"> required="required">
@error('price') @error('price')
@ -91,8 +94,7 @@
<div class="form-group"> <div class="form-group">
<label for="memory">{{ __('Memory') }}</label> <label for="memory">{{ __('Memory') }}</label>
<input value="{{ $product->memory }}" id="memory" name="memory" <input value="{{ $product->memory }}" id="memory" name="memory"
type="number" type="number" class="form-control @error('memory') is-invalid @enderror"
class="form-control @error('memory') is-invalid @enderror"
required="required"> required="required">
@error('memory') @error('memory')
<div class="invalid-feedback"> <div class="invalid-feedback">
@ -104,8 +106,7 @@
<div class="form-group"> <div class="form-group">
<label for="cpu">{{ __('Cpu') }}</label> <label for="cpu">{{ __('Cpu') }}</label>
<input value="{{ $product->cpu }}" id="cpu" name="cpu" type="number" <input value="{{ $product->cpu }}" id="cpu" name="cpu" type="number"
class="form-control @error('cpu') is-invalid @enderror" class="form-control @error('cpu') is-invalid @enderror" required="required">
required="required">
@error('cpu') @error('cpu')
<div class="invalid-feedback"> <div class="invalid-feedback">
{{ $message }} {{ $message }}
@ -115,8 +116,8 @@
<div class="form-group"> <div class="form-group">
<label for="swap">{{ __('Swap') }}</label> <label for="swap">{{ __('Swap') }}</label>
<input value="{{ $product->swap }}" id="swap" name="swap" type="number" <input value="{{ $product->swap }}" id="swap" name="swap"
class="form-control @error('swap') is-invalid @enderror" type="number" class="form-control @error('swap') is-invalid @enderror"
required="required"> required="required">
@error('swap') @error('swap')
<div class="invalid-feedback"> <div class="invalid-feedback">
@ -126,8 +127,8 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="allocations">{{ __('Allocations') }}</label> <label for="allocations">{{ __('Allocations') }}</label>
<input value="{{ $product->allocations }}" id="allocations" <input value="{{ $product->allocations }}" id="allocations" name="allocations"
name="allocations" type="number" type="number"
class="form-control @error('allocations') is-invalid @enderror" class="form-control @error('allocations') is-invalid @enderror"
required="required"> required="required">
@error('allocations') @error('allocations')
@ -141,10 +142,8 @@
data-trigger="hover" data-trigger="hover"
data-content="{{ __('This is what the users sees') }}" data-content="{{ __('This is what the users sees') }}"
class="fas fa-info-circle"></i></label> class="fas fa-info-circle"></i></label>
<textarea id="description" name="description" <textarea id="description" name="description" type="text"
type="text" class="form-control @error('description') is-invalid @enderror" required="required">{{ $product->description }}</textarea>
class="form-control @error('description') is-invalid @enderror"
required="required">{{$product->description}}</textarea>
@error('description') @error('description')
<div class="invalid-feedback"> <div class="invalid-feedback">
{{ $message }} {{ $message }}
@ -153,11 +152,11 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<input type="checkbox" @if($product->oom_killer) checked @endif value="1" id="oom" name="oom_killer" <input type="checkbox" @if ($product->oom_killer) checked @endif
class=""> value="1" id="oom" name="oom_killer" class="">
<label for="oom_killer">{{__('OOM Killer')}} <i <label for="oom_killer">{{ __('OOM Killer') }} <i data-toggle="popover"
data-toggle="popover" data-trigger="hover" data-trigger="hover"
data-content="{{ __('Enable or Disable the OOM Killer for this Product.') }}" data-content="{{ __('Enable or Disable the OOM Killer for this Product.') }}"
class="fas fa-info-circle"></i></label> class="fas fa-info-circle"></i></label>
</div> </div>
@ -166,8 +165,8 @@
<div class="col-lg-6"> <div class="col-lg-6">
<div class="form-group"> <div class="form-group">
<label for="disk">{{ __('Disk') }}</label> <label for="disk">{{ __('Disk') }}</label>
<input value="{{ $product->disk }}" id="disk" name="disk" type="number" <input value="{{ $product->disk }}" id="disk" name="disk"
class="form-control @error('disk') is-invalid @enderror" type="number" class="form-control @error('disk') is-invalid @enderror"
required="required"> required="required">
@error('disk') @error('disk')
<div class="invalid-feedback"> <div class="invalid-feedback">
@ -182,34 +181,31 @@
data-content="{{ __('Period when the user will be charged for the given price') }}" data-content="{{ __('Period when the user will be charged for the given price') }}"
class="fas fa-info-circle"></i></label> class="fas fa-info-circle"></i></label>
<select id="billing_period" style="width:100%" class="custom-select" name="billing_period" required <select id="billing_period" style="width:100%" class="custom-select"
autocomplete="off" @error('billing_period') is-invalid @enderror> name="billing_period" required autocomplete="off"
<option value="hourly" @if ($product->billing_period == 'hourly') selected @error('billing_period') is-invalid @enderror>
@endif> <option value="hourly" @if ($product->billing_period == 'hourly') selected @endif>
{{ __('Hourly') }} {{ __('Hourly') }}
</option> </option>
<option value="daily" @if ($product->billing_period == 'daily') selected <option value="daily" @if ($product->billing_period == 'daily') selected @endif>
@endif>
{{ __('Daily') }} {{ __('Daily') }}
</option> </option>
<option value="weekly" @if ($product->billing_period == 'weekly') selected <option value="weekly" @if ($product->billing_period == 'weekly') selected @endif>
@endif>
{{ __('Weekly') }} {{ __('Weekly') }}
</option> </option>
<option value="monthly" @if ($product->billing_period == 'monthly') selected <option value="monthly" @if ($product->billing_period == 'monthly') selected @endif>
@endif>
{{ __('Monthly') }} {{ __('Monthly') }}
</option> </option>
<option value="quarterly" @if ($product->billing_period == 'quarterly') selected <option value="quarterly"
@endif> @if ($product->billing_period == 'quarterly') selected @endif>
{{ __('Quarterly') }} {{ __('Quarterly') }}
</option> </option>
<option value="half-annually" @if ($product->billing_period == 'half-annually') selected <option value="half-annually"
@endif> @if ($product->billing_period == 'half-annually') selected @endif>
{{ __('Half Annually') }} {{ __('Half Annually') }}
</option> </option>
<option value="annually" @if ($product->billing_period == 'annually') selected <option value="annually"
@endif> @if ($product->billing_period == 'annually') selected @endif>
{{ __('Annually') }} {{ __('Annually') }}
</option> </option>
</select> </select>
@ -221,8 +217,8 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="minimum_credits">{{__('Minimum')}} {{ $credits_display_name }} <i <label for="minimum_credits">{{ __('Minimum') }} {{ $credits_display_name }}
data-toggle="popover" data-trigger="hover" <i data-toggle="popover" data-trigger="hover"
data-content="{{ __('Setting to -1 will use the value from configuration.') }}" data-content="{{ __('Setting to -1 will use the value from configuration.') }}"
class="fas fa-info-circle"></i></label> class="fas fa-info-circle"></i></label>
<input value="{{ $product->minimum_credits }}" id="minimum_credits" <input value="{{ $product->minimum_credits }}" id="minimum_credits"
@ -237,8 +233,8 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="io">{{ __('IO') }}</label> <label for="io">{{ __('IO') }}</label>
<input value="{{ $product->io }}" id="io" name="io" type="number" <input value="{{ $product->io }}" id="io" name="io"
class="form-control @error('io') is-invalid @enderror" type="number" class="form-control @error('io') is-invalid @enderror"
required="required"> required="required">
@error('io') @error('io')
<div class="invalid-feedback"> <div class="invalid-feedback">
@ -287,10 +283,10 @@
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<h5 class="card-title">{{ __('Product Linking') }} <h5 class="card-title">{{ __('Product Linking') }}
<i data-toggle="popover" <i data-toggle="popover" data-trigger="hover"
data-trigger="hover"
data-content="{{ __('Link your products to nodes and eggs to create dynamic pricing for each option') }}" data-content="{{ __('Link your products to nodes and eggs to create dynamic pricing for each option') }}"
class="fas fa-info-circle"></i></h5> class="fas fa-info-circle"></i>
</h5>
</div> </div>
<div class="card-body"> <div class="card-body">
@ -302,8 +298,8 @@
@foreach ($locations as $location) @foreach ($locations as $location)
<optgroup label="{{ $location->name }}"> <optgroup label="{{ $location->name }}">
@foreach ($location->nodes as $node) @foreach ($location->nodes as $node)
<option @if($product->nodes->contains('id' , $node->id)) selected <option @if ($product->nodes->contains('id', $node->id)) selected @endif
@endif value="{{$node->id}}">{{$node->name}}</option> value="{{ $node->id }}">{{ $node->name }}</option>
@endforeach @endforeach
</optgroup> </optgroup>
@endforeach @endforeach
@ -326,8 +322,8 @@
@foreach ($nests as $nest) @foreach ($nests as $nest)
<optgroup label="{{ $nest->name }}"> <optgroup label="{{ $nest->name }}">
@foreach ($nest->eggs as $egg) @foreach ($nest->eggs as $egg)
<option @if($product->eggs->contains('id' , $egg->id)) selected <option @if ($product->eggs->contains('id', $egg->id)) selected @endif
@endif value="{{$egg->id}}">{{$egg->name}}</option> value="{{ $egg->id }}">{{ $egg->name }}</option>
@endforeach @endforeach
</optgroup> </optgroup>
@endforeach @endforeach
@ -362,5 +358,4 @@
$('[data-toggle="popover"]').popover(); $('[data-toggle="popover"]').popover();
}); });
</script> </script>
@endsection @endsection