@extends('layouts/default') {{-- Page title --}} @section('title') {{ $item->id ? trans('admin/hardware/form.update') : trans('admin/hardware/form.create') }} @parent @stop {{-- Page content --}} @section('content') @if ($item->id) {{ $item->display_name }} @endif
@if ($item->id) {{-- Editing an existing asset — only one tag input. UpdateAssetRequest + the Asset model rules key on asset_tag (singular), so that's the only error to render. --}}
@else {{-- Creating a new asset — operator can add extra tag rows via the plus button, which dispatches an addTagRow event to the Livewire component below. Passes the primary tag input's current DOM value so the component auto-increments from whatever the operator has actually typed, not the server-rendered default. CreateMultipleAssetRequest remaps the asset_tag rule onto each row's asset_tags[N], so this row's error keys on asset_tags.1. --}}
@endif
{{-- Serial (row 1). Required if the model has require_serial set or if the asset's own rules mark it required. --}} {{-- Additional tag + serial rows (indices 2+) for bulk-create. Only rendered when creating a new asset. Livewire owns the add/remove state and rehydrates from old input on validation redisplay; the outer form's plain POST submit picks up the rendered inputs by name (asset_tags[N] / serials[N]) alongside row 1. --}} @if (! $item->id) @endif @include ('partials.forms.edit.model-select', ['translated_name' => trans('admin/hardware/form.model'), 'fieldname' => 'model_id', 'field_req' => true]) @include ('partials.forms.edit.status', [ 'required' => 'true']) @if (!$item->id) @include ('partials.forms.checkout-selector', ['user_select' => 'true','asset_select' => 'true', 'location_select' => 'true', 'style' => 'display:none;']) @include ('partials.forms.edit.asset-select', ['translated_name' => trans('general.asset'), 'fieldname' => 'assigned_asset', 'style' => 'display:none;', 'required' => 'false']) @include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'assigned_location', 'style' => 'display:none;', 'required' => 'false']) @endif {{-- Notes --}} {{-- Current location. When blank, the observer / checkout flow updates location_id to match the checkout target's location (user's location, target-location, or parent asset's location). See the note under general.location_edit_help. --}} {{-- Default (ready-to-deploy) location --}} {{-- Requestable --}}
@if ($item->model && $item->model->fieldset) @endif @if (old('model_id')) @php $model = \App\Models\AssetModel::find(old('model_id')); @endphp @elseif (isset($selected_model)) @php $model = $selected_model; @endphp @endif @if (isset($model) && $model) @include("models/custom_fields_form",["model" => $model]) @endif
{{ trans('admin/hardware/form.optional_infos') }}
{{ trans('admin/hardware/form.order_details') }}
@stop @section('moar_scripts') @stop