3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-08-18 11:15:42 +00:00

Fixed page column width

This commit is contained in:
snipe
2026-07-20 11:14:38 +01:00
parent 79eda7f2aa
commit 96bb2c6810
10 changed files with 21 additions and 64 deletions

View File

@ -51,22 +51,11 @@ class CheckoutTargetPanel extends Component
#[Locked]
public string $defaultTargetType = 'user';
/**
* Grid class applied to the component's root element. Defaults to
* `col-md-5` which matches the single-target checkout pages that host
* this panel directly next to a col-md-7 form. Pages that stack this
* panel with another box inside their own col-md-5 wrapper pass
* `col-md-12` so the component fills its parent instead of collapsing
* to a nested 5/12 width.
*/
#[Locked]
public string $rootClass = 'col-md-5';
public ?string $targetType = null;
public ?int $targetId = null;
public function mount(string $type, string $defaultTargetType = 'user', string $rootClass = 'col-md-5'): void
public function mount(string $type, string $defaultTargetType = 'user'): void
{
if (! in_array($type, self::TYPES, true)) {
throw new \InvalidArgumentException("Unknown checkout-target-panel type: {$type}");
@ -78,7 +67,6 @@ class CheckoutTargetPanel extends Component
$this->type = $type;
$this->defaultTargetType = $defaultTargetType;
$this->rootClass = $rootClass;
}
/**

View File

@ -112,7 +112,9 @@
</x-page-column>
<livewire:checkout-target-panel type="accessories" />
<x-page-column class="col-md-5">
<livewire:checkout-target-panel type="accessories" />
</x-page-column>
</x-container>

View File

@ -2,12 +2,6 @@
'items',
'message',
'title' => trans('general.notification_warning'),
// On bulk-checkout the checkout-target-panel Livewire component takes
// over the right column once the user picks a target, so this warning
// is only useful in the "picking assets, no target yet" phase — pass
// hideOnTargetSelected=true and the small script at the bottom will
// hide the box the moment a target select gets a value.
'hideOnTargetSelected' => false,
])
{{-- Warning side-panel used by bulk checkin/checkout to explain which assets
@ -57,40 +51,4 @@
</table>
</div>
</div>
@if ($hideOnTargetSelected)
<script nonce="{{ csrf_token() }}">
(function () {
// Hide the removed-assets warning as soon as the user picks a
// checkout target — the checkout-target-panel Livewire component
// becomes the primary side-column content at that point and the
// stale warning would just eat vertical space. We piggyback on
// the same target selects the panel's bridge script watches so
// there's no coordination between the two.
var $warning = $('#removed-assets-warning');
if (!$warning.length) return;
var syncVisibility = function () {
var radioVal = $('input[name="checkout_to_type"]:checked').val() || 'user';
var selectSelectors = {
'user': '#assigned_user_select',
'asset': '#assigned_asset_select',
'location': '#assigned_location_location_select',
};
var val = $(selectSelectors[radioVal]).val();
var hasTarget = val !== null && val !== undefined && val !== '';
$warning.toggle(!hasTarget);
};
$('#assigned_user_select, #assigned_asset_select, #assigned_location_location_select')
.on('change', syncVisibility);
$('input[name="checkout_to_type"]').on('change', syncVisibility);
// Run once on ready so a server-side pre-selected target
// (session-remembered after a validation redirect) hides the
// warning immediately instead of flashing it on the first paint.
syncVisibility();
})();
</script>
@endif
@endif

View File

@ -80,7 +80,9 @@
</x-page-column>
<livewire:checkout-target-panel type="components" defaultTargetType="asset" />
<x-page-column class="col-md-5">
<livewire:checkout-target-panel type="components" defaultTargetType="asset" />
</x-page-column>
</x-container>

View File

@ -109,7 +109,9 @@
</x-page-column>
<livewire:checkout-target-panel type="consumables" />
<x-page-column class="col-md-5">
<livewire:checkout-target-panel type="consumables" />
</x-page-column>
</x-container>

View File

@ -115,9 +115,8 @@
<x-side-panel.removed-assets
:items="$removed_assets"
:message="trans('general.assigned_assets_removed')"
:hideOnTargetSelected="true"
/>
<livewire:checkout-target-panel type="assets" rootClass="col-md-12" />
<livewire:checkout-target-panel type="assets" />
</x-page-column>
</x-container>

View File

@ -182,7 +182,9 @@
</x-page-column>
<livewire:checkout-target-panel type="assets" />
<x-page-column class="col-md-5">
<livewire:checkout-target-panel type="assets" />
</x-page-column>
</x-container>
@stop

View File

@ -61,7 +61,9 @@
</x-page-column>
<livewire:checkout-target-panel type="assets" />
<x-page-column class="col-md-5">
<livewire:checkout-target-panel type="assets" />
</x-page-column>
</x-container>
@stop

View File

@ -124,7 +124,9 @@
</x-page-column>
<livewire:checkout-target-panel type="licenses" />
<x-page-column class="col-md-5">
<livewire:checkout-target-panel type="licenses" />
</x-page-column>
</x-container>
@stop

View File

@ -1,4 +1,4 @@
<div class="{{ $rootClass }}" @if ($targetId === null) style="display: none;" @endif>
<div @if ($targetId === null) style="display: none;" @endif>
<div class="box box-primary">
<div class="box-header with-border">
<h2 class="box-title">