Standardise attribute layout

This commit is contained in:
Deon George 2024-01-09 23:28:17 +11:00
parent c02f390f64
commit 1f753c4dc6
5 changed files with 93 additions and 114 deletions

View File

@ -1,26 +1,19 @@
<!-- $o=Attribute::class --> <!-- $o=Attribute::class -->
<div class="row pt-2"> <x-attribute.layout :edit="$edit" :new="$new" :o="$o">
<div class="col-1"></div> @foreach (old($o->name_lc,$new ? [NULL] : $o->values) as $value)
<div class="col-10 p-2"> @if ($edit && ! $o->is_rdn)
<div id="{{ $o->name_lc }}"> <div class="input-group has-validation">
@foreach (old($o->name_lc,$new ? [NULL] : $o->values) as $value) <input type="text" class="form-control @if($e=$errors->get($o->name_lc.'.'.$loop->index))is-invalid @endif mb-1 @if($o->values->search($value) === FALSE) border-focus @endif" name="{{ $o->name_lc }}[]" value="{{ $value }}" placeholder="{{ ! is_null($x=Arr::get($o->values,$loop->index)) ? $x : '['.__('NEW').']' }}" @if (! $new)readonly="true" @endif">
@if ($edit && ! $o->is_rdn)
<div class="input-group has-validation">
<input type="text" class="form-control @if($e=$errors->get($o->name_lc.'.'.$loop->index))is-invalid @endif mb-1 @if($o->values->search($value) === FALSE) border-focus @endif" name="{{ $o->name_lc }}[]" value="{{ $value }}" placeholder="{{ ! is_null($x=Arr::get($o->values,$loop->index)) ? $x : '['.__('NEW').']' }}" @if (! $new)readonly="true" @endif">
<div class="invalid-feedback pb-2"> <div class="invalid-feedback pb-2">
@if($e) @if($e)
{{ join('|',$e) }} {{ join('|',$e) }}
@endif @endif
</div> </div>
</div> </div>
@else @else
{{ $value }} {{ $value }}
@endif @endif
@endforeach @endforeach
</div> </x-attribute.layout>
@include('components.attribute.widget.options')
</div>
</div>

View File

@ -1,40 +1,30 @@
<!-- $o=Binary\JpegPhoto::class -->
<!-- @todo We are not handling redirect backs with updated photos --> <!-- @todo We are not handling redirect backs with updated photos -->
<div class="row pt-2"> <!-- $o=Binary\JpegPhoto::class -->
<div class="col-1"></div> <x-attribute.layout :edit="$edit" :new="false" :o="$o">
<div class="col-10 p-2"> <table class="table table-borderless p-0 m-0">
<div id="{{ $o->name_lc }}"> @foreach ($o->values as $value)
<table class="table table-borderless p-0 m-0"> <tr>
@foreach ($o->values as $value) @switch ($x=$f->buffer($value,FILEINFO_MIME_TYPE))
<div class="input-group has-validation"> @case('image/jpeg')
<tr> @default
@switch ($x=$f->buffer($value,FILEINFO_MIME_TYPE)) <td>
@case('image/jpeg') <input type="hidden" name="{{ $o->name_lc }}[]" value="{{ md5($value) }}">
@default <img class="jpegphoto @if($e=$errors->get($o->name_lc.'.'.$loop->index))is-invalid @endif" src="data:{{ $x }};base64, {{ base64_encode($value) }}" />
<td>
<input type="hidden" name="{{ $o->name_lc }}[]" value="{{ md5($value) }}">
<img class="jpegphoto" src="data:{{ $x }};base64, {{ base64_encode($value) }}" @if($e=$errors->get($o->name_lc.'.'.$loop->index))is-invalid @endif />
@if ($edit) @if ($edit)
<br> <br>
<!-- @todo TO IMPLEMENT --> <!-- @todo TO IMPLEMENT -->
<span class="btn btn-sm btn-danger deletable d-none"><i class="fas fa-trash-alt"></i> @lang('Delete')</span> <span class="btn btn-sm btn-danger deletable d-none"><i class="fas fa-trash-alt"></i> @lang('Delete')</span>
<div class="invalid-feedback pb-2"> <div class="invalid-feedback pb-2">
@if($e) @if($e)
{{ join('|',$e) }} {{ join('|',$e) }}
@endif @endif
</div> </div>
@endif @endif
</td> </td>
@endswitch @endswitch
</tr> </tr>
</div> @endforeach
@endforeach </table>
</table> </x-attribute.layout>
</div>
<!-- @todo TO IMPLEMENT -->
@include('components.attribute.widget.options')
</div>
</div>

View File

@ -0,0 +1,10 @@
<div class="row pt-2">
<div class="col-1 @if(! $edit)d-none @endif"></div>
<div class="col-10 p-2">
<div id="{{ $o->name_lc }}">
{{ $slot }}
</div>
<x-attribute.widget.options :o="$o" :edit="$edit" :new="$new"></x-attribute.widget.options>
</div>
</div>

View File

@ -1,29 +1,22 @@
<!-- $o=Attribute::class --> <!-- $o=Attribute::class -->
<div class="row"> <x-attribute.layout :edit="$edit" :new="$new" :o="$o">
<div class="col-1"></div> @foreach (old($o->name_lc,$o->values) as $value)
<div class="col-10 p-2"> @if ($edit && ($value === NULL || (! $o->isStructural($value))))
<div id="{{ $o->name_lc }}"> <div class="input-group has-validation">
@foreach (old($o->name_lc,$o->values) as $value) <input type="text" class="form-control @if($e=$errors->get($o->name_lc.'.'.$loop->index))is-invalid @endif mb-1 @if($o->values->search($value) === FALSE) border-focus @endif" name="{{ $o->name_lc }}[]" value="{{ $value }}" placeholder="{{ ! is_null($x=Arr::get($o->values,$loop->index)) ? $x : '['.__('NEW').']' }}" readonly="true">
@if ($edit && ($value === NULL || (! $o->isStructural($value)))) <div class="invalid-feedback pb-2">
<div class="input-group has-validation"> @if($e)
<input type="text" class="form-control @if($e=$errors->get($o->name_lc.'.'.$loop->index))is-invalid @endif mb-1 @if($o->values->search($value) === FALSE) border-focus @endif" name="{{ $o->name_lc }}[]" value="{{ $value }}" placeholder="{{ ! is_null($x=Arr::get($o->values,$loop->index)) ? $x : '['.__('NEW').']' }}" readonly="true"> {{ join('|',$e) }}
<div class="invalid-feedback pb-2">
@if($e)
{{ join('|',$e) }}
@endif
</div>
</div>
@else
{{ $value }}
@if ($o->isStructural($value))
<input type="hidden" name="{{ $o->name_lc }}[]" value="{{ $value }}">
<span class="float-end mb-2">@lang('structural')</span>
@endif @endif
<br> </div>
@endif </div>
@endforeach @else
</div> {{ $value }}
@if ($o->isStructural($value))
@include('components.attribute.widget.options') <input type="hidden" name="{{ $o->name_lc }}[]" value="{{ $value }}">
</div> <span class="float-end mb-2">@lang('structural')</span>
</div> @endif
<br>
@endif
@endforeach
</x-attribute.layout>

View File

@ -1,30 +1,23 @@
<!-- $o=Password::class -->
<!-- @todo We are not handling redirect backs with updated values --> <!-- @todo We are not handling redirect backs with updated values -->
<div class="row pt-2"> <!-- $o=Password::class -->
<div class="col-1"></div> <x-attribute.layout :edit="$edit" :new="$new" :o="$o">
<div class="col-10 p-2"> @foreach ($o->values as $value)
<div id="{{ $o->name_lc }}"> @if ($edit)
@foreach ($o->values as $value) <div class="input-group has-validation">
@if ($edit) <input type="password" class="form-control @if($e=$errors->get($o->name_lc.'.'.$loop->index))is-invalid @endif mb-1 @if($o->values->search($value) === FALSE) border-focus @endif" name="{{ $o->name_lc }}[]" value="{{ md5($value) }}" readonly="true">
<div class="input-group has-validation">
<input type="password" class="form-control @if($e=$errors->get($o->name_lc.'.'.$loop->index))is-invalid @endif mb-1 @if($o->values->search($value) === FALSE) border-focus @endif" name="{{ $o->name_lc }}[]" value="{{ md5($value) }}" readonly="true">
<div class="invalid-feedback pb-2"> <div class="invalid-feedback pb-2">
@if($e) @if($e)
{{ join('|',$e) }} {{ join('|',$e) }}
@endif @endif
</div> </div>
</div> </div>
@else @else
{{ $value }}<br> {{ $value }}<br>
@endif @endif
@endforeach @endforeach
</div>
@include('components.attribute.widget.options') <span class="p-0 m-0">
<span class="btn btn-sm btn-outline-dark mt-3"><i class="fas fa-user-check"></i> @lang('Check Password')</span>
<span class="p-0 m-0"> </span>
<span class="btn btn-sm btn-outline-dark mt-3"><i class="fas fa-user-check"></i> @lang('Check Password')</span> </x-attribute.layout>
</span>
</div>
</div>