A free open source IT asset/license management system
Blade-ify the accessories views
snipee7c45644b9d7
diff --git a/resources/views/accessories/checkin.blade.php b/resources/views/accessories/checkin.blade.phpindex 1841156832..8fb16f914a 100755--- a/resources/views/accessories/checkin.blade.php+++ b/resources/views/accessories/checkin.blade.php@@ -2,90 +2,72 @@{{-- Page title --}}@section('title')- {{ trans('admin/accessories/general.checkin') }}+ {{ trans('admin/accessories/general.checkin') }}@parent@stop@section('header_right')- <a href="{{ URL::previous() }}" class="btn btn-primary pull-right">- {{ trans('general.back') }}</a>+ <a href="{{ URL::previous() }}" class="btn btn-primary pull-right">{{ trans('general.back') }}</a>@stop-{{-- Page content --}}@section('content')+<x-container class="col-md-7">++ <x-form route="{{ url()->current() }}">+ <x-box header="{{ $accessory->name }}">- <div class="row">- <div class="col-md-7">- <form class="form-horizontal" method="post" action="" autocomplete="off">- <!-- CSRF Token -->- <input type="hidden" name="_token" value="{{ csrf_token() }}" />+ <!-- Accessory name (read-only) -->+ @if ($accessory->name)+ <div class="form-group">+ <label class="col-sm-3 control-label">{{ trans('admin/hardware/form.name') }}</label>+ <div class="col-md-6">+ <p class="form-control-static">{{ $accessory->name }}</p>+ </div>+ </div>+ @endif- <div class="box box-default">- @if ($accessory->id)- <div class="box-header with-border">- <h2 class="box-title">{{ $accessory->name }}</h2>- </div><!-- /.box-header -->- @endif+ <x-form.row+ :label="trans('admin/hardware/form.notes')"+ :item="$accessory"+ name="note"+ type="textarea"+ />- <div class="box-body">- <!-- CSRF Token -->- <input type="hidden" name="_token" value="{{ csrf_token() }}" />+ <!-- Checkin date -->+ <div class="form-group {{ $errors->has('checkin_at') ? 'has-error' : '' }}">+ <label for="checkin_at" class="col-md-3 control-label">{{ trans('admin/hardware/form.checkin_date') }}</label>+ <div class="col-md-7">+ <div class="input-group col-md-5 required" style="padding-left: 0">+ <x-input.datepicker+ name="checkin_at"+ id="checkin_at"+ :value="old('checkin_at', date('Y-m-d'))"+ end_date="0d"+ />+ {!! $errors->first('checkin_at', '<span class="alert-msg"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}+ </div>+ </div>+ </div>- @if ($accessory->name)- <!-- accessory name -->- <div class="form-group">- <label class="col-sm-3 control-label">- {{ trans('admin/hardware/form.name') }}- </label>- <div class="col-md-6">- <p class="form-control-static">{{ $accessory->name }}</p>- </div>- </div>- @endif+ <x-slot:customfooter>+ <x-redirect_submit_options+ index_route="accessories.index"+ :button_label="trans('general.checkin')"+ :options="[+ 'index' => trans('admin/hardware/form.redirect_to_all', ['type' => trans('general.accessories')]),+ 'item' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.accessory')]),+ 'target' => $target_option,+ ]"+ />+ </x-slot:customfooter>- <!-- 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" id="note" name="note">{{ old('note', $accessory->note) }}</textarea>- {!! $errors->first('note', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}- </div>- </div>- <!-- Checkout/Checkin Date -->- <div class="form-group{{ $errors->has('checkin_at') ? ' has-error' : '' }}">- <label for="checkin_at" class="col-md-3 control-label">- {{ trans('admin/hardware/form.checkin_date') }}- </label>- <div class="col-md-7">- <div class="input-group col-md-5 required" style="padding-left: 0px;">- <div class="input-group date" data-date-clear-btn="true" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-date-end-date="0d" data-autoclose="true">- <input type="text" class="form-control" placeholder="{{ trans('general.select_date') }}" name="checkin_at" id="checkin_at" value="{{ old('checkin_at', date('Y-m-d')) }}">- <span class="input-group-addon">- <x-icon type="calendar" />- </span>- </div>- {!! $errors->first('checkin_at', '<span class="alert-msg"><i class="fas fa-times"></i> :message</span>') !!}- </div>- </div>- </div>+ </x-box>- </div>- <x-redirect_submit_options- index_route="accessories.index"- :button_label="trans('general.checkin')"- :options="[- 'index' => trans('admin/hardware/form.redirect_to_all', ['type' => trans('general.accessories')]),- 'item' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.accessory')]),- 'target' => $target_option- ]"- />+ </x-form>+</x-container>- </div> <!-- .box.box-default -->- </form>- </div> <!-- .col-md-9-->- </div> <!-- .row -->@stopdiff --git a/resources/views/accessories/checkout.blade.php b/resources/views/accessories/checkout.blade.phpindex 7f85c34605..0fda6b11de 100755--- a/resources/views/accessories/checkout.blade.php+++ b/resources/views/accessories/checkout.blade.php@@ -2,163 +2,139 @@{{-- Page title --}}@section('title')- {{ trans('admin/accessories/general.checkout') }}+ {{ trans('admin/accessories/general.checkout') }}@parent@stop+@section('header_right')-<a href="{{ URL::previous() }}" class="btn btn-primary pull-right">- {{ trans('general.back') }}</a>+ <a href="{{ URL::previous() }}" class="btn btn-primary pull-right">{{ trans('general.back') }}</a>@stop-{{-- Page content --}}@section('content')--<div class="row">- <div 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() }}" />-- <div class="box box-default">- @if ($accessory->id)- <div class="box-header with-border">- <h2 class="box-title">{{ $accessory->name }}</h2>- </div><!-- /.box-header -->- @endif-- <div class="box-body">- @if ($accessory->name)- <!-- accessory name -->- <div class="form-group">- <label class="col-sm-3 control-label">{{ trans('admin/accessories/general.accessory_name') }}</label>- <div class="col-md-6">- <p class="form-control-static">{{ $accessory->name }}</p>+<x-container class="col-md-9">++ <x-form route="{{ url()->current() }}" id="checkout_form">++ <x-box header="{{ $accessory->name }}">++ <!-- Accessory name (read-only) -->+ @if ($accessory->name)+ <div class="form-group">+ <label class="col-sm-3 control-label">{{ trans('admin/accessories/general.accessory_name') }}</label>+ <div class="col-md-6">+ <p class="form-control-static">{{ $accessory->name }}</p>+ </div>+ </div>+ @endif++ <!-- Company (read-only) -->+ @if ($accessory->company)+ <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">{!! $accessory->company->present()->formattedNameLink !!}</p>+ </div>+ </div>+ @endif++ <!-- Category (read-only) -->+ @if ($accessory->category)+ <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">{!! $accessory->category->present()->formattedNameLink !!}</p>+ </div>+ </div>+ @endif++ <!-- Total qty (read-only) -->+ <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">{{ $accessory->qty }}</p>+ </div></div>- </div>- @endif-- @if ($accessory->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">{!! $accessory->company->present()->formattedNameLink !!}</p>- </div>- </div>- @endif--- @if ($accessory->category)- <!-- accessory 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">{!! $accessory->category->present()->formattedNameLink !!}</p>++ <!-- Remaining qty (read-only) -->+ <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">{{ $accessory->numRemaining() }}</p>+ </div></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">{{ $accessory->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">{{ $accessory->numRemaining() }}</p>- </div>- </div>--- <!-- checkout selector -->-- @include ('partials.forms.checkout-selector', ['user_select' => 'true','asset_select' => 'true', 'location_select' => 'true'])- @include ('partials.forms.edit.user-select', ['translated_name' => trans('general.user'), 'company_id' => $accessory->company_id, 'fieldname' => 'assigned_user', 'style' => (session('checkout_to_type') ?: 'user') == 'user' ? '' : 'display: none;'])- @include ('partials.forms.edit.asset-select', ['translated_name' => trans('general.asset'), 'asset_selector_div_id' => 'assigned_asset', 'company_id' => $accessory->company_id, 'fieldname' => 'assigned_asset', 'unselect' => 'true', 'style' => session('checkout_to_type') == 'asset' ? '' : 'display: none;'])- @include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'assigned_location', 'company_id' => $accessory->company_id, 'style' => session('checkout_to_type') == 'location' ? '' : 'display: none;'])---- <!-- Checkout QTY -->- <div class="form-group {{ $errors->has('checkout_qty') ? 'error' : '' }} ">- <label for="checkout_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="{{ old('checkout_qty', 1) }}" min="1" max="{{ $accessory->numRemaining() }}" />- </div>- </div>- {!! $errors->first('checkout_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>--- @if ($accessory->requireAcceptance() || (string) $snipeSettings->require_accept_signature === '1' || $accessory->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 ($accessory->requireAcceptance())- <i class="far fa-envelope"></i>- {{ trans('admin/categories/general.required_acceptance') }}- <br>- @endif-- @if ($accessory->getEula())- <i class="far fa-envelope"></i>- {{ trans('admin/categories/general.required_eula') }}- <br>- @endif-- @if ($snipeSettings->webhook_endpoint!='')- <i class="fab fa-slack"></i>- {{ trans('general.webhook_msg_note') }}- @endif- </div>- </div>-- <!-- Sign in place checkbox -->- @if ($accessory->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- <!-- 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" id="note" name="note">{{ old('note', $accessory->note) }}</textarea>- {!! $errors->first('note', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}++ @include ('partials.forms.checkout-selector', ['user_select' => 'true', 'asset_select' => 'true', 'location_select' => 'true'])+ @include ('partials.forms.edit.user-select', ['translated_name' => trans('general.user'), 'company_id' => $accessory->company_id, 'fieldname' => 'assigned_user', 'style' => (session('checkout_to_type') ?: 'user') == 'user' ? '' : 'display: none;'])+ @include ('partials.forms.edit.asset-select', ['translated_name' => trans('general.asset'), 'asset_selector_div_id' => 'assigned_asset', 'company_id' => $accessory->company_id, 'fieldname' => 'assigned_asset', 'unselect' => 'true', 'style' => session('checkout_to_type') == 'asset' ? '' : 'display: none;'])+ @include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'assigned_location', 'company_id' => $accessory->company_id, 'style' => session('checkout_to_type') == 'location' ? '' : 'display: none;'])++ <!-- Checkout quantity -->+ <div class="form-group {{ $errors->has('checkout_qty') ? 'error' : '' }}">+ <label for="checkout_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: 0">+ <input class="form-control" type="number" name="checkout_qty" id="checkout_qty" value="{{ old('checkout_qty', 1) }}" min="1" max="{{ $accessory->numRemaining() }}" aria-label="{{ trans('general.qty') }}" />+ </div>+ </div>+ {!! $errors->first('checkout_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>- <x-redirect_submit_options- index_route="accessories.index"- :button_label="trans('general.checkout')"- :options="[++ @if ($accessory->requireAcceptance() || (string) $snipeSettings->require_accept_signature === '1' || $accessory->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 ($accessory->requireAcceptance())+ <i class="far fa-envelope" aria-hidden="true"></i>+ {{ trans('admin/categories/general.required_acceptance') }}<br>+ @endif+ @if ($accessory->getEula())+ <i class="far fa-envelope" aria-hidden="true"></i>+ {{ trans('admin/categories/general.required_eula') }}<br>+ @endif+ @if ($snipeSettings->webhook_endpoint != '')+ <i class="fab fa-slack" aria-hidden="true"></i>+ {{ trans('general.webhook_msg_note') }}+ @endif+ </div>+ </div>++ @if ($accessory->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>+ @endif++ <x-form.row+ :label="trans('admin/hardware/form.notes')"+ :item="$accessory"+ name="note"+ type="textarea"+ />++ <x-slot:customfooter>+ <x-redirect_submit_options+ index_route="accessories.index"+ :button_label="trans('general.checkout')"+ :options="['index' => trans('admin/hardware/form.redirect_to_all', ['type' => trans('general.accessories')]),'item' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.accessory')]),'target' => trans('admin/hardware/form.redirect_to_checked_out_to'),+ ]"+ />+ </x-slot:customfooter>++ </x-box>- ]"- />- </div> <!-- .box.box-default -->- </form>- </div> <!-- .col-md-9-->-</div> <!-- .row -->+ </x-form>+</x-container>@stopdiff --git a/resources/views/accessories/edit.blade.php b/resources/views/accessories/edit.blade.phpindex 5c2963485f..b6069e62db 100644--- a/resources/views/accessories/edit.blade.php+++ b/resources/views/accessories/edit.blade.php@@ -1,34 +1,121 @@-@extends('layouts/edit-form', [- 'createText' => trans('admin/accessories/general.create') ,- 'updateText' => trans('admin/accessories/general.update'),- 'helpPosition' => 'right',- 'helpText' => trans('help.accessories'),- 'formAction' => (isset($item->id)) ? route('accessories.update', ['accessory' => $item->id]) : route('accessories.store'),- 'index_route' => 'accessories.index',- 'options' => [- 'back' => trans('admin/hardware/form.redirect_to_type',['type' => trans('general.previous_page')]),- 'index' => trans('admin/hardware/form.redirect_to_all', ['type' => 'accessories']),- 'item' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.accessory')]),- ]-])+@extends('layouts/default')++{{-- Page title --}}+@section('title')+ @if ($item->id)+ {{ trans('admin/accessories/general.update') }}+ @else+ {{ trans('admin/accessories/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('admin/accessories/general.accessory_name')])-@include ('partials.forms.edit.category-select', ['translated_name' => trans('general.category'), 'fieldname' => 'category_id', 'required' => 'true','category_type' => 'accessory'])-@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.order_number')-@include ('partials.forms.edit.datepicker', ['translated_name' => trans('general.purchase_date'),'fieldname' => 'purchase_date'])-@include ('partials.forms.edit.purchase_cost', ['currency_type' => $item->location->currency ?? null, 'unit_cost' => trans('general.unit_cost')])-@include ('partials.forms.edit.quantity', ['min' => 0])-@include ('partials.forms.edit.minimum_quantity')-@include ('partials.forms.edit.notes')-@include ('partials.forms.edit.image-upload', ['image_path' => app('accessories_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('accessories.update', ['accessory' => $item->id]) : route('accessories.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('admin/accessories/general.accessory_name')"+ :$item+ name="name"+ />++ <x-input.category-select+ :label="trans('general.category')"+ name="category_id"+ :selected="old('category_id', $item->category_id)"+ required+ categoryType="accessory"+ />++ <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('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-input.quantity :item="$item" min="0" />++ <x-input.minimum-quantity :item="$item" />++ <x-form.row+ :label="trans('general.notes')"+ :$item+ name="notes"+ type="textarea"+ />++ @include ('partials.forms.edit.image-upload', ['image_path' => app('accessories_upload_path')])++ <x-slot:customfooter>+ <x-redirect_submit_options+ index_route="accessories.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' => 'accessories']),+ 'item' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.accessory')]),+ ]"+ />+ </x-slot:customfooter>++ </x-box>++ </x-form>+</x-container>@stopdiff --git a/resources/views/blade/box/index.blade.php b/resources/views/blade/box/index.blade.phpindex 163532d903..f0e1976920 100644--- a/resources/views/blade/box/index.blade.php+++ b/resources/views/blade/box/index.blade.php@@ -1,7 +1,6 @@@props(['box_style' => 'default','header' => false,- 'footer' => false,])@aware(['name', 'route'])@@ -38,7 +37,9 @@</div>- @if ($route)+ @if (isset($customfooter))+ {{ $customfooter }}+ @elseif ($route)<x-box.footer />@endif</div>\ No newline at end of filediff --git a/resources/views/blade/form/index.blade.php b/resources/views/blade/form/index.blade.phpindex 4ff9b739e7..031c3d52fc 100644--- a/resources/views/blade/form/index.blade.php+++ b/resources/views/blade/form/index.blade.php@@ -2,14 +2,15 @@'route' => null,'item' => null,'class' => 'form-horizontal',+ 'id' => 'create-form',])@aware(['name', 'footer'])-<form id="create-form" class="{{ $class }}" method="post" action="{{ $route }}" autocomplete="off" role="form" enctype="multipart/form-data">+<form id="{{ $id }}" class="{{ $class }}" method="post" action="{{ $route }}" autocomplete="off" role="form" enctype="multipart/form-data">@csrf- @if ($item->id)+ @if ($item?->id){{ method_field('PUT') }}@endifdiff --git a/resources/views/blade/input/category-select.blade.php b/resources/views/blade/input/category-select.blade.phpnew file mode 100644index 0000000000..6c7c52d757--- /dev/null+++ b/resources/views/blade/input/category-select.blade.php@@ -0,0 +1,53 @@+@use('App\Models\Category', 'Category')+@use('Illuminate\Support\Arr', 'Arr')++@props([+ 'label',+ 'name',+ 'selected' => null,+ 'required' => false,+ 'multiple' => false,+ 'hideNewButton' => false,+ 'categoryType' => 'assets',+])++<div+ @class([+ 'form-group',+ 'has-error' => $errors->has($name),+ ])+>+ <label for="{{ $name }}_select" class="col-md-3 control-label">{{ $label }}</label>+ <div class="col-md-7">+ <select+ class="js-data-ajax"+ data-endpoint="categories/{{ $categoryType }}"+ data-placeholder="{{ trans('general.select_category') }}"+ name="{{ $name }}{{ $multiple ? '[]' : '' }}"+ id="{{ $name }}_select"+ style="width: 100%"+ aria-label="{{ $label }}"+ @required($required)+ @if ($multiple) multiple @endif+ >+ <option value=""></option>+ @if ($selected)+ @foreach(Arr::wrap($selected) as $value)+ <option value="{{ $value }}" selected="selected" role="option" aria-selected="true">+ {{ Category::find($value)?->name }}+ </option>+ @endforeach+ @endif+ </select>+ </div>++ @unless($hideNewButton)+ <div class="col-md-1 col-sm-1 text-left">+ @can('create', Category::class)+ <a href="{{ route('modal.show', ['type' => 'category', 'category_type' => $categoryType]) }}" data-toggle="modal" data-target="#createModal" data-select="{{ $name }}_select" class="btn btn-sm btn-theme">{{ trans('button.new') }}</a>+ @endcan+ </div>+ @endunless++ {!! $errors->first($name, '<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>diff --git a/resources/views/blade/input/company-select.blade.php b/resources/views/blade/input/company-select.blade.phpnew file mode 100644index 0000000000..d4021cbe3a--- /dev/null+++ b/resources/views/blade/input/company-select.blade.php@@ -0,0 +1,52 @@+@use('App\Models\Company', 'Company')+@use('Illuminate\Support\Arr', 'Arr')++@props([+ 'label',+ 'name',+ 'selected' => null,+ 'required' => false,+ 'multiple' => false,+ 'hideNewButton' => false,+])++<div+ @class([+ 'form-group',+ 'has-error' => $errors->has($name),+ ])+>+ <label for="{{ $name }}" class="col-md-3 control-label">{{ $label }}</label>+ <div class="col-md-6">+ <select+ class="js-data-ajax"+ data-endpoint="companies"+ data-placeholder="{{ trans('general.select_company') }}"+ name="{{ $name }}{{ $multiple ? '[]' : '' }}"+ id="{{ $name }}"+ style="width: 100%"+ aria-label="{{ $label }}"+ @required($required)+ @if ($multiple) multiple @endif+ >+ <option value=""></option>+ @if ($selected)+ @foreach(Arr::wrap($selected) as $value)+ <option value="{{ $value }}" selected="selected" role="option" aria-selected="true">+ {{ Company::find($value)?->name }}+ </option>+ @endforeach+ @endif+ </select>+ </div>++ @unless($hideNewButton)+ <div class="col-md-1 col-sm-1 text-left">+ @can('create', Company::class)+ <a href="{{ route('modal.show', 'company') }}" data-toggle="modal" data-target="#createModal" data-select="{{ $name }}" class="btn btn-sm btn-theme">{{ trans('button.new') }}</a>+ @endcan+ </div>+ @endunless++ {!! $errors->first($name, '<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>diff --git a/resources/views/blade/input/location-select.blade.php b/resources/views/blade/input/location-select.blade.phpindex 40410f540c..7951fc5b5e 100644--- a/resources/views/blade/input/location-select.blade.php+++ b/resources/views/blade/input/location-select.blade.php@@ -50,7 +50,7 @@@if ($selected)@foreach(Arr::wrap($selected) as $value)<option value="{{ $value }}" selected="selected" role="option" aria-selected="true" role="option">- {{ optional(Location::find($value))->name }}+ {{ Location::find($value)?->name }}</option>@endforeach@endifdiff --git a/resources/views/blade/input/manufacturer-select.blade.php b/resources/views/blade/input/manufacturer-select.blade.phpnew file mode 100644index 0000000000..667852f658--- /dev/null+++ b/resources/views/blade/input/manufacturer-select.blade.php@@ -0,0 +1,52 @@+@use('App\Models\Manufacturer', 'Manufacturer')+@use('Illuminate\Support\Arr', 'Arr')++@props([+ 'label',+ 'name',+ 'selected' => null,+ 'required' => false,+ 'multiple' => false,+ 'hideNewButton' => false,+])++<div+ @class([+ 'form-group',+ 'has-error' => $errors->has($name),+ ])+>+ <label for="{{ $name }}_select" class="col-md-3 control-label">{{ $label }}</label>+ <div class="col-md-7">+ <select+ class="js-data-ajax"+ data-endpoint="manufacturers"+ data-placeholder="{{ trans('general.select_manufacturer') }}"+ name="{{ $name }}{{ $multiple ? '[]' : '' }}"+ id="{{ $name }}_select"+ style="width: 100%"+ aria-label="{{ $label }}"+ @required($required)+ @if ($multiple) multiple @endif+ >+ <option value=""></option>+ @if ($selected)+ @foreach(Arr::wrap($selected) as $value)+ <option value="{{ $value }}" selected="selected" role="option" aria-selected="true">+ {{ Manufacturer::find($value)?->name }}+ </option>+ @endforeach+ @endif+ </select>+ </div>++ @unless($hideNewButton)+ <div class="col-md-1 col-sm-1 text-left">+ @can('create', Manufacturer::class)+ <a href="{{ route('modal.show', 'manufacturer') }}" data-toggle="modal" data-target="#createModal" data-select="{{ $name }}_select" class="btn btn-sm btn-theme">{{ trans('button.new') }}</a>+ @endcan+ </div>+ @endunless++ {!! $errors->first($name, '<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>diff --git a/resources/views/blade/input/minimum-quantity.blade.php b/resources/views/blade/input/minimum-quantity.blade.phpnew file mode 100644index 0000000000..5e6aee586c--- /dev/null+++ b/resources/views/blade/input/minimum-quantity.blade.php@@ -0,0 +1,35 @@+@use('App\Helpers\Helper')++@props([+ 'item' => null,+])++<div+ @class([+ 'form-group',+ 'has-error' => $errors->has('min_amt'),+ ])+>+ <label for="min_amt" class="col-md-3 control-label">{{ trans('general.min_amt') }}</label>+ <div class="col-md-9">+ <div class="col-md-3" style="padding-left: 0">+ <input+ class="form-control"+ type="number"+ name="min_amt"+ id="min_amt"+ aria-label="{{ trans('general.min_amt') }}"+ value="{{ old('min_amt', $item->min_amt ?? '') }}"+ min="0"+ maxlength="5"+ @required(Helper::checkIfRequired($item, 'min_amt'))+ />+ </div>+ <div class="col-md-7" style="margin-left: -15px">+ <x-form.tooltip>{{ trans('general.min_amt_help') }}</x-form.tooltip>+ </div>+ <div class="col-md-12">+ {!! $errors->first('min_amt', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}+ </div>+ </div>+</div>diff --git a/resources/views/blade/input/purchase-cost.blade.php b/resources/views/blade/input/purchase-cost.blade.phpnew file mode 100644index 0000000000..b9959f3af0--- /dev/null+++ b/resources/views/blade/input/purchase-cost.blade.php@@ -0,0 +1,41 @@+@use('App\Helpers\Helper')++@props([+ 'label' => null,+ 'item' => null,+ 'currencyType' => null,+])++<div+ @class([+ 'form-group',+ 'has-error' => $errors->has('purchase_cost'),+ ])+>+ <label for="purchase_cost" class="col-md-3 control-label">+ {{ $label ?? trans('general.purchase_cost') }}+ </label>+ <div class="col-md-9">+ <div class="input-group col-md-5" style="padding-left: 0">+ <input+ class="form-control"+ type="text"+ name="purchase_cost"+ id="purchase_cost"+ aria-label="{{ $label ?? trans('general.purchase_cost') }}"+ value="{{ old('purchase_cost', Helper::formatCurrencyOutput($item->purchase_cost)) }}"+ maxlength="25"+ inputmode="decimal"+ pattern="[\d.,]+"+ data-msg-pattern="{{ trans('general.purchase_cost_invalid') }}"+ />+ <span class="input-group-addon">+ {{ $currencyType ?? $snipeSettings->default_currency }}+ </span>+ </div>+ <div class="col-md-9" style="padding-left: 0">+ {!! $errors->first('purchase_cost', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}+ <p class="help-block">{{ trans('general.purchase_cost_format_help', ['format' => $snipeSettings->digit_separator]) }}</p>+ </div>+ </div>+</div>diff --git a/resources/views/blade/input/quantity.blade.php b/resources/views/blade/input/quantity.blade.phpnew file mode 100644index 0000000000..295c850b6c--- /dev/null+++ b/resources/views/blade/input/quantity.blade.php@@ -0,0 +1,37 @@+@use('App\Helpers\Helper')++@props([+ 'item' => null,+ 'name' => 'qty',+ 'label' => null,+ 'min' => 0,+])++<div+ @class([+ 'form-group',+ 'has-error' => $errors->has($name),+ ])+>+ <label for="{{ $name }}" class="col-md-3 control-label">+ {{ $label ?? trans('general.quantity') }}+ </label>+ <div class="col-md-9">+ <div class="col-md-3" style="padding-left: 0">+ <input+ class="form-control"+ type="number"+ name="{{ $name }}"+ id="{{ $name }}"+ aria-label="{{ $label ?? trans('general.quantity') }}"+ value="{{ old($name, $item->{$name} ?? '') }}"+ min="{{ $min }}"+ maxlength="5"+ @required(Helper::checkIfRequired($item, $name))+ />+ </div>+ <div class="col-md-12" style="padding-left: 0">+ {!! $errors->first($name, '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}+ </div>+ </div>+</div>diff --git a/resources/views/blade/input/supplier-select.blade.php b/resources/views/blade/input/supplier-select.blade.phpnew file mode 100644index 0000000000..9348f8f4ed--- /dev/null+++ b/resources/views/blade/input/supplier-select.blade.php@@ -0,0 +1,54 @@+@use('App\Models\Supplier', 'Supplier')+@use('Illuminate\Support\Arr', 'Arr')++@props([+ 'label',+ 'name',+ 'selected' => null,+ 'required' => false,+ 'multiple' => false,+ 'hideNewButton' => false,+ 'companyId' => null,+])++<div+ @class([+ 'form-group',+ 'has-error' => $errors->has($name),+ ])+>+ <label for="{{ $name }}_select" class="col-md-3 control-label">{{ $label }}</label>+ <div class="col-md-7">+ <select+ class="js-data-ajax"+ data-endpoint="suppliers"+ data-placeholder="{{ trans('general.select_supplier') }}"+ name="{{ $name }}{{ $multiple ? '[]' : '' }}"+ id="{{ $name }}_select"+ style="width: 100%"+ aria-label="{{ $label }}"+ @required($required)+ @if ($multiple) multiple @endif+ @if ($companyId) data-company-id="{{ $companyId }}" @endif+ >+ <option value=""></option>+ @if ($selected)+ @foreach(Arr::wrap($selected) as $value)+ <option value="{{ $value }}" selected="selected" role="option" aria-selected="true">+ {{ Supplier::find($value)?->name }}+ </option>+ @endforeach+ @endif+ </select>+ </div>++ @unless($hideNewButton)+ <div class="col-md-1 col-sm-1 text-left">+ @can('create', Supplier::class)+ <a href="{{ route('modal.show', 'supplier') }}" data-toggle="modal" data-target="#createModal" data-select="{{ $name }}_select" class="btn btn-sm btn-theme">{{ trans('button.new') }}</a>+ @endcan+ </div>+ @endunless++ {!! $errors->first($name, '<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>