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 -->
<div class="row pt-2">
<div class="col-1"></div>
<div class="col-10 p-2">
<div id="{{ $o->name_lc }}">
@foreach (old($o->name_lc,$new ? [NULL] : $o->values) as $value)
@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">
<x-attribute.layout :edit="$edit" :new="$new" :o="$o">
@foreach (old($o->name_lc,$new ? [NULL] : $o->values) as $value)
@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">
@if($e)
{{ join('|',$e) }}
@endif
</div>
</div>
<div class="invalid-feedback pb-2">
@if($e)
{{ join('|',$e) }}
@endif
</div>
</div>
@else
{{ $value }}
@endif
@endforeach
</div>
@include('components.attribute.widget.options')
</div>
</div>
@else
{{ $value }}
@endif
@endforeach
</x-attribute.layout>

View File

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

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 -->
<div class="row">
<div class="col-1"></div>
<div class="col-10 p-2">
<div id="{{ $o->name_lc }}">
@foreach (old($o->name_lc,$o->values) as $value)
@if ($edit && ($value === NULL || (! $o->isStructural($value))))
<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').']' }}" readonly="true">
<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>
<x-attribute.layout :edit="$edit" :new="$new" :o="$o">
@foreach (old($o->name_lc,$o->values) as $value)
@if ($edit && ($value === NULL || (! $o->isStructural($value))))
<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').']' }}" readonly="true">
<div class="invalid-feedback pb-2">
@if($e)
{{ join('|',$e) }}
@endif
<br>
@endif
@endforeach
</div>
@include('components.attribute.widget.options')
</div>
</div>
</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
<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 -->
<div class="row pt-2">
<div class="col-1"></div>
<div class="col-10 p-2">
<div id="{{ $o->name_lc }}">
@foreach ($o->values as $value)
@if ($edit)
<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">
<!-- $o=Password::class -->
<x-attribute.layout :edit="$edit" :new="$new" :o="$o">
@foreach ($o->values as $value)
@if ($edit)
<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">
@if($e)
{{ join('|',$e) }}
@endif
</div>
</div>
@else
{{ $value }}<br>
@endif
@endforeach
</div>
<div class="invalid-feedback pb-2">
@if($e)
{{ join('|',$e) }}
@endif
</div>
</div>
@else
{{ $value }}<br>
@endif
@endforeach
@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>
</div>
</div>
<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>
</x-attribute.layout>