enhance components, add mailtemplate, add traits for translations, for stats

This commit is contained in:
Ludovic CANDELLIER
2023-02-13 22:52:39 +01:00
parent 7449229ff7
commit 685160ddf5
32 changed files with 891 additions and 277 deletions

View File

@@ -1,8 +1,19 @@
@include('load.form.datepicker')
@if (($readonly ?? false) || ($disabled ?? false))
@include('components.form.input')
@else
@include('components.form.label')
<div class="input-group date" data-target-input="nearest">
@include('components.form.input', [
'type' => 'text',
'class' => $class ?? ' datepicker',
'meta' => 'data-target="#' . ($id_name ?? str_slug($name, '-')) . '"',
'placeholder' => $placeholder ?? App\Repositories\Core\DateTime::getLocaleFormatDate(),
'label' => false,
])
<div class="input-group-append" data-target="#{{ $id_name ?? str_slug($name, '-') }}" data-toggle="datetimepicker">
<div class="input-group-text"><i class="fa fa-calendar"></i></div>
</div>
</div>
@endif
<div class="input-group date" data-target-input="nearest">
@include('components.form.input', ['class' => 'datepicker', 'meta' => 'data-target="#'.str_slug($name).'"', 'placeholder' => App\Repositories\Core\DateTime::getLocaleFormatDate() ])
<div class="input-group-append" data-target="#{{ str_slug($name) }}" data-toggle="datetimepicker">
<div class="input-group-text"><i class="fa fa-calendar"></i></div>
</div>
</div>
@include('load.form.datepicker')

View File

@@ -0,0 +1,11 @@
@include('load.form.daterangepicker')
<div class="input-group date {{ $classGroup ?? '' }}" data-target-input="nearest">
@include('components.form.input', [
'class' => ($class ?? '') . ' daterangepickerItems',
'placeholder' => $placeholder ?? App\Repositories\Core\DateTime::getLocaleFormatDate(),
])
<div class="input-group-append">
<div class="input-group-text"><i class="fa fa-calendar"></i></div>
</div>
</div>

View File

@@ -1,19 +1,9 @@
<textarea
name="{{ $name }}"
@if (isset($id_name))id="{{ $id_name }}"@endif
class="editor form-control @if (isset($class)){{ $class }}@endif"
@if (isset($rows)) rows="{{ $rows }}"@endif
>@if (isset($value)){{ $value }}@endif</textarea>
@include('components.form.textarea', [
'rows' => $rows ?? 3,
'class' => 'editor ' . ($class ?? ''),
])
@if(!defined('LOAD_EDITOR'))
@if(!defined('LOAD_EDITOR'))
@include('load.form.editor')
@push('js')
<script>
$(function() {
initEditor();
});
</script>
@endpush
@endif

View File

@@ -1,13 +1,13 @@
@include('components.form.label')
<div class="input-group">
@include('components.form.input')
@include('components.form.input', ['label' => false])
<div class="input-group-append">
<button class="btn btn-outline-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-globe"></i>
</button>
<div class="dropdown-menu">
@if (is_array($translations))
@if (is_array($translations ?? false))
@foreach ($translations as $lang => $translation)
<a class="dropdown-item" href="#">{{ $lang }} : {{ $translation }}</a>
@endforeach

View File

@@ -0,0 +1,51 @@
@if(empty($name))
<code>
&lt;x-boilerplate::input>
The name attribute has not been set
</code>
@else
<div class="form-group{{ isset($groupClass) ? ' '.$groupClass : '' }}"{!! isset($groupId) ? ' id="'.$groupId.'"' : '' !!}>
@isset($label)
<label>{!! __($label) !!}</label>
@endisset
@if($prepend || $prependText || $append || $appendText)
<div class="input-group">
@endif
@if($prepend || $prependText)
<div class="input-group-prepend">
@if($prepend)
{!! $prepend !!}
@else
<span class="input-group-text">{!! $prependText !!}</span>
@endif
</div>
@endif
@if($type === 'password')
{!! Form::password($name, array_merge(['class' => 'form-control'.$errors->first($name,' is-invalid').(isset($class) ? ' '.$class : '')], $attributes)) !!}
@elseif($type === 'file')
{!! Form::file($name, array_merge(['class' => 'form-control-file'.$errors->first($name,' is-invalid').(isset($class) ? ' '.$class : '')], $attributes)) !!}
@elseif($type === 'select')
{!! Form::select($name, $options ?? [], old($name, $value ?? ''), array_merge(['class' => 'form-control'.$errors->first($name,' is-invalid').(isset($class) ? ' '.$class : '')], $attributes)) !!}
@else
{!! Form::{$type ?? 'text'}($name, old($name, $value ?? ''), array_merge(['class' => 'form-control'.$errors->first($name,' is-invalid').(isset($class) ? ' '.$class : '')], $attributes)) !!}
@endif
@if($append || $appendText)
<div class="input-group-append">
@if($append)
{!! $append !!}
@else
<span class="input-group-text">{!! $appendText !!}</span>
@endif
</div>
@endif
@if($prepend || $prependText || $append || $appendText)
</div>
@endif
@if($help ?? false)
<small class="form-text text-muted">@lang($help)</small>
@endif
@error($name)
<div class="error-bubble"><div>{{ $message }}</div></div>
@enderror
</div>
@endif

View File

@@ -1,17 +1,18 @@
@include('components.form.label')
<div class="input-group">
@include('components.form.input')
@include('components.form.input', ['label' => false])
<div class="input-group-append">
<div class="input-group-text btn btn-{{ $class ?? '' }}" role="button"><i class="fa fa-{{ $icon ?? '' }}"></i></div>
</div>
</div>
@if (isset($click))
@isset($click)
@push('js')
<script>
$('.btn-{{ $class ?? '' }}').off().click(function() {
var value = $(this).closest('.input-group').find('input').val();
console.log(value);
});
</script>
@endpush
@endif
@endisset

View File

@@ -1,12 +1,17 @@
@include('components.form.label')
<input type="number" name="{{ $name }}" id="{{ $id_name ?? str_slug($name,'-') }}" class="form-control {{ $class ?? ''}}" value="{{ $value ?? ''}}"
@if (isset($data_id))
data-id="{{ $data_id }}"
@endif
@if (isset($required))
required="required"
@endif
{{ isset($min) ? 'min="' . $min . '"' : ''}}
{{ isset($max) ? 'max="' . $max . '"' : ''}}
{{ isset($step) ? 'step="' . $step . '"' : ''}}
{{ isset($placeholder) ? 'placeholder="' . $placeholder. '"' : ''}}
>
@if ($required ?? false) required @endif
@if ($disabled ?? false) disabled @endif
@if ($readonly ?? false) readonly @endif
@if ($autofocus ?? false) autofocus @endif
@if ($size ?? false) size="{{ $size }}" @endif
@if ($autocomplete ?? false) autocomplete="{{ $autocomplete }}" @endif
@if ($min ?? false) min={{ $min }} @endif
@if ($max ?? false) max={{ $max }} @endif
@if ($step ?? false) step={{ $step }} @endif
@if ($formid ?? false) form="{{ $formid }}" @endif
@if ($mask ?? false) data-inputmask="'mask': '{{ $mask }}'" @endif
@if ($pattern ?? false) pattern="{{ $pattern }}" @endif
@if ($placeholder ?? false) placeholder="{{ $placeholder }}" @endif
{!! $meta ?? '' !!} >

View File

@@ -1,7 +1,9 @@
@include('components.form.label')
<div class="input-group">
@include('components.form.input', ['type' => 'number', 'meta' => "step = '.01'"])
@include('components.form.input', ['type' => 'number', 'step' => '.01', 'label' => false])
<div class="input-group-append">
<button class="btn bg-light" type="button" aria-haspopup="false" aria-expanded="false">
%

View File

@@ -1 +1 @@
@include('components.form.input', ['mask' => '99.99.99.99.99'])
@include('components.form.input')

View File

@@ -0,0 +1,8 @@
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-search"></i></span>
</div>
<input type="text" name="{{ $name }}" class="form-control search-btn" placeholder="{{ __('search') }}" value="">
</div>

View File

@@ -1,5 +1,7 @@
@include('components.form.label')
<div class="input-group">
@include('components.form.input', ['class' => 'url'])
@include('components.form.input', ['class' => 'url', 'label' => false])
<div class="input-group-append">
@if (isset($with_download) && $with_download)
<div class="input-group-text btn btn-web" role="button"><i class="fa {{ (isset($status) && $status) ? 'fa-check green' : 'fa-download' }}"></i></div>

View File

@@ -1,16 +1,31 @@
<select name="{{ $name }}"
@if (isset($id_name))id="{{ $id_name }}"@endif
class="form-control {{ $class ?? null }}"
@if (isset($style))style="{{ $style }}" @endif
@if (isset($meta)) {{ $meta }} @endif
@if (isset($required))required="required"@endif
@if (isset($disabled) && $disabled)disabled="disabled"@endif
@if (isset($multiple))multiple="multiple"@endif
@include('components.form.label')
@if (($disabled ?? false) || ($readonly ?? false))
@include('components.form.input', ['type' => 'hidden', 'label' => false])
@endif
<select name="{{ $name }}" class="form-control {{ $class ?? null }}"
@if ($id_name ?? false) id="{{ $id_name }}" @endif
@if ($style ?? false) style="{{ $style }}" @endif
@if ($required ?? false) required @endif
@if ($readonly ?? false) readonly @endif
@if ($disabled ?? false) disabled @endif
@if ($multiple ?? false) multiple @endif
@if ($size ?? false) size="{{ $size }}" @endif
@if ($dataId ?? false) data-id="{{ $dataId }}" @endif
{{ $meta ?? null}}
>
@if (isset($with_empty))
<option value=''>{{ $with_empty }}</option>
@isset($with_empty)
<option value="{{ $with_empty_value ?? '' }}">{{ $with_empty }}</option>
@endisset
@if ($tree ?? false)
@include('components.form.options.options-tree')
@else
@if ($multiple ?? false)
@include('components.form.options.options-multiple')
@else
@include('components.form.options')
@endif
@endif
@include('components.form.options')
</select>
</select>

View File

@@ -1 +1,16 @@
@include('components.form.select', ['class' => 'duallist', 'multiple' => true])
@if ($disabled ?? false)
@if (count($list ?? []))
<ul>
@foreach($list as $key => $item)
@if (in_array($key, $values))
<li>{{ $item }}</li>
@endif
@endforeach
</ul>
@endif
@else
@include('components.form.select', [
'class' => 'duallist',
'multiple' => true,
])
@endif

View File

@@ -0,0 +1 @@
@include('components.form.select', ['class' => 'duallist', 'tree' => true])

View File

@@ -1,13 +1 @@
<select
name="{{ $name }}"
@if (isset($id_name))id="{{ $id_name }}"@endif
class="@if (isset($class)){{ $class }} @else form-control @endif"
@if (isset($style))style="{{ $style }}" @endif
@if (isset($required))required="required"@endif
@if (isset($multiple))multiple="multiple"@endif
>
@if (isset($with_empty))
<option>{{ $with_empty }}</option>
@endif
@include('components.form.options.options-tree')
</select>
@include('components.form.select', ['tree' => true])

View File

@@ -1,6 +1,14 @@
<textarea
name="{{ $name }}"
@if (isset($id_name))id="{{ $id_name }}"@endif
@include('components.form.label')
<textarea name="{{ $name }}"
@isset($id_name)id="{{ $id_name }}"@endisset
class="form-control {{ $class ?? null }}"
@if (isset($rows)) rows="{{ $rows }}"@endif
>{{ $value ?? null }}</textarea>
@isset($rows) rows="{{ $rows }}"@endisset
@if ($style ?? false) style="{{ $style }}" @endif
@if ($disabled ?? false) disabled @endif
@if ($required ?? false) required @endif
@if ($readonly ?? false) readonly @endif
@if ($autofocus ?? false) autofocus @endif
@if ($maxlength ?? false) maxlength="{{ $maxlength }}" @endif
{{ $meta ?? null}}
>{{ $value ?? ''}}</textarea>