From f186dc20f6921d3f3e62998e0f56ebdf0cac5359 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 4 Jun 2026 13:40:21 +0100 Subject: [PATCH] Updated consumables to use blade components --- app/Providers/BreadcrumbsServiceProvider.php | 13 + .../views/consumables/checkout.blade.php | 228 +++++++----------- resources/views/consumables/edit.blade.php | 154 +++++++++--- 3 files changed, 223 insertions(+), 172 deletions(-) diff --git a/app/Providers/BreadcrumbsServiceProvider.php b/app/Providers/BreadcrumbsServiceProvider.php index f963f605e3..be0f95dcee 100644 --- a/app/Providers/BreadcrumbsServiceProvider.php +++ b/app/Providers/BreadcrumbsServiceProvider.php @@ -223,6 +223,19 @@ class BreadcrumbsServiceProvider extends ServiceProvider ->push(trans('general.update')) ); + Breadcrumbs::for('consumables.checkout.show', function (Trail $trail, $consumablesID) { + $consumable = Consumable::find($consumablesID); + $trail->parent('consumables.index'); + if ($consumable) { + $trail->push($consumable->name, route('consumables.show', $consumable)); + } + $trail->push(trans('general.checkout')); + }); + + Breadcrumbs::for('consumables.clone.create', fn (Trail $trail, Consumable $consumable) => $trail->parent('consumables.show', $consumable) + ->push(trans('general.clone')) + ); + /** * Custom fields Breadcrumbs */ diff --git a/resources/views/consumables/checkout.blade.php b/resources/views/consumables/checkout.blade.php index 42e5cf60a3..f5d94cf9fa 100644 --- a/resources/views/consumables/checkout.blade.php +++ b/resources/views/consumables/checkout.blade.php @@ -2,162 +2,106 @@ {{-- Page title --}} @section('title') - {{ trans('admin/consumables/general.checkout') }} + {{ trans('admin/consumables/general.checkout') }} @parent @stop {{-- Page content --}} @section('content') -
-
+ -
- - + -
+ - @if ($consumable->id) -
-
-

{{ $consumable->name }}

-
-
- @endif - -
- @if ($consumable->name) - -
- -
-

{{ $consumable->name }}

-
-
- @endif - - @if ($consumable->company) - -
- -
-

{!! $consumable->company->present()->formattedNameLink !!}

-
-
- @endif - - - @if ($consumable->category) - -
- -
-

{!! $consumable->category->present()->formattedNameLink !!}

-
-
- @endif - - - -
- -
-

{{ $consumable->qty }}

-
-
- - -
- -
-

{{ $consumable->numRemaining() }}

-
-
- - - - - - @include ('partials.forms.edit.user-select', ['translated_name' => trans('general.select_user'), 'fieldname' => 'assigned_to', 'required'=> 'true', 'company_id' => $consumable->company_id]) - - - @if ($consumable->requireAcceptance() || (string) $snipeSettings->require_accept_signature === '1' || $consumable->getEula() || ($snipeSettings->webhook_endpoint!='')) -
-
-
- - @if ($consumable->category->require_acceptance=='1') - - {{ trans('admin/categories/general.required_acceptance') }} -
- @endif - - @if ($consumable->getEula()) - - {{ trans('admin/categories/general.required_eula') }} -
- @endif - - @if (($consumable->category) && ($consumable->category->checkin_email)) - - {{ trans('admin/categories/general.checkin_email_notification') }} -
- @endif - - @if ($snipeSettings->webhook_endpoint!='') - - {{ trans('general.webhook_msg_note') }} - @endif -
-
- - - @if ($consumable->requireAcceptance() || (string) $snipeSettings->require_accept_signature === '1') -
- -

- {{ trans('general.sign_in_place_help') }} -

-
- @endif -
+ @if ($consumable->name) + {{ $consumable->name }} @endif - -
- -
-
- -
-
- {!! $errors->first('qty', '
') !!} -
- - -
- -
- - {!! $errors->first('note', '') !!} + @if ($consumable->company) + {!! $consumable->company->present()->formattedNameLink !!} + @endif + + @if ($consumable->category) + {!! $consumable->category->present()->formattedNameLink !!} + @endif + + {{ $consumable->qty }} + + {{ $consumable->numRemaining() }} + + @include ('partials.forms.edit.user-select', ['translated_name' => trans('general.select_user'), 'fieldname' => 'assigned_to', 'required' => 'true', 'company_id' => $consumable->company_id]) + + @if ($consumable->requireAcceptance() || (string) $snipeSettings->require_accept_signature === '1' || $consumable->getEula() || ($snipeSettings->webhook_endpoint != '')) +
+
+
+ @if ($consumable->category->require_acceptance == '1') + + {{ trans('admin/categories/general.required_acceptance') }}
+ @endif + @if ($consumable->getEula()) + + {{ trans('admin/categories/general.required_eula') }}
+ @endif + @if ($consumable->category && $consumable->category->checkin_email) + + {{ trans('admin/categories/general.checkin_email_notification') }}
+ @endif + @if ($snipeSettings->webhook_endpoint != '') + + {{ trans('general.webhook_msg_note') }} + @endif +
+
+ + @if ($consumable->requireAcceptance() || (string) $snipeSettings->require_accept_signature === '1') +
+ +

{{ trans('general.sign_in_place_help') }}

+
+ @endif +
+ @endif + + +
+ +
+
+ +
+
+ {!! $errors->first('qty', '
') !!}
-
-
- + + + -
- + 'index' => trans('admin/hardware/form.redirect_to_all', ['type' => trans('general.consumables')]), + 'item' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.consumable')]), + 'target' => trans('admin/hardware/form.redirect_to_checked_out_to'), + ]" + /> + + +
+ + + + -
-
@stop diff --git a/resources/views/consumables/edit.blade.php b/resources/views/consumables/edit.blade.php index 0d947fdb43..c09f3b3ae1 100644 --- a/resources/views/consumables/edit.blade.php +++ b/resources/views/consumables/edit.blade.php @@ -1,33 +1,127 @@ -@extends('layouts/edit-form', [ - 'createText' => trans('admin/consumables/general.create') , - 'updateText' => trans('admin/consumables/general.update'), - 'helpPosition' => 'right', - 'helpText' => trans('help.consumables'), - 'formAction' => (isset($item->id)) ? route('consumables.update', ['consumable' => $item->id]) : route('consumables.store'), - 'index_route' => 'consumables.index', - 'options' => [ - 'back' => trans('admin/hardware/form.redirect_to_type',['type' => trans('general.previous_page')]), - 'index' => trans('admin/hardware/form.redirect_to_all', ['type' => 'consumables']), - 'item' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.consumable')]), - ] -]) -{{-- Page content --}} -@section('inputFields') +@extends('layouts/default') -@include ('partials.forms.edit.company-select', ['translated_name' => trans('general.company'), 'fieldname' => 'company_id']) -@include ('partials.forms.edit.name', ['translated_name' => trans('general.name')]) -@include ('partials.forms.edit.category-select', ['translated_name' => trans('general.category'), 'fieldname' => 'category_id', 'required' => 'true', 'category_type' => 'consumable']) -@include ('partials.forms.edit.quantity') -@include ('partials.forms.edit.minimum_quantity') -@include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'supplier_id']) -@include ('partials.forms.edit.manufacturer-select', ['translated_name' => trans('general.manufacturer'), 'fieldname' => 'manufacturer_id']) -@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id']) -@include ('partials.forms.edit.model_number') -@include ('partials.forms.edit.item_number') -@include ('partials.forms.edit.order_number') -@include ('partials.forms.edit.datepicker', ['translated_name' => trans('general.purchase_date'),'fieldname' => 'purchase_date']) -@include ('partials.forms.edit.purchase_cost', [ 'unit_cost' => trans('general.unit_cost')]) -@include ('partials.forms.edit.notes') -@include ('partials.forms.edit.image-upload', ['image_path' => app('consumables_upload_path')]) +{{-- Page title --}} +@section('title') + @if ($item->id) + {{ trans('admin/consumables/general.update') }} + @else + {{ trans('admin/consumables/general.create') }} + @endif + @parent +@stop + +{{-- Page content --}} +@section('content') + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + {!! $errors->first('purchase_date', '') !!} +
+
+ + + + + + @include ('partials.forms.edit.image-upload', ['image_path' => app('consumables_upload_path')]) + + + + + +
+ +
+ +
@stop