Skip to content

A free open source IT asset/license management system

Rejiggered the UI a little

snipe947e1027f545
diff --git a/resources/views/blade/checkout-request-context.blade.php b/resources/views/blade/checkout-request-context.blade.php
index 46a87f2db9..1ae0ffb5a4 100644
--- a/resources/views/blade/checkout-request-context.blade.php
+++ b/resources/views/blade/checkout-request-context.blade.php
@@ -1,14 +1,20 @@
@props([
'request' => null,
- 'others' => null,
+ 'requestable' => null,
])
-{{-- Rendered on the four checkout screens (asset / accessory /
- consumable / component / license) when the admin arrived from
- a /requests row (?request_id=N). Two boxes: the current request
- for context, and the waiting list of other open requesters so
- the admin can arbitrate who gets it. Renders nothing when
- $request is null, so callers can drop it in unconditionally. --}}
+{{-- Rendered on the four single-target checkout screens (asset /
+ accessory / consumable / component / license) when the admin
+ arrived from a /requests row (?request_id=N). Shows the current
+ request for context. When there are additional pending
+ requesters for the SAME requestable, appends a "bulk fulfill N
+ open requests" link (same shape as the info-panel widget) that
+ jumps to the bulk-fulfill screen where those siblings can be
+ processed in one pass - the single-target screen only lets
+ admin fulfill ONE request at a time, so listing the others
+ inline was dead information.
+
+ Renders nothing when $request is null --}}
@if (! empty($request))
<x-box header="{{ trans('admin/hardware/general.requested') }}">
<x-page-data>
@@ -42,48 +48,19 @@
{{ $request->notes }}
</x-data-row>
@endif
+
+ {{-- "Other requesters + bulk-fulfill" link. Requestable::
+ bulkFulfillmentLink() gates on: (a) type is bulk-
+ eligible, (b) caller can checkout, (c) >=2 open
+ requests total, (d) stock available. Returns null
+ when any gate fails so the row is skipped. --}}
+ @if ($requestable && method_exists($requestable, 'bulkFulfillmentLink') && $bulkFulfillmentLink = $requestable->bulkFulfillmentLink())
+ <x-data-row :label="trans('admin/hardware/table.pending_requesters')" icon_type="fulfill_multiple">
+ <a href="{{ $bulkFulfillmentLink['url'] }}">
+ {{ trans_choice('admin/hardware/general.open_requests_count', $bulkFulfillmentLink['count'], ['count' => $bulkFulfillmentLink['count']]) }}
+ </a>
+ </x-data-row>
+ @endif
</x-page-data>
</x-box>
-
- @if (! empty($others) && $others->isNotEmpty())
- <x-box header="{{ trans('admin/hardware/table.pending_requesters') }}">
- @foreach ($others as $pending)
- @if (! $loop->first)
- <hr>
- @endif
- <x-page-data>
- <x-data-row :label="trans('admin/hardware/table.requesting_user')">
- <a href="{{ route('users.show', $pending->user->id) }}">{{ $pending->user->display_name }}</a>
- </x-data-row>
-
- <x-data-row :label="trans('admin/hardware/table.requested_date')" icon_type="calendar">
- {{ $pending->created_at->format($snipeSettings->date_display_format.' '.$snipeSettings->time_display_format) }}
- <span class="text-muted">{{ $pending->created_at->diffForHumans(['parts' => 2]) }}</span>
- </x-data-row>
-
- <x-data-row :label="trans('admin/hardware/general.requested')">
- {{ (int) $pending->quantity }}
- </x-data-row>
-
- @if ($pending->start_date)
- <x-data-row :label="trans('general.start_date')" icon_type="start_date">
- {{ $pending->start_date->format($snipeSettings->date_display_format) }}
- </x-data-row>
- @endif
-
- @if ($pending->end_date)
- <x-data-row :label="trans('general.end_date')" icon_type="end_date">
- {{ $pending->end_date->format($snipeSettings->date_display_format) }}
- </x-data-row>
- @endif
-
- @if ($pending->notes)
- <x-data-row :label="trans('general.notes')">
- {{ $pending->notes }}
- </x-data-row>
- @endif
- </x-page-data>
- @endforeach
- </x-box>
- @endif
@endif
diff --git a/resources/views/blade/checkout/asset-picker-row.blade.php b/resources/views/blade/checkout/asset-picker-row.blade.php
index 06aef81f8d..82205fd82d 100644
--- a/resources/views/blade/checkout/asset-picker-row.blade.php
+++ b/resources/views/blade/checkout/asset-picker-row.blade.php
@@ -5,6 +5,7 @@
'showQty' => true,
'maxQty' => null,
'defaultChecked' => false,
+ 'defaultAssetId' => null,
'emptyMessage' => null,
])
@@ -21,83 +22,82 @@
typical scope, and the "auto-pick next available" default just
falls out of pre-selecting the first option.
- Field shape matches the user-target recipient-row so the
- controller-side per-row iteration stays uniform:
+ Rows whose available-asset set is empty render as a short
+ info-only card (no fields, no submit checkbox) with an inline
+ explanation so the admin sees WHY that requester can't be
+ fulfilled from this screen. Rows with assets render the full
+ picker + qty + notes shape.
+
+ Field shape matches the user-target recipient-row:
enabled_requests[] = list of request ids ticked
asset_id[<request_id>] = target asset for that row
qty[<request_id>] = qty for that row (or 1 if showQty=false)
notes[<request_id>] = admin/checkout note --}}
-<fieldset class="form-group has-feedback" style="border: 1px solid #ddd; border-radius: 4px; padding: 15px; margin-bottom: 20px;">
- <legend class="col-sm-3 col-md-3 control-label" style="width: auto; padding: 0 10px; border: 0; margin-bottom: 0;">
- <label class="form-control" style="display: inline-flex; align-items: center; gap: 8px; margin-bottom: 0;">
- <input
- type="checkbox"
- name="enabled_requests[]"
- value="{{ (int) $request->id }}"
- @checked($defaultChecked || in_array((int) $request->id, (array) old('enabled_requests', []), true))
- @if ($availableAssets->isEmpty()) disabled @endif
- aria-label="{{ trans('general.fulfill') }} #{{ $request->id }}"
- >
- <span>#{{ $request->id }}</span>
- @if ($requester)
- <span class="text-muted">
- &mdash; {{ $requester->display_name }}
- </span>
- @endif
- </label>
- </legend>
- <div class="form-group {{ $errors->has('asset_id.'.$request->id) ? 'has-error' : '' }}">
+<hr style="border-color: var(--table-border-row-color); margin-bottom: 15px;">
+
+<div class="form-group" style="{{ $availableAssets->isEmpty() ? 'opacity: 0.7;' : '' }}">
+ <div class="col-md-3">
+ <x-form.checkbox-inline
+ name="enabled_requests[{{ $request->id }}]"
+ value="1"
+ :checked="$defaultChecked || old('enabled_requests.'.$request->id) === '1'"
+ :disabled="$availableAssets->isEmpty()"
+ :label="$requester?->display_name ?? '#'.$request->id"
+ />
+ </div>
+ <div class="col-md-7" style="padding-top: 7px;">
+ @if ($request->notes)
+ &ldquo;{{ $request->notes }}&rdquo;
+ @endif
+ <span class="text-muted">
+ - {{ $request->created_at->diffForHumans() }}
+ </span>
+ </div>
+</div>
+
+@if ($availableAssets->isNotEmpty())
+ {{-- Native <x-input.asset-select> is ajax-select2 backed and
+ wants a data-endpoint feed; here we already have the small
+ deterministic pool in hand and want a plain <select>, so
+ hand-roll the picker inside a standard form-row shell. --}}
+ <div
+ @class([
+ 'form-group',
+ 'has-error' => $errors->has('asset_id.'.$request->id),
+ ])
+ >
<label for="fulfill-asset-{{ $request->id }}" class="col-md-3 control-label">
{{ trans('general.asset') }}
</label>
<div class="col-md-7">
- @if ($availableAssets->isEmpty())
- <p class="form-control-static text-muted">
- <em>{{ $emptyMessage ?? trans('general.no_results') }}</em>
- </p>
- @else
- <select
- class="form-control select2"
- id="fulfill-asset-{{ $request->id }}"
- name="asset_id[{{ $request->id }}]"
- aria-label="{{ trans('general.asset') }}"
- >
- @foreach ($availableAssets as $asset)
- <option
- value="{{ $asset->id }}"
- @selected(old('asset_id.'.$request->id, $availableAssets->first()->id) == $asset->id)
- >
- {{ $asset->present()->fullName }}
- </option>
- @endforeach
- </select>
- @endif
- <div class="col-md-8" style="padding-left: 0;">
- <x-form.error :name="'asset_id.'.$request->id" />
- </div>
+ <select
+ class="form-control select2"
+ id="fulfill-asset-{{ $request->id }}"
+ name="asset_id[{{ $request->id }}]"
+ aria-label="{{ trans('general.asset') }}"
+ >
+ @foreach ($availableAssets as $asset)
+ <option
+ value="{{ $asset->id }}"
+ @selected(old('asset_id.'.$request->id, $defaultAssetId ?? $availableAssets->first()->id) == $asset->id)
+ >
+ {{ $asset->present()->fullName }}
+ </option>
+ @endforeach
+ </select>
+ <x-form.error :name="'asset_id.'.$request->id"/>
</div>
</div>
@if ($showQty)
- <div class="form-group {{ $errors->has('qty.'.$request->id) ? 'has-error' : '' }}">
- <label for="fulfill-qty-{{ $request->id }}" class="col-md-3 control-label">{{ trans('general.qty') }}</label>
- <div class="col-md-7 col-sm-12">
- <div class="col-md-2" style="padding-left: 0">
- <input
- class="form-control"
- type="number"
- id="fulfill-qty-{{ $request->id }}"
- name="qty[{{ $request->id }}]"
- value="{{ old('qty.'.$request->id, (int) $request->quantity) }}"
- min="1"
- @if ($maxQty !== null) max="{{ $maxQty }}" @endif
- aria-label="{{ trans('general.qty') }}"
- >
- </div>
- </div>
- <div class="col-md-8 col-md-offset-3"><x-form.error :name="'qty.'.$request->id" /></div>
- </div>
+ <x-input.quantity
+ name="qty[{{ $request->id }}]"
+ :label="trans('general.qty')"
+ :min="1"
+ :max="$maxQty"
+ :value="old('qty.'.$request->id, (int) $request->quantity)"
+ />
@else
{{-- AssetModel rows fulfill one asset per request, so qty
is fixed at 1. Hidden input keeps the POST shape
@@ -109,6 +109,7 @@
:label="trans('admin/hardware/form.notes')"
:name="'notes['.$request->id.']'"
type="textarea"
- :default="old('notes.'.$request->id, $request->notes ?? '')"
+ :rows="2"
+ :default="old('notes.'.$request->id, '')"
/>
-</fieldset>
+@endif
diff --git a/resources/views/blade/checkout/recipient-row.blade.php b/resources/views/blade/checkout/recipient-row.blade.php
index a7369a0414..7d962a5153 100644
--- a/resources/views/blade/checkout/recipient-row.blade.php
+++ b/resources/views/blade/checkout/recipient-row.blade.php
@@ -7,86 +7,85 @@
'showQty' => true,
])
-{{-- One row of the bulk-fulfill form. Renders a checkbox to opt this
- row into the batch, a user-select prefilled with the requester
- (editable, so admin can hand the item to someone else if the
- original requester is out sick), a qty input prefilled from the
- row's requested quantity, and the requester's notes as pre-
- filled context the admin can amend before checkout.
+{{-- One row of the bulk-fulfill form. Card-style layout: a full-
+ width header (checkbox + #id + requester + inline notes
+ preview) followed by the editable fields. Header spans the
+ full column so the checkbox + requester read as a unit
+ instead of getting squeezed into the form-horizontal label
+ slot.
- Field names are keyed by CheckoutRequest id so the server can
- correlate the opt-in list with each row's per-field values
- without index-tracking. See bulk-fulfill controllers for the
- paired shape:
+ Sign-in-place is deliberately absent. That flow assumes the
+ requester is standing at the admin's device to sign in
+ person; doesn't match a bulk batch where admin is processing
+ multiple people from their own desk. Single-target checkout
+ screens keep their sign-in-place checkbox unchanged.
+
+ Field names are keyed by CheckoutRequest id:
enabled_requests[] = list of request ids ticked
user_id[<request_id>] = target user for that row
qty[<request_id>] = qty for that row
- notes[<request_id>] = admin/checkout note for that row
+ notes[<request_id>] = admin/checkout note for that row --}}
- Sign-in-place is deliberately absent. That flow assumes the
- requester is standing at the admin's device to sign in person,
- which doesn't match a bulk batch where the admin is processing
- multiple people from their own desk. Single-target checkout
- screens keep their sign-in-place checkbox unchanged. --}}
-<fieldset class="form-group has-feedback" style="border: 1px solid #ddd; border-radius: 4px; padding: 15px; margin-bottom: 20px;">
- <legend class="col-sm-3 col-md-3 control-label" style="width: auto; padding: 0 10px; border: 0; margin-bottom: 0;">
- <label class="form-control" style="display: inline-flex; align-items: center; gap: 8px; margin-bottom: 0;">
- <input
- type="checkbox"
- name="enabled_requests[]"
- value="{{ (int) $request->id }}"
- @checked($defaultChecked || in_array((int) $request->id, (array) old('enabled_requests', []), true))
- aria-label="{{ trans('general.fulfill') }} #{{ $request->id }}"
- >
- <span>#{{ $request->id }}</span>
- @if ($requester)
- <span class="text-muted">
- &mdash; {{ $requester->display_name }}
- </span>
- @endif
- </label>
- </legend>
+{{-- Full-width divider between rows. <hr> sits inside the
+ .box-body's natural padding so it stops at the box edge
+ instead of bleeding past like a `.form-group { border-top }`
+ would (form-group inherits -15px lateral margins from
+ Bootstrap's .row reset). --}}
+<hr style="border-color: var(--table-border-row-color); margin-bottom: 15px;">
- <x-input.user-select
- :label="trans('general.user')"
- name="user_id[{{ $request->id }}]"
- :selected="old('user_id.'.$request->id, $requester?->id)"
- :companyId="$companyId"
- wrapperId="fulfill-user-{{ $request->id }}"
- id="fulfill-user-select-{{ $request->id }}"
- />
+{{-- Row header: reuses <x-form.checkbox-inline> for the checkbox
+ + requester-name label pair (wraps the checkbox in a
+ `.form-control`-styled <label> so the name is a click
+ target). Meta + notes drop below the checkbox visually
+ since they're contextual, not editable. --}}
+<div class="form-group">
+ <div class="col-md-3">
+ <x-form.checkbox-inline
+ name="enabled_requests[{{ $request->id }}]"
+ value="1"
+ :checked="$defaultChecked || old('enabled_requests.'.$request->id) === '1'"
+ :label="$requester?->display_name ?? '#'.$request->id"
+ />
+ </div>
+ <div class="col-md-7" style="padding-top: 7px;">
+ @if ($request->notes)
+ &ldquo;{{ $request->notes }}&rdquo;
+ @endif
+ <span class="text-muted">
+ - {{ $request->created_at->diffForHumans() }}
+ </span>
+ </div>
+</div>
- @if ($showQty)
- <div class="form-group {{ $errors->has('qty.'.$request->id) ? 'has-error' : '' }}">
- <label for="fulfill-qty-{{ $request->id }}" class="col-md-3 control-label">{{ trans('general.qty') }}</label>
- <div class="col-md-7 col-sm-12">
- <div class="col-md-2" style="padding-left: 0">
- <input
- class="form-control"
- type="number"
- id="fulfill-qty-{{ $request->id }}"
- name="qty[{{ $request->id }}]"
- value="{{ old('qty.'.$request->id, (int) $request->quantity) }}"
- min="1"
- @if ($maxQty !== null) max="{{ $maxQty }}" @endif
- aria-label="{{ trans('general.qty') }}"
- >
- </div>
- </div>
- <div class="col-md-8 col-md-offset-3"><x-form.error :name="'qty.'.$request->id" /></div>
- </div>
- @else
- {{-- Types where qty is meaningless (license = one seat per
- requester, asset = 1:1) hide the input but keep a
- hidden value=1 so the controller's per-row shape stays
- uniform across every requestable type. --}}
- <input type="hidden" name="qty[{{ $request->id }}]" value="1">
- @endif
+<x-input.user-select
+ :label="trans('general.user')"
+ name="user_id[{{ $request->id }}]"
+ :selected="old('user_id.'.$request->id, $requester?->id)"
+ :companyId="$companyId"
+ wrapperId="fulfill-user-{{ $request->id }}"
+ id="fulfill-user-select-{{ $request->id }}"
+/>
- <x-form.row
- :label="trans('admin/hardware/form.notes')"
- :name="'notes['.$request->id.']'"
- type="textarea"
- :default="old('notes.'.$request->id, $request->notes ?? '')"
+@if ($showQty)
+ <x-input.quantity
+ name="qty[{{ $request->id }}]"
+ :label="trans('general.qty')"
+ :min="1"
+ :max="$maxQty"
+ :value="old('qty.'.$request->id, (int) $request->quantity)"
/>
-</fieldset>
+@else
+ {{-- Types where qty is meaningless (license = one seat per
+ requester, asset = 1:1) hide the input but keep a
+ hidden value=1 so the controller's per-row shape stays
+ uniform across every requestable type. --}}
+ <input type="hidden" name="qty[{{ $request->id }}]" value="1">
+@endif
+
+<x-form.row
+ :label="trans('admin/hardware/form.notes')"
+ :name="'notes['.$request->id.']'"
+ type="textarea"
+ :rows="2"
+ :default="old('notes.'.$request->id, '')"
+/>
diff --git a/resources/views/checkouts/fulfill-multiple.blade.php b/resources/views/checkouts/fulfill-multiple.blade.php
index 6ec33e4979..599e9433ea 100644
--- a/resources/views/checkouts/fulfill-multiple.blade.php
+++ b/resources/views/checkouts/fulfill-multiple.blade.php
@@ -7,24 +7,29 @@
@section('content')
- <x-container class="col-md-8 col-md-offset-2">
+ <x-container class="col-md-6 col-md-offset-3">
<x-form :route="$formRoute" id="fulfill_multiple_form">
<x-box header="{{ $item->display_name ?? $item->name }} ({{ (int) $item->numRemaining() }} {{ trans('admin/components/general.remaining') }})">
- @if ($remaining !== null)
- <x-form.static :label="trans('admin/components/general.remaining')">
- {{ (int) $remaining }}
- </x-form.static>
- @endif
-
- @if ($item->company ?? null)
- <x-form.static :label="trans('general.company')">{!! $item->company->present()->formattedNameLink !!}</x-form.static>
- @endif
-
- @if ($item->category ?? null)
- <x-form.static :label="trans('general.category')">{!! $item->category->present()->formattedNameLink !!}</x-form.static>
- @endif
+ {{-- Check-all toggle. Uses the shared
+ data-toggle="check-all" handler from
+ snipeit.js which walks the closest form and
+ toggles every non-disabled checkbox. Sits in
+ the col-md-3 label slot so it lines up with
+ each row's checkbox below. Wrapped in a
+ .form-control label (same shape as the row-
+ level <x-form.checkbox-inline>) so the
+ checkbox + text stay inline instead of
+ wrapping to two lines. --}}
+ <div class="form-group">
+ <div class="col-md-3">
+ <label class="form-control">
+ <input type="checkbox" data-toggle="check-all">
+ {{ trans('general.select_all_none') }}
+ </label>
+ </div>
+ </div>
{{-- One row per pending CheckoutRequest, ordered
oldest-first (waiting-list). Admin ticks the