Update components to use… blade components
This commit is contained in:
@@ -43,7 +43,8 @@ class ComponentCheckinController extends Controller
|
||||
}
|
||||
$this->authorize('checkin', $component);
|
||||
|
||||
return view('components/checkin', compact('component_assets', 'component', 'asset'));
|
||||
return view('components/checkin', compact('component_assets', 'component', 'asset'))
|
||||
->with('snipe_component', $component);
|
||||
}
|
||||
|
||||
return redirect()->route('components.index')->with('error', trans('admin/components/messages.not_found'));
|
||||
|
||||
@@ -46,7 +46,8 @@ class ComponentCheckoutController extends Controller
|
||||
}
|
||||
|
||||
// Return the checkout view
|
||||
return view('components/checkout', compact('component'));
|
||||
return view('components/checkout', compact('component'))
|
||||
->with('snipe_component', $component);
|
||||
}
|
||||
|
||||
// Invalid category
|
||||
|
||||
@@ -23,6 +23,7 @@ use App\Models\PredefinedKit;
|
||||
use App\Models\Statuslabel;
|
||||
use App\Models\Supplier;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Tabuna\Breadcrumbs\Breadcrumbs;
|
||||
use Tabuna\Breadcrumbs\Trail;
|
||||
@@ -203,6 +204,25 @@ class BreadcrumbsServiceProvider extends ServiceProvider
|
||||
->push(trans('general.clone'), route('components.create'))
|
||||
);
|
||||
|
||||
Breadcrumbs::for('components.checkout.show', function (Trail $trail, int $componentID) {
|
||||
$component = Component::find($componentID);
|
||||
$trail->parent('components.index');
|
||||
if ($component) {
|
||||
$trail->push($component->name, route('components.show', $component));
|
||||
}
|
||||
$trail->push(trans('general.checkout'));
|
||||
});
|
||||
|
||||
Breadcrumbs::for('components.checkin.show', function (Trail $trail, int $componentAssetId) {
|
||||
$componentAsset = DB::table('components_assets')->find($componentAssetId);
|
||||
$component = $componentAsset ? Component::find($componentAsset->component_id) : null;
|
||||
$trail->parent('components.index');
|
||||
if ($component) {
|
||||
$trail->push($component->name, route('components.show', $component));
|
||||
}
|
||||
$trail->push(trans('general.checkin'));
|
||||
});
|
||||
|
||||
/**
|
||||
* Consumables Breadcrumbs
|
||||
*/
|
||||
|
||||
@@ -6,68 +6,55 @@
|
||||
@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">
|
||||
<!-- left column -->
|
||||
<div class="col-md-7">
|
||||
<form class="form-horizontal" method="post" action="{{ route('components.checkin.store', [$component_assets->id, 'backto' => 'asset']) }}" autocomplete="off">
|
||||
{{csrf_field()}}
|
||||
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<h2 class="box-title"> {{ $component->name }}</h2>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<x-container class="col-md-7">
|
||||
|
||||
<!-- Checked out to -->
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ trans('general.checkin_from') }}</label>
|
||||
<div class="col-md-6">
|
||||
<p class="form-control-static">{{ $asset->present()->fullName }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<x-form route="{{ route('components.checkin.store', [$component_assets->id, 'backto' => 'asset']) }}">
|
||||
|
||||
<x-box header="{{ $snipe_component->name }}">
|
||||
|
||||
<!-- Qty -->
|
||||
<div class="form-group {{ $errors->has('checkin_qty') ? 'error' : '' }}">
|
||||
<label for="checkin_qty" class="col-md-2 control-label">{{ trans('general.qty') }}</label>
|
||||
<div class="col-md-3 text-right">
|
||||
<input type="text" class="form-control" name="checkin_qty" aria-label="checkin_qty" value="{{ old('assigned_qty', $component_assets->assigned_qty) }}">
|
||||
</div>
|
||||
<div class="col-md-9 col-md-offset-2">
|
||||
<p class="help-block">{{ trans('admin/components/general.checkin_limit', ['assigned_qty' => $component_assets->assigned_qty]) }}</p>
|
||||
{!! $errors->first('checkin_qty', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i>
|
||||
:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
<x-form.static :label="trans('general.checkin_from')">{{ $asset->present()->fullName }}</x-form.static>
|
||||
|
||||
<!-- Note -->
|
||||
<div class="form-group {{ $errors->has('note') ? 'error' : '' }}">
|
||||
<label for="note" class="col-md-2 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', $component->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>
|
||||
<x-redirect_submit_options
|
||||
index_route="components.index"
|
||||
:button_label="trans('general.checkin')"
|
||||
:options="[
|
||||
'index' => trans('admin/hardware/form.redirect_to_all', ['type' => trans('general.components')]),
|
||||
'item' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.component')]),
|
||||
]"
|
||||
/>
|
||||
</div> <!-- /.box-->
|
||||
</form>
|
||||
</div> <!-- /.col-md-7-->
|
||||
</div>
|
||||
<!-- Qty -->
|
||||
<div class="form-group {{ $errors->has('checkin_qty') ? 'has-error' : '' }}">
|
||||
<label for="checkin_qty" class="col-md-3 control-label">{{ trans('general.qty') }}</label>
|
||||
<div class="col-md-3 text-right">
|
||||
<input type="text" class="form-control" name="checkin_qty" aria-label="{{ trans('general.qty') }}" id="checkin_qty" value="{{ old('assigned_qty', $component_assets->assigned_qty) }}">
|
||||
</div>
|
||||
<div class="col-md-9 col-md-offset-2">
|
||||
<p class="help-block">{{ trans('admin/components/general.checkin_limit', ['assigned_qty' => $component_assets->assigned_qty]) }}</p>
|
||||
{!! $errors->first('checkin_qty', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<x-form.row
|
||||
:label="trans('admin/hardware/form.notes')"
|
||||
:item="$snipe_component"
|
||||
name="note"
|
||||
type="textarea"
|
||||
/>
|
||||
|
||||
<x-slot:customfooter>
|
||||
<x-redirect_submit_options
|
||||
index_route="components.index"
|
||||
:button_label="trans('general.checkin')"
|
||||
:options="[
|
||||
'index' => trans('admin/hardware/form.redirect_to_all', ['type' => trans('general.components')]),
|
||||
'item' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.component')]),
|
||||
]"
|
||||
/>
|
||||
</x-slot:customfooter>
|
||||
|
||||
</x-box>
|
||||
|
||||
</x-form>
|
||||
|
||||
</x-container>
|
||||
|
||||
@stop
|
||||
|
||||
@@ -2,117 +2,86 @@
|
||||
|
||||
{{-- Page title --}}
|
||||
@section('title')
|
||||
{{ trans('admin/components/general.checkout') }}
|
||||
@parent
|
||||
{{ trans('admin/components/general.checkout') }}
|
||||
@parent
|
||||
@stop
|
||||
|
||||
{{-- Page content --}}
|
||||
@section('content')
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<form class="form-horizontal" id="checkout_form" method="post" action="" autocomplete="off">
|
||||
<!-- CSRF Token -->
|
||||
{{ csrf_field() }}
|
||||
<x-container class="col-md-8">
|
||||
|
||||
<div class="box box-default">
|
||||
@if ($component->id)
|
||||
<div class="box-header with-border">
|
||||
<div class="box-heading">
|
||||
<h2 class="box-title">{{ $component->name }} ({{ $component->numRemaining() }} {{ trans('admin/components/general.remaining') }})</h2>
|
||||
</div>
|
||||
</div><!-- /.box-header -->
|
||||
@endif
|
||||
<x-form route="{{ route('components.checkout.store', $snipe_component->id) }}" id="checkout_form">
|
||||
|
||||
<div class="box-body">
|
||||
<x-box header="{{ $snipe_component->name }} ({{ $snipe_component->numRemaining() }} {{ trans('admin/components/general.remaining') }})">
|
||||
|
||||
@if ($component->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">{!! $component->company->present()->formattedNameLink !!}</p>
|
||||
@if ($snipe_component->company)
|
||||
<x-form.static :label="trans('general.company')">{!! $snipe_component->company->present()->formattedNameLink !!}</x-form.static>
|
||||
@endif
|
||||
|
||||
@if ($snipe_component->category)
|
||||
<x-form.static :label="trans('general.category')">{!! $snipe_component->category->present()->formattedNameLink !!}</x-form.static>
|
||||
@endif
|
||||
|
||||
@include ('partials.forms.edit.asset-select', ['translated_name' => trans('general.select_asset'), 'fieldname' => 'asset_id', 'company_id' => $snipe_component->company_id, 'required' => 'true', 'value' => old('asset_id')])
|
||||
|
||||
<!-- Qty -->
|
||||
<div class="form-group {{ $errors->has('assigned_qty') ? 'has-error' : '' }}">
|
||||
<label for="assigned_qty" class="col-md-3 control-label">{{ trans('general.qty') }}</label>
|
||||
<div class="col-md-2 col-sm-5 col-xs-5">
|
||||
<input class="form-control" type="number" name="assigned_qty" id="assigned_qty" value="1" min="1" max="{{ old('assigned_qty') ?? $snipe_component->numRemaining() }}" aria-label="{{ trans('general.qty') }}" maxlength="999999" />
|
||||
</div>
|
||||
@if ($errors->first('assigned_qty'))
|
||||
<div class="col-md-9 col-md-offset-3">
|
||||
{!! $errors->first('assigned_qty', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@if ($snipe_component->requireAcceptance() || $snipe_component->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 ($snipe_component->category->require_acceptance == '1')
|
||||
<i class="far fa-envelope" aria-hidden="true"></i>
|
||||
{{ trans('admin/categories/general.required_acceptance') }}<br>
|
||||
@endif
|
||||
@if ($snipe_component->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>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<x-form.row
|
||||
:label="trans('admin/hardware/form.notes')"
|
||||
:item="$snipe_component"
|
||||
name="note"
|
||||
type="textarea"
|
||||
/>
|
||||
|
||||
@if ($component->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">{!! $component->category->present()->formattedNameLink !!}</p>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<x-slot:customfooter>
|
||||
<x-redirect_submit_options
|
||||
index_route="components.index"
|
||||
:button_label="trans('general.checkout')"
|
||||
:options="[
|
||||
'index' => trans('admin/hardware/form.redirect_to_all', ['type' => trans('general.components')]),
|
||||
'item' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.component')]),
|
||||
'target' => trans('admin/hardware/form.redirect_to_checked_out_to'),
|
||||
]"
|
||||
/>
|
||||
</x-slot:customfooter>
|
||||
|
||||
<!-- Asset -->
|
||||
@include ('partials.forms.edit.asset-select', ['translated_name' => trans('general.select_asset'), 'fieldname' => 'asset_id', 'company_id' => $component->company_id, 'required' => 'true', 'value' => old('asset_id')])
|
||||
</x-box>
|
||||
|
||||
<div class="form-group {{ $errors->has('assigned_qty') ? ' has-error' : '' }}">
|
||||
<label for="assigned_qty" class="col-md-3 control-label">
|
||||
{{ trans('general.qty') }}
|
||||
</label>
|
||||
<div class="col-md-2 col-sm-5 col-xs-5">
|
||||
<input class="form-control" type="number" name="assigned_qty" id="assigned_qty" value="1" min="1" max="{{ old('assigned_qty') ?? $component->numRemaining()}}" maxlength="999999"/>
|
||||
</div>
|
||||
@if ($errors->first('assigned_qty'))
|
||||
<div class="col-md-9 col-md-offset-3">
|
||||
{!! $errors->first('assigned_qty', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@if ($component->requireAcceptance() || $component->getEula() || ($snipeSettings->webhook_endpoint!=''))
|
||||
<div class="form-group notification-callout">
|
||||
<div class="col-md-8 col-md-offset-3">
|
||||
<div class="callout callout-info">
|
||||
</x-form>
|
||||
|
||||
@if ($component->category->require_acceptance=='1')
|
||||
<i class="far fa-envelope"></i>
|
||||
{{ trans('admin/categories/general.required_acceptance') }}
|
||||
<br>
|
||||
@endif
|
||||
|
||||
@if ($component->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>
|
||||
</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', $component->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>
|
||||
|
||||
|
||||
</div> <!-- .BOX-BODY-->
|
||||
<x-redirect_submit_options
|
||||
index_route="components.index"
|
||||
:button_label="trans('general.checkout')"
|
||||
:options="[
|
||||
'index' => trans('admin/hardware/form.redirect_to_all', ['type' => trans('general.components')]),
|
||||
'item' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.component')]),
|
||||
'target' => trans('admin/hardware/form.redirect_to_checked_out_to'),
|
||||
|
||||
]"
|
||||
/>
|
||||
</div> <!-- .box-default-->
|
||||
</form>
|
||||
</div> <!-- .col-md-9-->
|
||||
</div> <!-- .row -->
|
||||
</x-container>
|
||||
|
||||
@stop
|
||||
|
||||
@@ -1,36 +1,127 @@
|
||||
@extends('layouts/edit-form', [
|
||||
'createText' => trans('admin/components/general.create') ,
|
||||
'updateText' => trans('admin/components/general.update'),
|
||||
'helpPosition' => 'right',
|
||||
'helpText' => trans('help.components'),
|
||||
'formAction' => (isset($item->id)) ? route('components.update', ['component' => $item->id]) : route('components.store'),
|
||||
'index_route' => 'components.index',
|
||||
'options' => [
|
||||
'back' => trans('admin/hardware/form.redirect_to_type',['type' => trans('general.previous_page')]),
|
||||
'index' => trans('admin/hardware/form.redirect_to_all', ['type' => 'components']),
|
||||
'item' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.component')]),
|
||||
]
|
||||
@extends('layouts/default')
|
||||
|
||||
])
|
||||
{{-- Page title --}}
|
||||
@section('title')
|
||||
@if ($item->id)
|
||||
{{ trans('admin/components/general.update') }}
|
||||
@else
|
||||
{{ trans('admin/components/general.create') }}
|
||||
@endif
|
||||
@parent
|
||||
@stop
|
||||
|
||||
{{-- Page content --}}
|
||||
@section('inputFields')
|
||||
@section('content')
|
||||
|
||||
@include ('partials.forms.edit.name', ['translated_name' => trans('admin/components/table.title')])
|
||||
@include ('partials.forms.edit.category-select', ['translated_name' => trans('general.category'), 'fieldname' => 'category_id','category_type' => 'component'])
|
||||
@include ('partials.forms.edit.quantity')
|
||||
@include ('partials.forms.edit.minimum_quantity')
|
||||
@include ('partials.forms.edit.serial', ['fieldname' => 'serial'])
|
||||
@include ('partials.forms.edit.manufacturer-select', ['translated_name' => trans('general.manufacturer'), 'fieldname' => 'manufacturer_id'])
|
||||
@include ('partials.forms.edit.model_number')
|
||||
@include ('partials.forms.edit.company-select', ['translated_name' => trans('general.company'), 'fieldname' => 'company_id'])
|
||||
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
|
||||
@include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'supplier_id'])
|
||||
@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('components_upload_path')])
|
||||
<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('components.update', ['component' => $item->id]) : route('components.store') }}">
|
||||
|
||||
<x-box>
|
||||
|
||||
<x-form.row
|
||||
:label="trans('admin/components/table.title')"
|
||||
:$item
|
||||
name="name"
|
||||
/>
|
||||
|
||||
<x-input.category-select
|
||||
:label="trans('general.category')"
|
||||
name="category_id"
|
||||
:selected="old('category_id', $item->category_id)"
|
||||
required
|
||||
categoryType="component"
|
||||
/>
|
||||
|
||||
<x-input.quantity :item="$item" />
|
||||
|
||||
<x-input.minimum-quantity :item="$item" />
|
||||
|
||||
<x-form.row
|
||||
:label="trans('admin/hardware/form.serial')"
|
||||
:$item
|
||||
name="serial"
|
||||
/>
|
||||
|
||||
<x-input.manufacturer-select
|
||||
:label="trans('general.manufacturer')"
|
||||
name="manufacturer_id"
|
||||
:selected="old('manufacturer_id', $item->manufacturer_id)"
|
||||
/>
|
||||
|
||||
<x-form.row
|
||||
:label="trans('general.model_no')"
|
||||
:$item
|
||||
name="model_number"
|
||||
/>
|
||||
|
||||
<x-input.company-select
|
||||
:label="trans('general.company')"
|
||||
name="company_id"
|
||||
:selected="old('company_id', $item->company_id)"
|
||||
/>
|
||||
|
||||
<x-input.location-select
|
||||
:label="trans('general.location')"
|
||||
name="location_id"
|
||||
:selected="old('location_id', $item->location_id)"
|
||||
/>
|
||||
|
||||
<x-input.supplier-select
|
||||
:label="trans('general.supplier')"
|
||||
name="supplier_id"
|
||||
:selected="old('supplier_id', $item->supplier_id)"
|
||||
/>
|
||||
|
||||
<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('components_upload_path')])
|
||||
|
||||
<x-slot:customfooter>
|
||||
<x-redirect_submit_options
|
||||
index_route="components.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' => 'components']),
|
||||
'item' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.component')]),
|
||||
]"
|
||||
/>
|
||||
</x-slot:customfooter>
|
||||
|
||||
</x-box>
|
||||
|
||||
</x-form>
|
||||
|
||||
</x-container>
|
||||
|
||||
@stop
|
||||
|
||||
Reference in New Issue
Block a user