Skip to content

A free open source IT asset/license management system

Added stacked prop for modals who need to be vertical

snipe5da61244ff70
diff --git a/resources/views/blade/form/row.blade.php b/resources/views/blade/form/row.blade.php
index 4f5507b4ad..54d6a950f0 100644
--- a/resources/views/blade/form/row.blade.php
+++ b/resources/views/blade/form/row.blade.php
@@ -26,6 +26,18 @@
'end_date' => null,
'default_now' => true,
'side_by_side' => false,
+ // stacked=true flips the layout from horizontal (col-md-3 label +
+ // col-md-7 input + col-md-9 col-md-offset-3 help) to vertical (bare
+ // label above bare input, help + error directly under). Use inside
+ // modals / filter bars / anywhere the parent form isn't .form-horizontal.
+ 'stacked' => false,
+ // Explicit input id override. Defaults to $name. Used by transient
+ // forms (modals) with pre-existing JS selectors keyed off a distinct id.
+ 'id' => null,
+ // Explicit required override. Defaults to Helper::checkIfRequired($item, $name).
+ // Used by transient forms with no bound model (modals, bulk-checkout,
+ // etc.) where the auto-detection has nothing to introspect.
+ 'required' => null,
])
@php
@@ -35,97 +47,108 @@
// first extractPropNames() pass. Sibling components x-form.checkbox-row
// and x-form.radio-row do the same thing.
$errors_class = $errors->has($name) ? ' has-error' : '';
+
+ $input_id = $id ?? $name;
+ $is_required = $required ?? Helper::checkIfRequired($item, $name);
+
+ $blade_type = in_array($type, ['text', 'email', 'url', 'tel', 'number', 'password']) ? 'text' : $type;
+
+ // Maxlength precedence:
+ // 1. Explicit :maxlength="..." from the caller (always wins).
+ // 2. Model rules — Helper::fieldMaxLength reads `max:N` from the
+ // model's validation rules so the browser cap matches the DB
+ // column width automatically. Applied to all types except
+ // textarea/number (textareas back TEXT columns with no length
+ // limit; browsers ignore maxlength on type="number").
+ // 3. Fallback 191 for text-family types (matches the vast majority
+ // of varchar(191) columns in this schema).
+ $effective_maxlength = $maxlength
+ ?? ($type !== 'textarea' && $type !== 'number' ? Helper::fieldMaxLength($item, $name) : null)
+ ?? (in_array($type, ['text', 'email', 'url', 'tel', 'password']) ? 191 : null);
@endphp
<div {{ $attributes->merge(['class' => 'form-group'. $errors_class]) }}>
<!-- form label -->
@if (isset($label))
- <x-form.label :for="$name" class="{{ $label_class }}">{{ $label }}</x-form.label>
+ @if ($stacked)
+ <label for="{{ $input_id }}">{{ $label }}</label>
+ @else
+ <x-form.label :for="$input_id" class="{{ $label_class }}">{{ $label }}</x-form.label>
+ @endif
@endif
-
- @php
- $blade_type = in_array($type, ['text', 'email', 'url', 'tel', 'number', 'password']) ? 'text' : $type;
-
- // Maxlength precedence:
- // 1. Explicit :maxlength="..." from the caller (always wins).
- // 2. Model rules — Helper::fieldMaxLength reads `max:N` from the
- // model's validation rules so the browser cap matches the DB
- // column width automatically. Applied to all types except
- // textarea/number (textareas back TEXT columns with no length
- // limit; browsers ignore maxlength on type="number").
- // 3. Fallback 191 for text-family types (matches the vast majority
- // of varchar(191) columns in this schema).
- $effective_maxlength = $maxlength
- ?? ($type !== 'textarea' && $type !== 'number' ? Helper::fieldMaxLength($item, $name) : null)
- ?? (in_array($type, ['text', 'email', 'url', 'tel', 'password']) ? 191 : null);
- @endphp
-
+ {{-- Input rendering. Stacked mode drops the col-md-7 wrapper so
+ the input sits directly under the label; horizontal mode wraps
+ in the input_div_class column so it grids with the label. --}}
+ @if (! $stacked)
<div class="{{ $input_div_class }}">
- {{-- You can pass an <x-slot:input>...</x-slot:input> when the
- field needs custom markup (e.g. an input plus a select side
- by side, or a widget the input.* components don't cover).
- The wrapping label + error + help + aria still come from
- <x-form.row>, so only the input area is hand-authored. --}}
- @isset($input)
- {{ $input }}
- @elseif ($blade_type === 'colorpicker')
- {{-- Widget-shaped inputs (colorpicker, datepicker, etc.) don't share
- the text-family prop shape, so dispatch them explicitly with
- only the props they accept. Avoids leaking type/input_icon/
- maxlength/etc. as bogus HTML attrs on the widget's outer div. --}}
- <x-input.colorpicker
- :name="$name"
- :id="$name"
- :item="$item"
- :default="$default"
- />
- @elseif ($blade_type === 'datepicker')
- {{-- $item->{$name} may be a Carbon (models that cast the
- column to `date`, e.g. License::purchase_date) or a
- plain string. Normalize to Y-m-d via strtotime so the
- datepicker JS can parse it. Without this, Carbon
- stringifies as "Y-m-d H:i:s", the picker fails to
- parse it, renders blank, and submit wipes the field. --}}
- <x-input.datepicker
- :name="$name"
- :id="$name"
- :value="old($name, $item?->{$name} ? date('Y-m-d', strtotime((string) $item->{$name})) : $default)"
- :required="Helper::checkIfRequired($item, $name)"
- :placeholder="$placeholder"
- :end_date="$end_date"
- />
- @elseif ($blade_type === 'datetimepicker')
- <x-input.datetimepicker
- :name="$name"
- :id="$name"
- :value="old($name, $item?->{$name}?->format('Y-m-d H:i:s') ?? $item?->{$name} ?? $default)"
- :required="Helper::checkIfRequired($item, $name)"
- :placeholder="$placeholder"
- :default_now="$default_now"
- :side_by_side="$side_by_side"
- />
- @else
- <x-dynamic-component
- :$name
- :$type
- :aria-label="$name"
- :aria-describedby="$help_text ? $name.'-help' : null"
- :component="'input.'.$blade_type"
- :id="$name"
- :required="Helper::checkIfRequired($item, $name)"
- :value="old($name, $item?->{$name})"
- :input_icon="$input_icon"
- :input_group_addon="$input_group_addon"
- :maxlength="$effective_maxlength"
- :min="$min"
- :max="$max"
- :rows="$rows"
- :placeholder="$placeholder"
- />
- @endisset
+ @endif
+ {{-- You can pass an <x-slot:input>...</x-slot:input> when the
+ field needs custom markup (e.g. an input plus a select side
+ by side, or a widget the input.* components don't cover).
+ The wrapping label + error + help + aria still come from
+ <x-form.row>, so only the input area is hand-authored. --}}
+ @isset($input)
+ {{ $input }}
+ @elseif ($blade_type === 'colorpicker')
+ {{-- Widget-shaped inputs (colorpicker, datepicker, etc.) don't share
+ the text-family prop shape, so dispatch them explicitly with
+ only the props they accept. Avoids leaking type/input_icon/
+ maxlength/etc. as bogus HTML attrs on the widget's outer div. --}}
+ <x-input.colorpicker
+ :name="$name"
+ :id="$input_id"
+ :item="$item"
+ :default="$default"
+ />
+ @elseif ($blade_type === 'datepicker')
+ {{-- $item->{$name} may be a Carbon (models that cast the
+ column to `date`, e.g. License::purchase_date) or a
+ plain string. Normalize to Y-m-d via strtotime so the
+ datepicker JS can parse it. Without this, Carbon
+ stringifies as "Y-m-d H:i:s", the picker fails to
+ parse it, renders blank, and submit wipes the field. --}}
+ <x-input.datepicker
+ :name="$name"
+ :id="$input_id"
+ :value="old($name, $item?->{$name} ? date('Y-m-d', strtotime((string) $item->{$name})) : $default)"
+ :required="$is_required"
+ :placeholder="$placeholder"
+ :end_date="$end_date"
+ />
+ @elseif ($blade_type === 'datetimepicker')
+ <x-input.datetimepicker
+ :name="$name"
+ :id="$input_id"
+ :value="old($name, $item?->{$name}?->format('Y-m-d H:i:s') ?? $item?->{$name} ?? $default)"
+ :required="$is_required"
+ :placeholder="$placeholder"
+ :default_now="$default_now"
+ :side_by_side="$side_by_side"
+ />
+ @else
+ <x-dynamic-component
+ :$name
+ :$type
+ :aria-label="$name"
+ :aria-describedby="$help_text ? $input_id.'-help' : null"
+ :component="'input.'.$blade_type"
+ :id="$input_id"
+ :required="$is_required"
+ :value="old($name, $item?->{$name})"
+ :input_icon="$input_icon"
+ :input_group_addon="$input_group_addon"
+ :maxlength="$effective_maxlength"
+ :min="$min"
+ :max="$max"
+ :rows="$rows"
+ :placeholder="$placeholder"
+ />
+ @endisset
+ @if (! $stacked)
</div>
+ @endif
{{-- Optional col-md-1 sibling of the input column for a small
action button (e.g. the "new" button next to a user select,
@@ -133,34 +156,34 @@
pass <x-slot:after_input>...</x-slot:after_input>. Matches
the manager-picker layout in x-input.user-select. --}}
@isset($after_input)
- <div class="col-md-1 col-sm-1 text-left">
+ <div @class(['col-md-1 col-sm-1 text-left' => ! $stacked])>
{{ $after_input }}
</div>
@endisset
@if ($info_tooltip_text)
<!-- Info Tooltip -->
- <div class="col-md-1 text-left" style="padding-left:0; margin-top: 5px;">
+ <div @class(['col-md-1 text-left' => ! $stacked]) style="padding-left:0; margin-top: 5px;">
<x-form.tooltip>
{{ $info_tooltip_text }}
</x-form.tooltip>
</div>
@endif
+ @if (! $stacked)
+ {{-- Force the help block onto a new grid row regardless of how
+ narrow the input column is. Without this, callers using
+ narrow input_div_class values (e.g. col-lg-3 for a number +
+ days addon) hit a case where label + input + help offset +
+ help width sum to exactly 12, and the help renders beside
+ the input instead of underneath it. --}}
+ <div class="clearfix"></div>
+ @endif
- {{-- Force the help block onto a new grid row regardless of how
- narrow the input column is. Without this, callers using
- narrow input_div_class values (e.g. col-lg-3 for a number +
- days addon) hit a case where label + input + help offset +
- help width sum to exactly 12, and the help renders beside
- the input instead of underneath it. --}}
- <div class="clearfix"></div>
-
- {{-- Error + help wrapper. Fixed at col-md-9 col-md-offset-3 so the
- help text always has room to breathe on its own row, regardless
- of how narrow the input column is. Offset aligns under the
- input column (which sits after the col-md-3 label). --}}
- <div class="col-md-9 col-md-offset-3">
+ {{-- Error + help wrapper. Horizontal mode pins them under the input
+ column via col-md-9 col-md-offset-3; stacked mode drops the
+ offset so they flow directly beneath the input. --}}
+ <div @class(['col-md-9 col-md-offset-3' => ! $stacked])>
<x-form.error :name="$name" />
@if ($help_text)
@@ -171,7 +194,7 @@
so the browser renders them as real characters. A plain
{{ }} here would escape a second time (&quot; -> &amp;quot;),
which is what shows up as literal &quot; in the page. --}}
- <x-form.help :name="$name" :icon="$help_icon">{!! $help_text !!}</x-form.help>
+ <x-form.help :name="$input_id" :icon="$help_icon">{!! $help_text !!}</x-form.help>
@elseif ($help_html)
{{-- Raw HTML help — the caller has opted in, we render unescaped
straight to the <p>. See the help_html prop docs above. Note:
@@ -180,7 +203,7 @@
dynamic-binding form :help_html="trans('...')" runs the
value through BladeCompiler::sanitizeComponentAttribute()
and turns your <a> tags into &lt;a&gt; entities. --}}
- <p class="help-block" id="{{ $name }}-help">
+ <p class="help-block" id="{{ $input_id }}-help">
@if ($help_icon)
<x-icon :type="$help_icon" />
@endif
diff --git a/resources/views/blade/form/stacked.blade.php b/resources/views/blade/form/stacked.blade.php
deleted file mode 100644
index 11eb91ac0b..0000000000
--- a/resources/views/blade/form/stacked.blade.php
+++ /dev/null
@@ -1,14 +0,0 @@
-{{-- Vertical form-group wrapper for stacked-form contexts (modals, filter
- bars, anywhere the parent form isn't .form-horizontal). Use x-form.row
- when the parent form is .form-horizontal and you want the full col-md-3
- label + col-md-7 input grid layout. --}}
-@props([
- 'name' => null,
-])
-
-<div {{ $attributes->class([
- 'form-group',
- 'has-error' => $name && $errors->has($name),
-]) }}>
- {{ $slot }}
-</div>
diff --git a/resources/views/blade/modals/adjust-quantity.blade.php b/resources/views/blade/modals/adjust-quantity.blade.php
index b2e5127cc8..c2d7e63a45 100644
--- a/resources/views/blade/modals/adjust-quantity.blade.php
+++ b/resources/views/blade/modals/adjust-quantity.blade.php
@@ -17,105 +17,110 @@
<strong class="adjust-quantity-available"></strong>
</p>
- <x-form.stacked name="amount">
- <label for="adjustQuantityAmount">{{ trans('general.adjust_quantity_amount') }}</label>
- {{-- min is populated by snipeit.js when the modal opens (–available). The
- browser stepper then refuses to go below and the built-in
- constraint-validation message surfaces if a user types past it.
- Zero is a valid input: it produces an audit-only QuantityAdjust
- log entry with no qty change so users can record a physical
- count against the current DB value. --}}
- <input type="number" class="form-control" id="adjustQuantityAmount" name="amount" step="1" required>
- <x-form.help name="adjustQuantityAmount">{{ trans('general.adjust_quantity_amount_help') }}</x-form.help>
- </x-form.stacked>
+ {{-- min is populated by snipeit.js when the modal opens (–available).
+ The browser stepper then refuses to go below and the built-in
+ constraint-validation message surfaces if a user types past it.
+ Zero is a valid input: it produces an audit-only QuantityAdjust
+ log entry with no qty change so users can record a physical
+ count against the current DB value. --}}
+ <x-form.row
+ stacked
+ id="adjustQuantityAmount"
+ name="amount"
+ type="number"
+ :label="trans('general.adjust_quantity_amount')"
+ :help_text="trans('general.adjust_quantity_amount_help')"
+ required
+ />
{{-- Acquisition-only fields (order_number, supplier, unit cost,
currency). Shown for positive qty changes and hidden by snipeit.js
when the amount is 0 or negative. Those cases are corrections or
losses rather than purchases, so purchase metadata doesn't apply. --}}
<div id="adjustQuantityAcquisitionFields">
- <x-form.stacked name="order_number">
- <label for="adjustQuantityOrder">{{ trans('general.order_number') }}</label>
- <input type="text" class="form-control" id="adjustQuantityOrder" name="order_number" maxlength="191">
- </x-form.stacked>
+ <x-form.row
+ stacked
+ id="adjustQuantityOrder"
+ name="order_number"
+ :label="trans('general.order_number')"
+ />
{{-- Inlined js-data-ajax select instead of x-input.supplier-select
because that component wraps its markup in x-form.row's
horizontal-form scaffold (col-md-3 label + col-md-7 input),
which fights the stacked form-group layout used across this
modal. snipeit.js auto-initializes any .js-data-ajax select. --}}
- <x-form.stacked name="supplier_id">
- <label for="adjustQuantitySupplier">{{ trans('general.supplier') }}</label>
- <select
- class="js-data-ajax form-control"
- data-endpoint="suppliers"
- data-placeholder="{{ trans('general.select_supplier') }}"
- name="supplier_id"
- id="adjustQuantitySupplier"
- style="width: 100%"
- aria-label="{{ trans('general.supplier') }}"
- >
- <option value=""></option>
- </select>
- </x-form.stacked>
+ <x-form.row stacked name="supplier_id" :label="trans('general.supplier')">
+ <x-slot:input>
+ <select
+ class="js-data-ajax form-control"
+ data-endpoint="suppliers"
+ data-placeholder="{{ trans('general.select_supplier') }}"
+ name="supplier_id"
+ id="adjustQuantitySupplier"
+ style="width: 100%"
+ aria-label="{{ trans('general.supplier') }}"
+ >
+ <option value=""></option>
+ </select>
+ </x-slot:input>
+ </x-form.row>
</div>
- <x-form.stacked name="purchase_date">
- {{-- Label swaps between "Purchase Date" (positive qty)
- and "Date" (0 or negative) via snipeit.js. --}}
+ {{-- Label swaps between "Purchase Date" (positive qty) and "Date" (0
+ or negative) via snipeit.js reading data-label-*. Hand-rolled
+ because x-form.row assumes a plain label string. Pre-populated
+ with today because most adjust events happen the day they are
+ recorded. Snipeit.js resets to today on every modal open so a
+ stale date can't bleed across sessions. --}}
+ <div class="form-group">
<label
for="adjustQuantityPurchaseDate"
id="adjustQuantityPurchaseDateLabel"
data-label-purchase="{{ trans('general.purchase_date') }}"
data-label-generic="{{ trans('general.date') }}"
>{{ trans('general.purchase_date') }}</label>
- {{-- Pre-populated with today's date because most
- adjust events happen the day they are recorded.
- Editable, and snipeit.js resets to today on
- every modal open so a stale date can't bleed
- across sessions. --}}
<x-input.datepicker
id="adjustQuantityPurchaseDate"
name="purchase_date"
:value="now()->toDateString()"
:end_date="'0d'"
/>
- </x-form.stacked>
+ </div>
- {{-- Unit cost + currency side by side. Bootstrap 3
- input-group doesn't handle a form-control addon
- cleanly (the addon slot expects a span, not a
- second input), so this uses a plain row / col
- split instead. Currency is editable and left
- blank on open. Pre-filling with the system
- default would assert info we don't have per
- event (Snipe-IT's historical currency handling
- is squishy already). Placeholder hints at the
- system default without stamping it. --}}
+ {{-- Unit cost + currency side by side. Bootstrap 3 input-group doesn't
+ handle a form-control addon cleanly (the addon slot expects a span,
+ not a second input), so this uses a plain row / col split instead.
+ Currency is editable and left blank on open: pre-filling with the
+ system default would assert info we don't have per event (Snipe-IT's
+ historical currency handling is squishy already). Placeholder hints
+ at the system default without stamping it. --}}
<div class="row" id="adjustQuantityCostRow">
- <x-form.stacked name="unit_cost" class="col-md-8" style="padding-right: 5px;">
- <label for="adjustQuantityUnitCost">{{ trans('general.unit_cost') }}</label>
- <input
- type="number"
- class="form-control"
- id="adjustQuantityUnitCost"
- name="unit_cost"
- step="0.0001"
- min="0"
- inputmode="decimal"
- >
- </x-form.stacked>
- <x-form.stacked name="currency" class="col-md-4" style="padding-left: 5px;">
- <label for="adjustQuantityCurrency">{{ trans('general.currency') }}</label>
- <input
- type="text"
- class="form-control"
- id="adjustQuantityCurrency"
- name="currency"
- maxlength="10"
- placeholder="{{ $snipeSettings->default_currency }}"
- >
- </x-form.stacked>
+ <x-form.row stacked class="col-md-8" style="padding-right: 5px;" name="unit_cost" :label="trans('general.unit_cost')">
+ <x-slot:input>
+ <input
+ type="number"
+ class="form-control"
+ id="adjustQuantityUnitCost"
+ name="unit_cost"
+ step="0.0001"
+ min="0"
+ inputmode="decimal"
+ >
+ </x-slot:input>
+ </x-form.row>
+ <x-form.row stacked class="col-md-4" style="padding-left: 5px;" name="currency" :label="trans('general.currency')">
+ <x-slot:input>
+ <input
+ type="text"
+ class="form-control"
+ id="adjustQuantityCurrency"
+ name="currency"
+ maxlength="10"
+ placeholder="{{ $snipeSettings->default_currency }}"
+ >
+ </x-slot:input>
+ </x-form.row>
</div>
{{-- Shown by snipeit.js when the modal opens with pre-populated
cost/currency from the trigger's data-last-* attrs. Hidden as
@@ -127,38 +132,40 @@
{{ trans('general.adjust_quantity_prefilled_from_last_order') }}
</x-form.help>
- <x-form.stacked name="note">
- <label for="adjustQuantityNote">{{ trans('general.notes') }}</label>
- <textarea class="form-control" id="adjustQuantityNote" name="note" rows="3" maxlength="65535" required></textarea>
- </x-form.stacked>
+ <x-form.row
+ stacked
+ id="adjustQuantityNote"
+ name="note"
+ type="textarea"
+ :rows="3"
+ :label="trans('general.notes')"
+ required
+ />
- {{-- Inlined instead of x-input.file-upload because that
- component wraps its markup in x-form.row, a Bootstrap 3
- horizontal-form scaffold (col-md-3 label + col-md-9
- input). The three fields above use vertical form-group
- styling, so the horizontal scaffold collided with the
- modal-footer top border. --}}
- <x-form.stacked name="file">
- <label for="adjustQuantityFile">{{ trans('general.file_upload') }}</label>
- <div>
- <label class="btn btn-sm btn-theme" for="adjustQuantityFile">
- {{ trans('button.select_file') }}
- <input
- type="file"
- name="file"
- class="js-uploadFile"
- id="adjustQuantityFile"
- data-maxsize="{{ \App\Helpers\Helper::file_upload_max_size() }}"
- accept="{{ config('filesystems.allowed_upload_mimetypes') }}"
- style="display:none"
- aria-label="file"
- aria-hidden="true"
- >
- </label>
- <span id="adjustQuantityFile-info"></span>
- <x-form.help name="adjustQuantityFile">
- {{ trans('general.upload_filetypes_help', ['allowed_filetypes' => config('filesystems.allowed_upload_extensions'), 'size' => \App\Helpers\Helper::file_upload_max_size_readable()]) }}
- </x-form.help>
- </div>
- </x-form.stacked>
+ {{-- Inlined instead of x-input.file-upload because that component wraps
+ its markup in x-form.row's horizontal scaffold. --}}
+ <x-form.row stacked name="file" :label="trans('general.file_upload')">
+ <x-slot:input>
+ <div>
+ <label class="btn btn-sm btn-theme" for="adjustQuantityFile">
+ {{ trans('button.select_file') }}
+ <input
+ type="file"
+ name="file"
+ class="js-uploadFile"
+ id="adjustQuantityFile"
+ data-maxsize="{{ \App\Helpers\Helper::file_upload_max_size() }}"
+ accept="{{ config('filesystems.allowed_upload_mimetypes') }}"
+ style="display:none"
+ aria-label="file"
+ aria-hidden="true"
+ >
+ </label>
+ <span id="adjustQuantityFile-info"></span>
+ <x-form.help name="adjustQuantityFile">
+ {{ trans('general.upload_filetypes_help', ['allowed_filetypes' => config('filesystems.allowed_upload_extensions'), 'size' => \App\Helpers\Helper::file_upload_max_size_readable()]) }}
+ </x-form.help>
+ </div>
+ </x-slot:input>
+ </x-form.row>
</x-modals>
diff --git a/resources/views/blade/modals/maintenance-complete.blade.php b/resources/views/blade/modals/maintenance-complete.blade.php
index 778d2a9b95..f9c30b2228 100644
--- a/resources/views/blade/modals/maintenance-complete.blade.php
+++ b/resources/views/blade/modals/maintenance-complete.blade.php
@@ -12,8 +12,12 @@
form_attrs='id="completeMaintenanceForm"'
>
<p>{{ trans('admin/maintenances/message.complete.confirm') }}</p>
- <x-form.stacked name="note">
- <label for="completionNote">{{ trans('admin/maintenances/form.completion_notes') }}</label>
- <textarea class="form-control" id="completionNote" name="note" rows="3"></textarea>
- </x-form.stacked>
+ <x-form.row
+ stacked
+ name="note"
+ id="completionNote"
+ type="textarea"
+ :rows="3"
+ :label="trans('admin/maintenances/form.completion_notes')"
+ />
</x-modals>
diff --git a/resources/views/blade/modals/request-item.blade.php b/resources/views/blade/modals/request-item.blade.php
index 22b6d815e9..3bb3ca1ccf 100644
--- a/resources/views/blade/modals/request-item.blade.php
+++ b/resources/views/blade/modals/request-item.blade.php
@@ -26,19 +26,16 @@
hidden input keeps request-quantity=1
posted so the server-side path stays
uniform across every requestable type. --}}
- <x-form.stacked name="request-quantity" id="requestItemQuantityRow">
- <label for="requestItemQuantity">{{ trans('general.qty') }}</label>
- <input
- type="number"
- class="form-control"
- id="requestItemQuantity"
- name="request-quantity"
- min="1"
- step="1"
- value="1"
- required
- >
- </x-form.stacked>
+ <x-form.row
+ stacked
+ id="requestItemQuantityRow"
+ name="request-quantity"
+ type="number"
+ :label="trans('general.qty')"
+ :min="1"
+ default="1"
+ required
+ />
{{-- Start / end dates are optional. Requesters who just
want "whenever this becomes available" leave both
@@ -47,20 +44,22 @@
end_date validates as after_or_equal:start_date in
the controller. --}}
<div class="row">
- <x-form.stacked name="start_date" class="col-md-6">
- <label for="requestItemStartDate">{{ trans('general.start_date') }}</label>
- <x-input.datepicker
- id="requestItemStartDate"
- name="start_date"
- />
- </x-form.stacked>
- <x-form.stacked name="end_date" class="col-md-6">
- <label for="requestItemEndDate">{{ trans('general.end_date') }}</label>
- <x-input.datepicker
- id="requestItemEndDate"
- name="end_date"
- />
- </x-form.stacked>
+ <x-form.row
+ stacked
+ class="col-md-6"
+ id="requestItemStartDate"
+ name="start_date"
+ type="datepicker"
+ :label="trans('general.start_date')"
+ />
+ <x-form.row
+ stacked
+ class="col-md-6"
+ id="requestItemEndDate"
+ name="end_date"
+ type="datepicker"
+ :label="trans('general.end_date')"
+ />
</div>
{{-- Optional free-text notes so the requester can
@@ -69,13 +68,12 @@
checkout_requests.notes and surfaced on the
admin queue + in the "new request"
notification. --}}
- <x-form.stacked name="notes">
- <label for="requestItemNotes">{{ trans('general.notes') }}</label>
- <textarea
- id="requestItemNotes"
- name="notes"
- class="form-control"
- rows="3"
- ></textarea>
- </x-form.stacked>
+ <x-form.row
+ stacked
+ id="requestItemNotes"
+ name="notes"
+ type="textarea"
+ :rows="3"
+ :label="trans('general.notes')"
+ />
</x-modals>