Moar refactorings

This commit is contained in:
snipe
2025-10-30 22:26:21 +00:00
parent be344c440f
commit 08609d4f56
3 changed files with 82 additions and 50 deletions

View File

@@ -2,7 +2,7 @@
return [
'select_type' => 'Select Maintenance Type',
'asset_maintenance_type' => 'Asset Maintenance Type',
'asset_maintenance_type' => 'Maintenance Type',
'title' => 'Title',
'start_date' => 'Start Date',
'completion_date' => 'Completion Date',

View File

@@ -5,8 +5,23 @@
])
<!-- Datepicker -->
<div {{ $attributes->merge(['class' => 'input-group']) }} data-provide="datepicker" data-date-today-highlight="true" data-date-language="{{ auth()->user()->locale }}" data-date-locale="{{ auth()->user()->locale }}" data-date-format="yyyy-mm-dd" data-date-autoclose="true" data-date-clear-btn="true"{{ $end_date ? ' data-date-end-date=' . $end_date : '' }}>
<input type="text" placeholder="{{ trans('general.select_date') }}" value="{{ $value }}" maxlength="10" {{ $attributes->merge(['class' => 'form-control']) }} {{ $required=='1' ? 'required' : '' }}>
<div
{{ $attributes->merge(['class' => 'input-group date']) }}
data-provide="datepicker"
data-date-today-highlight="true"
data-date-language="{{ auth()->user()->locale }}"
data-date-locale="{{ auth()->user()->locale }}"
data-date-format="yyyy-mm-dd"
data-date-autoclose="true"
data-date-clear-btn="true"{{ $end_date ? ' data-date-end-date=' . $end_date : '' }}>
<input
type="text"
placeholder="{{ trans('general.select_date') }}"
value="{{ $value }}" maxlength="10"
{{ $attributes->merge(['class' => 'form-control']) }}
{{ $required ? ' required' : '' }}
>
<span class="input-group-addon"><x-icon type="calendar" /></span>
</div>

View File

@@ -35,13 +35,13 @@
@if ($item->asset)
<x-form-row>
<x-form-label>{{ trans('general.asset') }}</x-form-label>
<x-form-label>{{ trans('general.asset') }}</x-form-label>
<x-form-input>
<x-input.static>
{{ $item->asset->display_name }}
</x-input.static>
</x-form-input>
<x-form-input>
<x-input.static>
{{ $item->asset->display_name }}
</x-input.static>
</x-form-input>
</x-form-row>
@@ -63,55 +63,71 @@
@if ($item->asset->location)
<x-form-row>
<x-form-label>
{{ trans('general.location') }}
</x-form-label>
<x-form-label>
{{ trans('general.location') }}
</x-form-label>
<x-form-input>
<x-input.static>
{{ $item->asset->location->display_name }}
</x-input.static>
</x-form-input>
<x-form-input>
<x-input.static>
{{ $item->asset->location->display_name }}
</x-input.static>
</x-form-input>
</x-form-row>
@endif
@endif
@endif
<!-- Name -->
<x-form-row>
<x-form-label>{{ trans('general.name') }}</x-form-label>
<x-form-label>{{ trans('general.name') }}</x-form-label>
<x-form-input>
<x-input.text
name="name"
:value="$item->name"
required="true"
/>
</x-form-input>
<x-form-input>
<x-input.text
name="name"
:value="$item->name"
required="true"
/>
</x-form-input>
</x-form-row>
@if (!$item->id)
<x-form-row>
<x-form-label>{{ trans('general.select_asset') }}</x-form-label>
<x-form-input>
<x-input.select2-ajax
name="selected_assets[]"
:value="$item->name"
required="true"
multiple="true"
data_endpoint="hardware"
:data_placeholder="trans('general.select_asset')"
/>
</x-form-input>
</x-form-row>
<x-form-row>
<x-form-label>{{ trans('general.assets') }}</x-form-label>
<x-form-input>
<x-input.select2-ajax
name="selected_assets[]"
:value="$item->name"
required="true"
multiple="true"
data_endpoint="hardware"
:data_placeholder="trans('general.select_asset')"
/>
</x-form-input>
</x-form-row>
@endif
<!-- Maintenance Type -->
<x-form-row>
<x-form-label>{{ trans('admin/asset_maintenances/form.asset_maintenance_type') }}</x-form-label>
<x-form-input>
<x-input.select
name="asset_maintenance_type"
:options="$maintenanceType"
:selected="old('asset_maintenance_type', $item->asset_maintenance_type)"
:required="Helper::checkIfRequired($item, 'asset_maintenance_type')"
data-placeholder="{{ trans('admin/maintenances/form.select_type')}}"
includeEmpty="true"
style="width:100%;"
aria-label="asset_maintenance_type"
/>
</x-form-input>
</x-form-row>
<!--- Start Date -->
<x-form-row>
@@ -119,9 +135,9 @@
<x-form-input class="col-md-5">
<x-input.datepicker
name="start_date"
:value="$item->start_date"
required="true"
name="start_date"
:value="$item->start_date"
required="true"
/>
</x-form-input>
</x-form-row>
@@ -133,9 +149,8 @@
<x-form-input class="col-md-5">
<x-input.datepicker
name="start_date"
name="completion_date"
:value="$item->completion_date"
required="true"
/>
</x-form-input>
</x-form-row>
@@ -146,11 +161,12 @@
<x-form-input>
<x-input.text
type="url"
:value="$item->url"
input_icon="link"
input_group_addon="left"
placeholder="https://example.com"
name="url"
type="url"
:value="$item->url"
input_icon="link"
input_group_addon="left"
placeholder="https://example.com"
/>
</x-form-input>
</x-form-row>
@@ -159,12 +175,13 @@
<!-- Supplier -->
<x-form-row>
{{ $item->supplier->id }}
<x-form-label>{{ trans('general.supplier') }}</x-form-label>
<x-form-input>
<x-input.select2-ajax
name="supplier_id"
:value="$item->supplier ? $item->supplier->id : old('supplier_id')"
:selected="old('supplier_id', ($item->supplier) ? $item->supplier_id : '')"
data_endpoint="suppliers"
:data_placeholder="trans('general.select_supplier')"
/>