ldc-gen-game-web/resources/views/partials/inputs/int-number.blade.php
2023-12-06 16:39:21 +01:00

61 lines
2.5 KiB
PHP

{{-- blade-formatter-disable --}}
{{--
VARIABLE || COMMENT || TYPE || REQUIRED || DEFAULT
$id || The id of the input tag. || string || REQUIRED ||
$name || The name of the input tag. || string || REQUIRED ||
$helper || The helper of the input. || string || REQUIRED ||
$label || The text displayed as a label. || string || OPTIONNAL || null
$appendText || The text to append to the left
of the input. || string || OPTIONNAL || null
$required || Is the field required ? || boolean || OPTIONNAL || false
$value || The default value of the input. || integer || OPTIONNAL || 0
$step || The step of the input. || integer || OPTIONNAL || 1
$unsigned || Is the value unsigned ? || boolean || OPTIONNAL || false
$min || The min value of the input. || integer || OPTIONNAL || !empty($unsigned) ? 0 : -2147483648
$max || The max value of the input. || integer || OPTIONNAL || !empty($unsigned) ? 4294967295 : 2147483647
$model || The model we're creating/editing || Model class || OPTIONNAL || null
--}}
@if(!empty($label))
<label for="{{ $id }}" class="col-form-label">
<b>{{ $label }} {{ $required ?? false ? '*' : '' }}</b>
</label>
@endif
@if(isset($appendText))
<div class="input-group">
@endif
<input id="{{ $id }}"
name="{{ $name }}"
type="number"
value="{{ Str::replace(',', '.', strval(old($name, $value ?? $model->{$name} ?? 0))) }}"
@class([
'form-control',
'is-invalid' => $errors->has($name)
])
aria-describedby="{{ $id }}Help"
@if(!empty($step))
step="{{ Str::replace(',', '.', strval($step)) }}"
@else step="1"
@endif
@if(!empty($max))
max="{{ $max }}"
@else
max="{{ !empty($unsigned) ? '4294967295' : '2147483647' }}"
@endif
@if(!empty($min)) min="{{ $min }}"
@else
min="{{ !empty($unsigned) ? '0' : '-2147483648' }}"
@endif
@disabled(!empty($disabled))
@readonly(!empty($readonly))
@required(!empty($required))>
@if(isset($appendText))
<label class="input-group-text">{{ $appendText }}</label>
</div>
@endif
@include('modules.input-error', [
'inputName' => $name,
'helperId' => "{$id}Help",
'helper' => $helper
])