A free open source IT asset/license management system
Updated consumables to use blade components
snipef186dc20f692
diff --git a/app/Providers/BreadcrumbsServiceProvider.php b/app/Providers/BreadcrumbsServiceProvider.phpindex 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.phpindex 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')-<div class="row">- <div class="col-md-9">+<x-container class="col-md-9">- <form class="form-horizontal" id="checkout_form" method="post" action="" autocomplete="off">- <!-- CSRF Token -->- <input type="hidden" name="_token" value="{{ csrf_token() }}" />+ <x-form route="{{ url()->current() }}" id="checkout_form">- <div class="box box-default">+ <x-box header="{{ $consumable->name }}">- @if ($consumable->id)- <div class="box-header with-border">- <div class="box-heading">- <h2 class="box-title">{{ $consumable->name }} </h2>- </div>- </div><!-- /.box-header -->- @endif-- <div class="box-body">- @if ($consumable->name)- <!-- consumable name -->- <div class="form-group">- <label class="col-sm-3 control-label">{{ trans('admin/consumables/general.consumable_name') }}</label>- <div class="col-md-6">- <p class="form-control-static">{{ $consumable->name }}</p>- </div>- </div>- @endif-- @if ($consumable->company)- <!-- accessory name -->- <div class="form-group">- <label class="col-sm-3 control-label">{{ trans('general.company') }}</label>- <div class="col-md-6">- <p class="form-control-static">{!! $consumable->company->present()->formattedNameLink !!}</p>- </div>- </div>- @endif--- @if ($consumable->category)- <!-- category name -->- <div class="form-group">- <label class="col-sm-3 control-label">{{ trans('general.category') }}</label>- <div class="col-md-6">- <p class="form-control-static">{!! $consumable->category->present()->formattedNameLink !!}</p>- </div>- </div>- @endif--- <!-- total -->- <div class="form-group">- <label class="col-sm-3 control-label">{{ trans('admin/components/general.total') }}</label>- <div class="col-md-6">- <p class="form-control-static">{{ $consumable->qty }}</p>- </div>- </div>-- <!-- remaining -->- <div class="form-group">- <label class="col-sm-3 control-label">{{ trans('admin/components/general.remaining') }}</label>- <div class="col-md-6">- <p class="form-control-static">{{ $consumable->numRemaining() }}</p>- </div>- </div>----- <!-- User -->- @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!=''))- <div class="form-group notification-callout">- <div class="col-md-8 col-md-offset-3">- <div class="callout callout-info">-- @if ($consumable->category->require_acceptance=='1')- <i class="far fa-envelope"></i>- {{ trans('admin/categories/general.required_acceptance') }}- <br>- @endif+ @if ($consumable->name)+ <x-form.static :label="trans('admin/consumables/general.consumable_name')">{{ $consumable->name }}</x-form.static>+ @endif- @if ($consumable->getEula())- <i class="far fa-envelope"></i>- {{ trans('admin/categories/general.required_eula') }}- <br>- @endif+ @if ($consumable->company)+ <x-form.static :label="trans('general.company')">{!! $consumable->company->present()->formattedNameLink !!}</x-form.static>+ @endif- @if (($consumable->category) && ($consumable->category->checkin_email))- <i class="far fa-envelope"></i>- {{ trans('admin/categories/general.checkin_email_notification') }}- <br>- @endif+ @if ($consumable->category)+ <x-form.static :label="trans('general.category')">{!! $consumable->category->present()->formattedNameLink !!}</x-form.static>+ @endif- @if ($snipeSettings->webhook_endpoint!='')- <i class="fab fa-slack"></i>- {{ trans('general.webhook_msg_note') }}+ <x-form.static :label="trans('admin/components/general.total')">{{ $consumable->qty }}</x-form.static>++ <x-form.static :label="trans('admin/components/general.remaining')">{{ $consumable->numRemaining() }}</x-form.static>++ @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 != ''))+ <div class="form-group notification-callout">+ <div class="col-md-8 col-md-offset-3">+ <div class="callout callout-info">+ @if ($consumable->category->require_acceptance == '1')+ <i class="far fa-envelope" aria-hidden="true"></i>+ {{ trans('admin/categories/general.required_acceptance') }}<br>+ @endif+ @if ($consumable->getEula())+ <i class="far fa-envelope" aria-hidden="true"></i>+ {{ trans('admin/categories/general.required_eula') }}<br>+ @endif+ @if ($consumable->category && $consumable->category->checkin_email)+ <i class="far fa-envelope" aria-hidden="true"></i>+ {{ trans('admin/categories/general.checkin_email_notification') }}<br>+ @endif+ @if ($snipeSettings->webhook_endpoint != '')+ <i class="fab fa-slack" aria-hidden="true"></i>+ {{ trans('general.webhook_msg_note') }}+ @endif+ </div>+ </div>++ @if ($consumable->requireAcceptance() || (string) $snipeSettings->require_accept_signature === '1')+ <div id="sign_in_place_div" class="col-md-7 col-md-offset-3">+ <label class="form-control">+ <input type="checkbox" value="1" name="sign_in_place" @checked(old('sign_in_place', session('sign_in_place', false))) aria-label="{{ trans('general.sign_in_place') }}">+ {{ trans('general.sign_in_place') }}+ </label>+ <p class="help-block">{{ trans('general.sign_in_place_help') }}</p>+ </div>@endif- </div></div>-- <!-- Sign in place checkbox -->- @if ($consumable->requireAcceptance() || (string) $snipeSettings->require_accept_signature === '1')- <div id="sign_in_place_div" class="col-md-7 col-md-offset-3">- <label class="form-control">- <input type="checkbox" value="1" name="sign_in_place" @checked(old('sign_in_place', session('sign_in_place', false))) aria-label="sign_in_place">- {{ trans('general.sign_in_place') }}- </label>- <p class="help-block">- {{ trans('general.sign_in_place_help') }}- </p>- </div>- @endif- </div>@endif- <!-- Checkout QTY -->- <div class="form-group {{ $errors->has('qty') ? 'error' : '' }} ">- <label for="qty" class="col-md-3 control-label">{{ trans('general.qty') }}</label>- <div class="col-md-7 col-sm-12 required">- <div class="col-md-2" style="padding-left:0px">- <input class="form-control" type="number" name="checkout_qty" id="checkout_qty" value="1" min="1" max="{{$consumable->numRemaining()}}" maxlength="999999" />- </div>- </div>- {!! $errors->first('qty', '<div class="col-md-8 col-md-offset-3"><span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span></div>') !!}- </div>-- <!-- Note -->- <div class="form-group {{ $errors->has('note') ? 'error' : '' }}">- <label for="note" class="col-md-3 control-label">{{ trans('admin/hardware/form.notes') }}</label>- <div class="col-md-7">- <textarea class="col-md-6 form-control" name="note">{{ old('note') }}</textarea>- {!! $errors->first('note', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}+ <!-- Checkout quantity -->+ <div class="form-group {{ $errors->has('qty') ? 'has-error' : '' }}">+ <label for="checkout_qty" 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" name="checkout_qty" id="checkout_qty" value="{{ old('checkout_qty', 1) }}" min="1" max="{{ $consumable->numRemaining() }}" aria-label="{{ trans('general.qty') }}" />+ </div>+ </div>+ {!! $errors->first('qty', '<div class="col-md-8 col-md-offset-3"><span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span></div>') !!}</div>- </div>- </div> <!-- .box-body -->- <x-redirect_submit_options++ <x-form.row+ :label="trans('admin/hardware/form.notes')"+ :item="$consumable"+ name="note"+ type="textarea"+ />++ <x-slot:customfooter>+ <x-redirect_submit_optionsindex_route="consumables.index":button_label="trans('general.checkout')":options="[- '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'),- ]"/>- </div>- </form>-- </div>-</div>+ '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'),+ ]"+ />+ </x-slot:customfooter>++ </x-box>++ </x-form>++</x-container>+@stopdiff --git a/resources/views/consumables/edit.blade.php b/resources/views/consumables/edit.blade.phpindex 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')]),- ]-])+@extends('layouts/default')++{{-- Page title --}}+@section('title')+ @if ($item->id)+ {{ trans('admin/consumables/general.update') }}+ @else+ {{ trans('admin/consumables/general.create') }}+ @endif+ @parent+@stop+{{-- Page content --}}-@section('inputFields')--@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')])+@section('content')++ <x-container class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">++ <x-form :$item route="{{ isset($item->id) ? route('consumables.update', ['consumable' => $item->id]) : route('consumables.store') }}">++ <x-box>++ <x-input.company-select+ :label="trans('general.company')"+ name="company_id"+ :selected="old('company_id', $item->company_id)"+ />++ <x-form.row+ :label="trans('general.name')"+ :$item+ name="name"+ />++ <x-input.category-select+ :label="trans('general.category')"+ name="category_id"+ :selected="old('category_id', $item->category_id)"+ required+ categoryType="consumable"+ />++ <x-input.quantity :item="$item"/>++ <x-input.minimum-quantity :item="$item"/>++ <x-input.supplier-select+ :label="trans('general.supplier')"+ name="supplier_id"+ :selected="old('supplier_id', $item->supplier_id)"+ />++ <x-input.manufacturer-select+ :label="trans('general.manufacturer')"+ name="manufacturer_id"+ :selected="old('manufacturer_id', $item->manufacturer_id)"+ />++ <x-input.location-select+ :label="trans('general.location')"+ name="location_id"+ :selected="old('location_id', $item->location_id)"+ />++ <x-form.row+ :label="trans('general.model_no')"+ :$item+ name="model_number"+ />++ <x-form.row+ :label="trans('admin/consumables/general.item_no')"+ :$item+ name="item_no"+ />++ <x-form.row+ :label="trans('general.order_number')"+ :$item+ name="order_number"+ />++ <div class="form-group {{ $errors->has('purchase_date') ? 'has-error' : '' }}">+ <label for="purchase_date" class="col-md-3 control-label">{{ trans('general.purchase_date') }}</label>+ <div class="input-group col-md-4">+ <x-input.datepicker+ name="purchase_date"+ id="purchase_date"+ :value="old('purchase_date', $item->purchase_date ? date('Y-m-d', strtotime($item->purchase_date)) : '')"+ />+ {!! $errors->first('purchase_date', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}+ </div>+ </div>++ <x-input.purchase-cost+ :label="trans('general.unit_cost')"+ :item="$item"+ :currencyType="$item->location->currency ?? null"+ />++ <x-form.row+ :label="trans('general.notes')"+ :$item+ name="notes"+ type="textarea"+ />++ @include ('partials.forms.edit.image-upload', ['image_path' => app('consumables_upload_path')])++ <x-slot:customfooter>+ <x-redirect_submit_options+ index_route="consumables.index"+ :button_label="trans('general.save')"+ :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')]),+ ]"+ />+ </x-slot:customfooter>++ </x-box>++ </x-form>++ </x-container>@stop