Some code optimisation and de-duplication with components

This commit is contained in:
2025-01-15 23:29:53 +11:00
parent 8b922b2e8b
commit 6e06caa83b
15 changed files with 169 additions and 101 deletions

View File

@@ -1,30 +1,7 @@
@extends('layouts.dn')
@section('page_title')
<table class="table table-borderless">
<tr>
<td class="{{ ($x=$o->getObject('jpegphoto')) ? 'border' : '' }}" rowspan="2">{!! $x ? $x->render() : sprintf('<div class="page-title-icon f32"><i class="%s"></i></div>',$o->icon() ?? "fas fa-info") !!}</td>
<td class="text-end align-text-top p-0 {{ $x ? 'ps-5' : 'pt-2' }}"><strong>{{ $dn }}</strong></td>
</tr>
<tr>
<td class="line-height-1" style="font-size: 55%;vertical-align: bottom;" colspan="2">
<table>
<tr>
<td class="p-1 m-1">Created</td>
<th class="p-1 m-1">{{ ($x=$o->getObject('createtimestamp')) ? $x->render() : __('Unknown') }} [{{ ($x=$o->getObject('creatorsname')) ? $x->render() : __('Unknown') }}]</th>
</tr>
<tr>
<td class="p-1 m-1">Modified</td>
<th class="p-1 m-1">{{ ($x=$o->getObject('modifytimestamp')) ? $x->render() : __('Unknown') }} [{{ ($x=$o->getObject('modifiersname')) ? $x->render() : __('Unknown') }}]</th>
</tr>
<tr>
<td class="p-1 m-1">UUID</td>
<th class="p-1 m-1">{{ $o->entryuuid[0] ?? '' }}</th>
</tr>
</table>
</td>
</tr>
</table>
@include('fragment.dn.header')
@endsection
@section('main-content')
@@ -74,13 +51,7 @@
<div class="row">
<div class="col-12 pt-2">
<label for="newattr" class="form-label">Select from...</label>
<select class="form-select" id="newattr">
<option value="">&nbsp;</option>
@foreach ($o->getMissingAttributes() as $ao)
<option value="{{ $ao->name_lc }}">{{ $ao->name }}</option>
@endforeach
</select>
<x-form.select id="newattr" label="Select from..." :options="$o->getMissingAttributes()->sortBy('name')->map(fn($item)=>['id'=>$item->name,'value'=>$item->name_lc])"/>
</div>
</div>
@endif