ldc-crm/resources/views/bo/partials/inputs/int-number.blade.php
2023-10-06 16:37:30 +02:00

57 lines
2.4 KiB
PHP

{{--
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 @if($errors->has($name)) is-invalid @endif"
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
@if(!empty($required))
required
@endif>
@if(isset($appendText))
<label class="input-group-text">{{ $appendText }}</label>
</div>
@endif
@include('modules.input-error', [
'inputName' => $name,
'helperId' => '{{ $id }}Help',
'helper' => $helper
])