Added disabled to components, new components, button and modal
This commit is contained in:
parent
f393813311
commit
4a4cf3c5bf
9
resources/components/button/error.blade.php
Normal file
9
resources/components/button/error.blade.php
Normal file
@ -0,0 +1,9 @@
|
||||
@if(isset($row) && $row)
|
||||
<div class="row pt-2 pb-2">
|
||||
<div class="col">
|
||||
@endif
|
||||
@error($name)<button {{ $attributes->class(['btn','btn-sm','btn-danger']) }}>{{ $message }}</button>@enderror
|
||||
@if(isset($row) && $row)
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
@ -1 +1,9 @@
|
||||
@session('success')<button {{ $attributes->class(['btn','btn-sm','btn-success']) }}>{{ $value }}</button>@endsession
|
||||
@if(isset($row) && $row)
|
||||
<div class="row pt-2 pb-2">
|
||||
<div class="col">
|
||||
@endif
|
||||
@session('success')<button {{ $attributes->class(['btn','btn-sm','btn-success']) }}>{{ $value }}</button>@endsession
|
||||
@if(isset($row) && $row)
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
@ -1,5 +1,5 @@
|
||||
@if(isset($label))
|
||||
<label for="{{ $id ?? $name }}">{{ $label }}</label>
|
||||
<label {{ $attributes->only(['class']) }} for="{{ $id ?? $name }}">{{ $label }}</label>
|
||||
@endisset
|
||||
<div class="form-group">
|
||||
<div class="input-group has-validation">
|
||||
|
5
resources/components/form/checkbox.blade.php
Normal file
5
resources/components/form/checkbox.blade.php
Normal file
@ -0,0 +1,5 @@
|
||||
<x-leenooks::form.base {{ $attributes }}>
|
||||
<div class="form-check text-right">
|
||||
<input type="checkbox" class="form-check-input {{ $class ?? ''}}@error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($old ?? $name,$value ?? '') }}" @checked(isset($checked)) @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
|
||||
</div>
|
||||
</x-leenooks::form.base>
|
@ -1,3 +1,3 @@
|
||||
<x-leenooks::form.base {{ $attributes }}>
|
||||
<input type="date" class="form-control {{ $classes ?? ''}}@error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($old ?? $name,$value ?? '') }}" @readonly(isset($readonly)) @required(isset($required))>
|
||||
<input type="date" class="form-control {{ $classes ?? ''}}@error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($old ?? $name,$value ?? '') }}" @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
|
||||
</x-leenooks::form.base>
|
@ -1,3 +1,3 @@
|
||||
<x-leenooks::form.base {{ $attributes }}>
|
||||
<input type="email" class="form-control {{ $classes ?? ''}}@error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($old ?? $name,$value ?? '') }}" @readonly(isset($readonly)) @required(isset($required))>
|
||||
<input type="email" class="form-control {{ $classes ?? ''}}@error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($old ?? $name,$value ?? '') }}" @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
|
||||
</x-leenooks::form.base>
|
@ -1,5 +1,5 @@
|
||||
<x-leenooks::form.base {{ $attributes }}>
|
||||
<input type="file" class="form-control {{ $classes ?? ''}}@error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @readonly(isset($readonly)) @required(isset($required))>
|
||||
<input type="file" class="form-control {{ $classes ?? ''}}@error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
|
||||
</x-leenooks::form.base>
|
||||
{{ $slot }}
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
<x-leenooks::form.base {{ $attributes }}>
|
||||
<input type="password" class="form-control {{ $classes ?? ''}}@error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($old ?? $name,$value ?? '') }}" @readonly(isset($readonly)) @required(isset($required))>
|
||||
<input type="password" class="form-control {{ $classes ?? ''}}@error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($old ?? $name,$value ?? '') }}" @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
|
||||
</x-leenooks::form.base>
|
@ -1,6 +1,6 @@
|
||||
<x-leenooks::form.base {{ $attributes }}>
|
||||
<input type="hidden" id="{{ $name }}_disabled" name="{{ $name }}" value="" disabled>
|
||||
<select class="form-control @error($old ?? $name) is-invalid @enderror" id="{{ $id }}" name="{{ $name }}">
|
||||
<select class="form-control @error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @required(isset($required)) @disabled(isset($disabled))>
|
||||
@if(isset($addvalues) && $addvalues)
|
||||
<option id="new"></option>
|
||||
@endif
|
||||
@ -29,7 +29,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
// Select doesnt support read only so we'll use disable and a new field
|
||||
function {{$id}}_readonly(on) {
|
||||
function {{$id ?? $name}}_readonly(on) {
|
||||
if (on) {
|
||||
$('#{{ $name }}').prop('disabled',true);
|
||||
$('#{{ $name }}_disabled').prop('disabled',false).val($('#{{ $name }}').val());
|
||||
@ -41,7 +41,7 @@
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#{{ $id }}').select2({
|
||||
$('#{{ $id ?? $name }}').select2({
|
||||
dropdownAutoWidth: true,
|
||||
width: 'style',
|
||||
@isset($addvalues)
|
||||
|
@ -1,3 +1,3 @@
|
||||
<x-leenooks::form.base {{ $attributes }}>
|
||||
<input type="text" class="form-control {{ $classes ?? ''}}@error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($old ?? $name,$value ?? '') }}" @readonly(isset($readonly)) @required(isset($required))>
|
||||
<input type="text" class="form-control {{ $class ?? ''}}@error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($old ?? $name,$value ?? '') }}" @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
|
||||
</x-leenooks::form.base>
|
@ -1,3 +1,3 @@
|
||||
<x-leenooks::form.base {{ $attributes }}>
|
||||
<textarea class="form-control {{ $classes ?? ''}} @error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @isset($placeholder)placeholder="{{ $placeholder }}"@endisset>{{ old($old ?? $name,$value ?? '') }}</textarea>
|
||||
<textarea class="form-control {{ $classes ?? ''}} @error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @isset($placeholder)placeholder="{{ $placeholder }}"@endisset @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>{{ old($old ?? $name,$value ?? '') }}</textarea>
|
||||
</x-leenooks::form.base>
|
@ -1,7 +1,7 @@
|
||||
<div class="form-group">
|
||||
<div class="input-group has-validation">
|
||||
<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
|
||||
<input type="checkbox" class="custom-control-input @error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @checked(old($old ?? $name,$value ?? ''))>
|
||||
<input type="checkbox" class="custom-control-input @error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @checked(old($old ?? $name,$value ?? '')) @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
|
||||
@if(isset($label))
|
||||
<label class="custom-control-label" for="{{ $id ?? $name }}">{{ $label }}</label>
|
||||
@endif
|
||||
|
35
resources/components/modal/delete.blade.php
Normal file
35
resources/components/modal/delete.blade.php
Normal file
@ -0,0 +1,35 @@
|
||||
<div class="modal fade" id="confirm_delete" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header bg-danger">
|
||||
<h5 class="modal-title">WARNING: DELETING record</h5>
|
||||
<button type="button" class="btn-close" data-dismiss="modal" aria-label="Close">X</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>This action is irreversible. Are you sure, your sure, that you want to delete it?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<a type="button" class="btn btn-danger btn-ok">Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section('page-scripts')
|
||||
<script type="text/javascript">
|
||||
var confirm_delete = new bootstrap.Modal(document.getElementById('confirm_delete'), {});
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.{{$trigger}}').click(function(e) {
|
||||
confirm_delete.show();
|
||||
console.log($('#confirm_delete')
|
||||
.find('.btn-ok'));
|
||||
$('#confirm_delete')
|
||||
.find('.btn-ok')
|
||||
.attr('href',e.currentTarget.href);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@append
|
Loading…
Reference in New Issue
Block a user