Compare commits

..

No commits in common. "master" and "9.0.4" have entirely different histories.

56 changed files with 323 additions and 1331 deletions

View File

@ -1,15 +1,18 @@
{ {
"name": "leenooks/laravel", "name": "leenooks/laravel",
"description": "Leenooks standard templates and tools.", "description": "Leenooks standard templates and tools.",
"keywords": ["laravel","leenooks"], "keywords": ["laravel", "leenooks"],
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
"name": "Deon George", "name": "Deon George",
"email": "deon@dege.au" "email": "deon@leenooks.net"
} }
], ],
"require": { "require": {
"igaster/laravel-theme": "^2.0.17",
"creativeorange/gravatar": "^1.0",
"orchestra/asset": "^6.0"
}, },
"require-dev": { "require-dev": {
}, },
@ -24,8 +27,7 @@
"extra": { "extra": {
"laravel": { "laravel": {
"providers": [ "providers": [
"Leenooks\\Providers\\LeenooksServiceProvider", "Leenooks\\Providers\\LeenooksServiceProvider"
"Leenooks\\Providers\\CustomBladeServiceProvider"
] ]
} }
}, },

View File

@ -1,11 +0,0 @@
<button type="cancel" id="cancel" {{ $attributes->class(['mt-4','btn','btn-sm','btn-danger']) }}>Cancel</button>
@section('page-scripts')
<script type="text/javascript">
$(document).ready(function() {
$('#cancel').on('click',function(item) {
return history.back();
});
});
</script>
@append

View File

@ -1,9 +0,0 @@
@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

View File

@ -1 +0,0 @@
<button type="reset" id="reset" {{ $attributes->class(['mt-4','btn','btn-sm','btn-secondary']) }}>Reset</button>

View File

@ -1 +0,0 @@
<button type="submit" id="submit" {{ $attributes->class(['mt-4','btn','btn-sm','btn-success']) }} @disabled(isset($disabled))>{{ $slot }}</button>

View File

@ -1,9 +0,0 @@
@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

View File

@ -1,11 +0,0 @@
@if ($errors->any())
<div class="alert alert-danger alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<h5><i class="icon fas fa-ban"></i> Whoops!</h5>
<ul>
@foreach ($errors->all() as $error)
<li>{!! $error !!}</li>
@endforeach
</ul>
</div>
@endif

View File

@ -1,23 +0,0 @@
<div class="form-group">
@if(isset($label))
<label {{ $attributes->only(['class']) }} for="{{ $id ?? $name }}">{{ $label }}</label>
@endisset
<div class="input-group has-validation">
@if(isset($icon) || isset($prepend))
<div class="input-group-prepend">
<span class="input-group-text">@isset($icon)<i class="fas fa-fw {{ $icon }}"></i>@endisset @isset($prepend){!! $prepend !!}@endisset</span>
</div>
@endif
{{ $slot }}
<span class="invalid-feedback">
@error((! empty($old)) ? $old : $name)
{{ $message }}
@elseif(isset($feedback))
{{ $feedback }}
@enderror
</span>
</div>
@isset($helper)
<span class="input-helper">{{ $helper }}</span>
@endif
</div>

View File

@ -1,5 +0,0 @@
<x-leenooks::form.base {{ $attributes }}>
<div class="form-check text-right">
<input type="checkbox" class="form-check-input {{ $class ?? ''}}@error((! empty($old)) ? $old : $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($old ?? $name,$value ?? '') }}" @checked(old($old ?? $name)) @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
</div>
</x-leenooks::form.base>

View File

@ -1,3 +0,0 @@
<x-leenooks::form.base {{ $attributes }}>
<input type="date" class="form-control {{ $class ?? ''}}@error((! empty($old)) ? $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>

View File

@ -1,3 +0,0 @@
<x-leenooks::form.base {{ $attributes }}>
<input type="email" class="form-control {{ $class ?? ''}}@error((! empty($old)) ? $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>

View File

@ -1,17 +0,0 @@
<x-leenooks::form.base {{ $attributes }}>
<input type="file" class="form-control {{ $class ?? ''}}@error((! empty($old)) ? $old : $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
</x-leenooks::form.base>
{{ $slot }}
@section('page-scripts')
<script>
$(document).ready(function() {
$('#{{ $id ?? $name }}').on('change',function(){
//get the file name
var fileName = $(this).val();
//replace the "Choose a file" label
$(this).parent().next('.input-helper').html(fileName);
})
});
</script>
@append

View File

@ -1,3 +0,0 @@
<x-leenooks::form.base {{ $attributes }}>
<input type="number" class="form-control {{ $class ?? ''}}@error((! empty($old)) ? $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>

View File

@ -1,3 +0,0 @@
<x-leenooks::form.base {{ $attributes }}>
<input type="password" class="form-control {{ $class ?? ''}}@error((! empty($old)) ? $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>

View File

@ -1,60 +0,0 @@
<x-leenooks::form.base {{ $attributes }}>
<input type="hidden" id="{{ $name }}_disabled" name="{{ $name }}" value="" disabled>
<select class="form-control @error((! empty($old)) ? $old : $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @required(isset($required)) @disabled(isset($disabled))>
@if(empty($value) || isset($addnew) || isset($choose))
<option value=""></option>
@isset($addnew)
<option value="new">{{ $addnew ?: 'Add New' }}</option>
@endisset
@endif
@isset($options)
@empty($groupby)
@foreach($options as $option)
@continue(! Arr::get($option,'value'))
<option value="{{ Arr::get($option,'id') }}" @selected(Arr::get($option,'id') == old($old ?? $name,$value ?? ''))>{{ Arr::get($option,'value') }}</option>
@endforeach
@else
@foreach($options->groupBy($groupby) as $group)
<optgroup label="{{ $groupby == 'active' ? (Arr::get($group->first(),$groupby) ? 'Active' : 'Not Active') : Arr::get($group->first(),$groupby) }}">
@foreach($group as $option)
@continue(! Arr::get($option,'value'))
<option value="{{ Arr::get($option,'id') }}" @selected(Arr::get($option,'id') == old($old ?? $name,$value ?? ''))>{{ Arr::get($option,'value') }}</option>
@endforeach
</optgroup>
@endforeach
@endempty
@endisset
</select>
</x-leenooks::form.base>
@pa(select2)
@section('page-scripts')
<script type="text/javascript">
// Select doesnt support read only so we'll use disable and a new field
function {{$id ?? $name}}_readonly(on) {
if (on) {
$('#{{ $name }}').prop('disabled',true);
$('#{{ $name }}_disabled').prop('disabled',false).val($('#{{ $name }}').val());
} else {
$('#{{ $name }}').prop('disabled',false);
$('#{{ $name }}_disabled').prop('disabled',true);
}
}
$(document).ready(function() {
$('#{{ $id ?? $name }}').select2({
dropdownAutoWidth: true,
width: 'style',
@isset($addvalues)
tags: true,
placeholder: '',
allowClear: true,
@endisset
});
});
</script>
@append

View File

@ -1,3 +0,0 @@
<x-leenooks::form.base {{ $attributes }}>
<input type="text" class="form-control {{ $class ?? ''}}@error((! empty($old)) ? $old : $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" placeholder="{{ $placeholder ?? '' }}" value="{{ old($old ?? $name,$value ?? '') }}" @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
</x-leenooks::form.base>

View File

@ -1,43 +0,0 @@
<div class="form-group">
@if(isset($label))
<label {{ $attributes->only(['class']) }} for="{{ $id ?? $name }}">{{ $label }}</label>
@endisset
<div class="input-group has-validation">
@if(isset($icon) || isset($prepend))
<div class="input-group-prepend">
<span class="input-group-text">@isset($icon)<i class="fas fa-fw {{ $icon }}"></i>@endisset @isset($prepend){!! $prepend !!}@endisset</span>
</div>
@endif
<div class="w-100">
<textarea class="form-control {{ $class ?? ''}} @error((! empty($old)) ? $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>
<span class="invalid-feedback">
@error($old ?? $name)
{{ $message }}
@elseif(isset($feedback))
{{ $feedback }}
@enderror
</span>
</div>
</div>
@isset($helper)
<span class="input-helper">{{ $helper }}</span>
@endif
</div>
@pa(simplemde)
@section('page-scripts')
<script type="text/javascript">
$(document).ready(function() {
new SimpleMDE({
element: $('#{{ $id ?? $name }}')[0],
forceSync: true
});
@error($old ?? $name)
$('div.CodeMirror-wrap').addClass('form-control is-invalid');
@enderror
});
</script>
@append

View File

@ -1,3 +0,0 @@
<x-leenooks::form.base {{ $attributes }}>
<input type="time" class="form-control {{ $class ?? ''}}@error((! empty($old)) ? $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>

View File

@ -1,17 +0,0 @@
<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((! empty($old)) ? $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
</div>
<span class="invalid-feedback">
@error($name)
{{ $message }}
@elseif(isset($feedback))
{{ $feedback }}
@enderror
</span>
</div>
</div>

View File

@ -1,59 +0,0 @@
<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" data-hide="{{ $hide }}">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();
$('#confirm_delete')
.find('.btn-ok')
.attr('href',$(this).attr('href'))
.attr('data-id',$(this).data('id'));
return false;
});
$('.btn-ok').click(function(item) {
var that = $(this);
// Delete
$.ajax({
url: that.attr('href'),
method: 'POST',
dataType: 'json',
}).done(function(data) {
if (that.data('hide') == 'row')
$('a[data-id="'+that.data('id')+'"].{{$trigger}}').closest('tr').hide();
}).fail(function() {
alert('Hmm, that didnt work?');
});
// Clear the data cache
that.removeData();
confirm_delete.hide();
return false;
})
});
</script>
@append

View File

@ -45,14 +45,14 @@
<p class="login-box-msg">{{ trans('adminlte_lang::message.siginsession') }}</p> <p class="login-box-msg">{{ trans('adminlte_lang::message.siginsession') }}</p>
<form method="post"> <form method="post">
@csrf {{ csrf_field() }}
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="input-group mb-3"> <div class="input-group mb-3">
<input type="email" name="email" class="form-control" placeholder="Email"> <input type="email" name="email" class="form-control" placeholder="Email">
<div class="input-group-append"> <div class="input-group-append">
<span class="input-group-text"><i class="fas fa-fw fa-envelope"></i></span> <span class="input-group-text"><i class="fas fa-envelope fa-fw"></i></span>
</div> </div>
</div> </div>
</div> </div>
@ -61,7 +61,7 @@
<div class="input-group mb-3"> <div class="input-group mb-3">
<input type="password" name="password" class="form-control" placeholder="Password"> <input type="password" name="password" class="form-control" placeholder="Password">
<div class="input-group-append"> <div class="input-group-append">
<span class="input-group-text"><i class="fas fa-fw fa-key"></i></span> <span class="input-group-text"><i class="fas fa-key fa-fw"></i></span>
</div> </div>
</div> </div>
</div> </div>
@ -76,20 +76,11 @@
</div> </div>
</div> </div>
<!-- /.col -->
<div class="col-4"> <div class="col-4">
<div class="row"> <button type="submit" name="submit" class="btn btn-primary mr-0 float-right">Sign In</button>
<div class="col-12">
<button type="submit" name="submit" class="btn btn-sm btn-primary float-right">Sign In</button>
</div> </div>
</div> <!-- /.col -->
<div class="row">
<div class="col-12 pt-2">
<button type="button" id="passkey" class="btn btn-sm btn-primary float-right"><i class="bi bi-key"></i> Passkey</button>
</div>
</div>
</div>
</div> </div>
</form> </form>
@ -112,17 +103,3 @@
</div> </div>
<!-- /.login-box --> <!-- /.login-box -->
@endsection @endsection
@section('page-scripts')
<!-- Passkeys -->
<script type='text/javascript' src='{{ asset('/passkey/passkey.js') }}'></script>
<script type="text/javascript">
$(document).ready(function() {
$('#passkey').on('click',function() {
passkey_check('{{ csrf_token() }}','{{ redirect()->intended("/passkey/loggedin")->getTargetUrl() }}');
return false;
});
});
</script>
@append

View File

@ -35,15 +35,13 @@
<p class="login-box-msg">You forgot your password? Here you can easily retrieve a new password.</p> <p class="login-box-msg">You forgot your password? Here you can easily retrieve a new password.</p>
<form method="post" action="{{ url('password/email') }}"> <form method="post" action="{{ url('password/email') }}">
@csrf {{ csrf_field() }}
<div class="input-group mb-3"> <div class="input-group mb-3">
<input type="email" name="email" class="form-control" placeholder="Email" required> <input type="email" name="email" class="form-control" placeholder="Email" required>
<div class="input-group-append"> <div class="input-group-append">
<span class="input-group-text"><i class="fas fa-fw fa-envelope"></i></span> <span class="fas fa-envelope input-group-text"></span>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<button type="submit" class="btn btn-primary btn-block">{{ trans('adminlte_lang::message.sendpassword') }}</button> <button type="submit" class="btn btn-primary btn-block">{{ trans('adminlte_lang::message.sendpassword') }}</button>

View File

@ -27,36 +27,32 @@
<p class="login-box-msg">You are only one step a way from your new password, set your new password now.</p> <p class="login-box-msg">You are only one step a way from your new password, set your new password now.</p>
<form method="post" action="{{ url('password/reset') }}"> <form method="post" action="{{ url('password/reset') }}">
<input type="hidden" name="token" value="{{ $token }}"> {{ csrf_field() }}
@csrf
<div class="input-group mb-3"> <div class="input-group mb-3">
<input type="email" name="email" class="form-control" placeholder="Email" required> <input type="email" name="email" class="form-control" placeholder="Email" required>
<div class="input-group-append"> <div class="input-group-append">
<span class="input-group-text"><i class="fas fa-fw fa-envelope"></i></span> <span class="fas fa-envelope fa-fw input-group-text"></span>
</div> </div>
</div> </div>
<div class="input-group mb-3"> <div class="input-group mb-3">
<input type="password" name="password" class="form-control" placeholder="Password" required> <input type="password" name="password" class="form-control" placeholder="Password" required>
<div class="input-group-append"> <div class="input-group-append">
<span class="input-group-text"><i class="fas fa-fw fa-lock"></i></span> <span class="fas fa-lock input-group-text"></span>
</div> </div>
</div> </div>
<div class="input-group mb-3"> <div class="input-group mb-3">
<input type="password" name="password_confirmation" class="form-control" placeholder="Confirm Password" data-match="#password" required> <input type="password" name="password_confirmation" class="form-control" placeholder="Confirm Password" data-match="#password" required>
<div class="input-group-append"> <div class="input-group-append">
<span class="input-group-text"><i class="fas fa-fw fa-clone"></i></span> <span class="fas fa-lock input-group-text"></span>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<button type="submit" class="btn btn-primary btn-block">{{ trans('adminlte_lang::message.passwordreset') }}</button> <button type="submit" class="btn btn-primary btn-block">{{ trans('adminlte_lang::message.passwordreset') }}</button>
</div> </div>
<!-- /.col --> <!-- /.col -->
</div> </div>
<input type="hidden" name="token" value="{{ $token }}">
</form> </form>
<p class="mt-3 mb-1"> <p class="mt-3 mb-1">

View File

@ -38,6 +38,11 @@
@section('scripts') @section('scripts')
@include('adminlte::layouts.partials.scripts') @include('adminlte::layouts.partials.scripts')
{{-- Scripts --}}
{!! Asset::scripts() !!}
@yield('page-scripts')
@show @show
</body> </body>
</html> </html>

View File

@ -27,8 +27,6 @@
}) })
}) })
</script> </script>
@yield('page-scripts')
@show @show
</body> </body>
</html> </html>

View File

@ -6,19 +6,16 @@
<!-- CSRF Token --> <!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}"> <meta name="csrf-token" content="{{ csrf_token() }}">
{{-- <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<!-- Included in adminlte -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
--}}
<!-- Font Awesome Icons --> <!-- Font Awesome Icons -->
<link rel="stylesheet" href="//use.fontawesome.com/releases/v5.15.4/css/all.css"> <link rel="stylesheet" href="//use.fontawesome.com/releases/v5.15.3/css/all.css">
{{-- {{--
<link rel="stylesheet" href="//use.fontawesome.com/releases/v5.15.4/css/v4-shims.css"> <link rel="stylesheet" href="//use.fontawesome.com/releases/v5.15.3/css/v4-shims.css">
--}} --}}
<!-- Theme style --> <!-- Theme style -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/admin-lte@3.2.0/dist/css/adminlte.min.css"> <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/admin-lte@3.1.0/dist/css/adminlte.min.css">
<!-- Google Font: Source Sans Pro --> <!-- Google Font: Source Sans Pro -->
<link href="https://fonts.googleapis.com/css2?family={{ str_replace(' ','+',config('app.font') ?: 'IBM Plex Sans') }}:wght@300&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family={{ str_replace(' ','+',config('app.font') ?: 'IBM Plex Sans') }}:wght@300&display=swap" rel="stylesheet">
@ -41,8 +38,8 @@
<![endif]--> <![endif]-->
--}} --}}
<!-- Page Styles --> <!-- STYLESHEETS -->
{!! PageAssets::css() !!} {!! Asset::styles() !!}
@yield('page-styles') @yield('page-styles')

View File

@ -46,7 +46,7 @@
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@if ($user->switched) @if ($user->switched)
<a href="{{ url('/admin/switch/stop') }}" class="dropdown-item"> <a href="{{ url('/admin/switch/stop') }}" class="dropdown-item" id="switch">
<i class="fas fa-sign-out-alt mr-2"></i> {{ trans('adminlte_lang::message.switchoff') }} <i class="fas fa-sign-out-alt mr-2"></i> {{ trans('adminlte_lang::message.switchoff') }}
</a> </a>
@else @else
@ -83,7 +83,7 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$('input[name=q]').typeahead({ $("input[name=q]").typeahead({
autoSelect: false, autoSelect: false,
scrollHeight: 10, scrollHeight: 10,
theme: 'bootstrap4', theme: 'bootstrap4',
@ -149,11 +149,6 @@
$('span[name=searching]').addClass("d-none"); $('span[name=searching]').addClass("d-none");
} }
} }
},
statusCode: {
401: function() {
window.parent.location.href = '{{ route('login') }}';
}
} }
}) })
}, 500); }, 500);

View File

@ -2,9 +2,9 @@
<!-- Bootstrap & Jquery App --> <!-- Bootstrap & Jquery App -->
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous"></script> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js" integrity="sha512-WFN04846sdKMIP5LKNphMaWzU7YpMyCU245etK3g/2ARYbPK9Ub18eG+ljU96qKRCWh+quCY7yefSmlkQw1ANQ==" crossorigin="anonymous"></script> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js" integrity="sha512-WFN04846sdKMIP5LKNphMaWzU7YpMyCU245etK3g/2ARYbPK9Ub18eG+ljU96qKRCWh+quCY7yefSmlkQw1ANQ==" crossorigin="anonymous"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-fQybjgWLrvvRgtW6bFlB7jaZrFsaBXjsOMm/tB9LTS58ONXgqbR9W8oWht/amnpF" crossorigin="anonymous"></script> <script type="text/javascript" src="//cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfGII0yAns" crossorigin="anonymous"></script>
<!-- AdminLTE --> <!-- AdminLTE -->
<script type="text/javascript" src="//cdn.jsdelivr.net/npm/admin-lte@3.2.0/dist/js/adminlte.min.js"></script> <script type="text/javascript" src="//cdn.jsdelivr.net/npm/admin-lte@3.1.0/dist/js/adminlte.min.js"></script>
<!-- Additional Utilities --> <!-- Additional Utilities -->
<script src="{{ asset('plugin/bootstrap3-typeahead/js/bootstrap3-typeahead.min.js') }}"></script> <script src="{{ asset('plugin/bootstrap3-typeahead/js/bootstrap3-typeahead.min.js') }}"></script>
@ -44,7 +44,7 @@
$.AdminLTESidebarTweak.Open = state; $.AdminLTESidebarTweak.Open = state;
if (addclass !== 'undefined') if (addclass !== 'undefined')
$('body') $("body")
.addClass(state ? 'sidebar-open' : 'sidebar-collapse'); .addClass(state ? 'sidebar-open' : 'sidebar-collapse');
$(this).delay($.AdminLTESidebarTweak.ResizeDelay).queue(function() { $(this).delay($.AdminLTESidebarTweak.ResizeDelay).queue(function() {
@ -56,7 +56,7 @@
$(function () { $(function () {
"use strict"; "use strict";
$('body').on('collapsed.lte.pushmenu', function(){ $("body").on("collapsed.lte.pushmenu", function(){
if($.AdminLTESidebarTweak.options.EnableRemember) { if($.AdminLTESidebarTweak.options.EnableRemember) {
document.cookie = "toggleState=closed;path=/"; document.cookie = "toggleState=closed;path=/";
@ -64,7 +64,7 @@
} }
}); });
$('body').on('shown.lte.pushmenu', function(){ $("body").on("shown.lte.pushmenu", function(){
if($.AdminLTESidebarTweak.options.EnableRemember){ if($.AdminLTESidebarTweak.options.EnableRemember){
document.cookie = "toggleState=opened;path=/"; document.cookie = "toggleState=opened;path=/";
@ -89,23 +89,6 @@
}); });
</script> </script>
<script type="text/javascript">
$(document).ready(function() {
$('body')
.addClass('sidebar-collapse')
.delay(500)
.queue(function () {
window.dispatchEvent(new Event('resize'));
$(this).dequeue();
});
});
</script>
<!-- Page Scripts -->
{!! PageAssets::js() !!}
@yield('page-scripts')
@if(file_exists('js/custom.js')) @if(file_exists('js/custom.js'))
<!-- Any Custom JS --> <!-- Any Custom JS -->
<script src="{{ asset('js/custom.js') }}"></script> <script src="{{ asset('js/custom.js') }}"></script>

View File

@ -2,7 +2,7 @@
<aside class="main-sidebar sidebar-dark-primary elevation-4 d-print-none"> <aside class="main-sidebar sidebar-dark-primary elevation-4 d-print-none">
<!-- Brand Logo --> <!-- Brand Logo -->
<a href="{{ url('home') }}" class="brand-link"> <a href="{{ url('home') }}" class="brand-link">
<img src="{{ asset('img/logo.png') }}" alt="Logo" style="margin-left: 0; padding: 5px;" class="brand-image"> <img src="{{ asset('img/logo.png') }}" alt="Logo" class="brand-image img-circle elevation-3" style="opacity: .8">
<span class="brand-text font-weight-light">{!! config('app.name_html_long','<b>App</b>Name') !!}</span> <span class="brand-text font-weight-light">{!! config('app.name_html_long','<b>App</b>Name') !!}</span>
</a> </a>
@ -12,7 +12,7 @@
<div class="user-panel mt-3 pb-3 mb-3 d-flex"> <div class="user-panel mt-3 pb-3 mb-3 d-flex">
<div class="image"> <div class="image">
@if(isset($user) AND $user->exists) @if(isset($user) AND $user->exists)
<i class="fa fa-fw fa-2x fa-user text-white"></i> <img src="{{ Gravatar::get(($user->exists AND $user->email) ? $user->email : 'nobody@example.com') }}" class="img-circle elevation-2" alt="User">
@else @else
<a name="login" href="{{ url()->current().'?login=1' }}" class="d-block"><i class="pl-1 fas fa-lock fa-2x"></i></a> <a name="login" href="{{ url()->current().'?login=1' }}" class="d-block"><i class="pl-1 fas fa-lock fa-2x"></i></a>
@endif @endif
@ -26,7 +26,7 @@
<!-- Sidebar Menu --> <!-- Sidebar Menu -->
<nav class="mt-2"> <nav class="mt-2">
<ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" data-accordion="false"> <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
<!-- Add icons to the links using the .nav-icon class with font-awesome or any other icon font library --> <!-- Add icons to the links using the .nav-icon class with font-awesome or any other icon font library -->
@include('adminlte::layouts.partials.sidebarmenu') @include('adminlte::layouts.partials.sidebarmenu')
</ul> </ul>

View File

@ -0,0 +1,23 @@
<!-- Success -->
@if(session()->has('success'))
<div class="alert alert-success alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<h5><i class="icon fas fa-check"></i> Success!</h5>
<ul>
<li>{{ session()->get('success') }}</li>
</ul>
</div>
@endif
<!-- Errors -->
@if ($errors->any())
<div class="alert alert-danger alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<h5><i class="icon fas fa-ban"></i> Whoops!</h5>
<ul>
@foreach ($errors->all() as $error)
<li>{!! $error !!}</li>
@endforeach
</ul>
</div>
@endif

View File

@ -1,114 +0,0 @@
@extends('architect::layouts.auth')
@section('htmlheader_title')
Log in
@endsection
@section('content')
<!-- /.login-logo -->
<div class="app-container app-theme-white body-tabs-shadow">
<div class="app-container">
<div class="h-100 bg-animation">
<div class="d-flex h-100 justify-content-center align-items-center">
<div class="mx-auto app-login-box col-md-8">
@if(file_exists('login-note.html'))
<div class="mx-auto card text-white card-body bg-primary w-50">
<h5 class="text-white card-title"><i class="icon fa-2x fas fa-info pr-3"></i><span class="font-size-xlg">NOTE</span></h5>
<span class="w-100 pb-0">
{!! file_get_contents('login-note.html') !!}
</span>
</div>
@endif
<div class="modal-dialog w-100 mx-auto">
<div class="modal-content">
<form class="needs-validation" novalidate method="post">
{{ csrf_field() }}
<div class="modal-body">
<div class="h5 modal-title text-center">
<h4 class="mt-2">
<div class="app-logo mx-auto mb-3"><img class="w-75" src="{{ url('img/logo-h-lg.png') }}"></div>
<small>@lang('Sign in to <strong>:server</strong>',['server'=>'Foo'])</small>
</h4>
</div>
<div class="form-row">
<div class="col-md-12 mt-3">
<label class="mb-1">Email</label>
<input name="email" id="user" placeholder="" type="email" class="form-control" required="">
<div class="invalid-feedback">
@lang('Please enter your email')
</div>
</div>
<div class="col-md-12 mt-2">
<label class="mb-1">@lang('Password')</label>
<input name="password" id="password" placeholder="" type="password" class="form-control" required>
<div class="invalid-feedback">
@lang('Please enter your password')
</div>
</div>
</div>
</div>
<div class="modal-footer">
@if (count($errors) > 0)
<div class="alert alert-danger w-100">
<strong>Whoops!</strong> Something went wrong?<br><br>
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="float-right">
<button class="btn btn-primary btn-lg">Login</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@section('page-scripts')
<style>
label {
text-transform: uppercase;
letter-spacing: 0.05em;
font-size: 85%;
font-weight: bold;
}
table.table tr:last-child {
border-bottom: 1px solid #e9ecef;
}
</style>
<script>
// Example starter JavaScript for disabling form submissions if there are invalid fields
(function () {
'use strict';
window.addEventListener('load',function () {
// Fetch all the forms we want to apply custom Bootstrap validation styles to
var forms = document.getElementsByClassName('needs-validation');
// Loop over them and prevent submission
var validation = Array.prototype.filter.call(forms, function (form) {
form.addEventListener('submit', function (event) {
if (form.checkValidity() === false) {
event.preventDefault();
event.stopPropagation();
}
form.classList.add('was-validated');
}, false);
});
}, false);
})();
</script>
@append

View File

@ -1,5 +1,5 @@
<!DOCTYPE html> <!doctype html>
<html> <html lang="en">
@section('htmlheader') @section('htmlheader')
@include('architect::layouts.partials.htmlheader') @include('architect::layouts.partials.htmlheader')
@show @show
@ -8,17 +8,16 @@
<div class="app-container app-theme-white body-tabs-shadow fixed-sidebar"> <div class="app-container app-theme-white body-tabs-shadow fixed-sidebar">
@include('architect::layouts.partials.topmenu') @include('architect::layouts.partials.topmenu')
@includeIf('architect::layouts.partials.controlsidebar') {{--
@include('architect::layouts.partials.controlsidebar')
--}}
<div class="app-main"> <div class="app-main">
@include('architect::layouts.partials.sidebarmenu') @include('architect::layouts.partials.sidebarmenu')
<div class="app-main__outer"> <div class="app-main__outer">
<div class="app-main__inner"> <div class="app-main__inner">
<div class="main-content">
@if (trim($__env->yieldContent('page_title')))
@include('architect::layouts.partials.contentheader') @include('architect::layouts.partials.contentheader')
@endif
<!-- Main content --> <!-- Main content -->
<div class="row"> <div class="row">
@ -28,7 +27,6 @@
</div> </div>
</div> </div>
</div> </div>
</div>
@include('architect::layouts.partials.contentfooter') @include('architect::layouts.partials.contentfooter')
</div> </div>
@ -38,6 +36,9 @@
@section('scripts') @section('scripts')
@include('architect::layouts.partials.scripts') @include('architect::layouts.partials.scripts')
{{-- Scripts --}}
{!! Asset::scripts() !!}
@yield('page-scripts') @yield('page-scripts')
@show @show
</body> </body>

View File

@ -1,18 +0,0 @@
<!DOCTYPE html>
<html>
@section('htmlheader')
@include('architect::layouts.partials.htmlheader')
@show
<body class="hold-transition login-page">
<div id="app">
@yield('content')
</div>
@section('scripts')
@include('architect::auth.partials.scripts')
@yield('page-scripts')
@show
</body>
</html>

View File

@ -5,7 +5,7 @@
<ul class="nav"> <ul class="nav">
{{-- {{--
<li class="nav-item"> <li class="nav-item">
<a href="javascript:void(0);" class="nav-link">Footer Link</a> <a href="javascript:void(0);" class="nav-link">Footer Link 1</a>
</li> </li>
--}} --}}
</ul> </ul>
@ -18,7 +18,7 @@
<div class="badge badge-success mr-1 ml-0"> <div class="badge badge-success mr-1 ml-0">
<small>NEW</small> <small>NEW</small>
</div> </div>
Footer Link Footer Link 4
</a> </a>
</li> </li>
--}} --}}

View File

@ -1,30 +1,26 @@
<div class="app-page-title"> <div class="app-page-title">
<div class="page-title-wrapper"> <div class="page-title-wrapper">
<div class="page-title-heading"> <div class="page-title-heading">
@if (trim($__env->yieldContent('page_icon'))) <div class="page-title-icon">
<div class="page-title-icon f32"> <i class="@yield('page_icon','pe-7s-car')"></i>
<i class="@yield('page_icon','')"></i>
</div> </div>
@endif
<div> <div>
@yield('page_title','Page Title') @yield('page_title','Page Title')
<div class="page-title-subheading"> <div class="page-title-subheading">
@yield('page_subtitle','') @yield('page_subtitle','Page Sub Title')
</div> </div>
</div> </div>
</div> </div>
@isset($page_actions)
<div class="page-title-actions"> <div class="page-title-actions">
{{-- {{--
<button type="button" data-toggle="tooltip" title="Example Tooltip" data-placement="bottom" class="btn-shadow mr-3 btn btn-dark"> <button type="button" data-toggle="tooltip" title="Example Tooltip" data-placement="bottom" class="btn-shadow mr-3 btn btn-dark">
<i class="fa fa-star"></i> <i class="fas fa-star"></i>
</button> </button>
--}} --}}
<div class="d-inline-block dropdown"> <div class="d-inline-block dropdown">
<button type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="btn-shadow dropdown-toggle btn btn-info"> <button type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="btn-shadow dropdown-toggle btn btn-info">
<span class="btn-icon-wrapper pr-2 opacity-7"> <span class="btn-icon-wrapper pr-2 opacity-7">
<i class="fa fa-business-time fa-w-20"></i> <i class="fas fa-business-time fa-w-20"></i>
</span> </span>
Item Menu Item Menu
</button> </button>
@ -44,6 +40,5 @@
</div> </div>
</div> </div>
</div> </div>
@endif
</div> </div>
</div> </div>

View File

@ -35,6 +35,9 @@
<link rel="stylesheet" href="{{ asset('/css/print.css') }}"> <link rel="stylesheet" href="{{ asset('/css/print.css') }}">
@endif @endif
<!-- STYLESHEETS -->
{!! Asset::styles() !!}
<!-- Theme style --> <!-- Theme style -->
<link rel="stylesheet" href="{{ asset('/css/architect.min.css') }}"> <link rel="stylesheet" href="{{ asset('/css/architect.min.css') }}">

View File

@ -43,7 +43,7 @@
{{-- {{--
<li class="nav-item"> <li class="nav-item">
<a href="javascript:void(0);" class="nav-link"> <a href="javascript:void(0);" class="nav-link">
<i class="nav-link-icon fas fa-database"></i> Link <i class="nav-link-icon fas fa-database"></i> Statistics
</a> </a>
</li> </li>
--}} --}}

View File

@ -38,6 +38,9 @@
@section('scripts') @section('scripts')
@include('metronic::layouts.partials.scripts') @include('metronic::layouts.partials.scripts')
{{-- Scripts --}}
{!! Asset::scripts() !!}
@yield('page-scripts') @yield('page-scripts')
@show @show
</body> </body>

View File

@ -6,9 +6,9 @@
<div class="row"> <div class="row">
<!-- BEGIN BOTTOM ABOUT BLOCK --> <!-- BEGIN BOTTOM ABOUT BLOCK -->
<div class="col-md-4 col-sm-6 pre-footer-col"> <div class="col-md-4 col-sm-6 pre-footer-col">
@isset($site->site_aboutus)) @isset($so->site_aboutus))
<h2>About us</h2> <h2>About us</h2>
<p>{!! $site->site_aboutus !!}</p> <p>{!! $so->site_aboutus !!}</p>
<!-- <!--
<div class="photo-stream"> <div class="photo-stream">
<h2>Photos Stream</h2> <h2>Photos Stream</h2>
@ -26,11 +26,11 @@
<h2 style="text-align: right;">Our Contact Details</h2> <h2 style="text-align: right;">Our Contact Details</h2>
<address class="margin-bottom-40" style="float: right;"> <address class="margin-bottom-40" style="float: right;">
<table> <table>
<tr><th style="vertical-align:top; padding-right: 5px;">Address</th><td>{!! join('<br>',$site->address) !!}</td></tr> <tr><th style="vertical-align:top; padding-right: 5px;">Address</th><td>{!! $so->address('html') !!}</td></tr>
@isset($site->site_fax) @isset($so->site_fax)
<tr><th>Fax</th><td>{{ $site->site_fax }}</tr> <tr><th>Fax</th><td>{{ $so->site_fax }}</tr>
@endif @endif
<tr><th>Email</th><td> <a href="mailto:{{ $site->site_email }}">{{ $site->site_email }}</a></tr> <tr><th>Email</th><td> <a href="mailto:{{ $so->site_email }}">{{ $so->site_email }}</a></tr>
</table> </table>
</address> </address>
<!-- <!--
@ -81,8 +81,8 @@
<!-- BEGIN SOCIAL --> <!-- BEGIN SOCIAL -->
<div class="col-md-4 col-sm-4"> <div class="col-md-4 col-sm-4">
<ul class="social-footer list-unstyled list-inline pull-right"> <ul class="social-footer list-unstyled list-inline pull-right">
@foreach ($site->social as $social) @foreach ($so->social as $social)
<li><a href="{{ $social['url'] }}"><i class="fab fa-{{ $social['name'] }}"></i></a></li> <li><a href="{{ $social['url'] }}"><i class="fa fa-{{ $social['name'] }}"></i></a></li>
@endforeach @endforeach
</ul> </ul>
</div> </div>

View File

@ -14,25 +14,28 @@
--}} --}}
<!-- Theme style --> <!-- Theme style -->
<link rel="stylesheet" href="{{ asset('theme/frontend/metronic/css/components.css') }}"> @css('css/components.css')
<link rel="stylesheet" href="{{ asset('theme/frontend/metronic/css/style.css') }}"> @css('css/style.css')
<link rel="stylesheet" href="{{ asset('theme/frontend/metronic/css/style-responsive.css') }}"> @css('css/style-responsive.css')
<link rel="stylesheet" href="{{ asset('theme/frontend/metronic/css/themes/blue.css') }}"> @css('css/themes/blue.css')
<!-- Google Font: Source Sans Pro --> <!-- Google Font: Source Sans Pro -->
<link href="//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700|PT+Sans+Narrow|Source+Sans+Pro:200,300,400,600,700,900&amp;subset=all" rel="stylesheet" type="text/css"> <link href="//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700|PT+Sans+Narrow|Source+Sans+Pro:200,300,400,600,700,900&amp;subset=all" rel="stylesheet" type="text/css">
<meta property="og:site_name" content="{{ config('app.name') }}" /> <meta property="og:site_name" content="{{ config('app.name') }}" />
<meta property="og:title" content="{{ $site->site_name }}" /> <meta property="og:title" content="{{ $so->site_name }}" />
<meta property="og:description" content="{{ $site->site_description }}" /> <meta property="og:description" content="{{ $so->site_description }}" />
<meta property="og:type" content="website" /> <meta property="og:type" content="website" />
<meta property="og:image" content="{{ $site->site_logo }}" /> <meta property="og:image" content="{{ $so->site_logo }}" />
<meta property="og:url" content="{{ url('/') }}" /> <meta property="og:url" content="{{ url('/') }}" />
<link rel="shortcut icon" href="{{ object_get($site,'favicon','favicon.ico') }}" /> <link rel="shortcut icon" href="{{ object_get($so,'favicon','favicon.ico') }}" />
<!-- Custom CSS --> <!-- Custom CSS -->
<link rel="stylesheet" href="{{ asset('theme/frontend/metronic/css/custom.css') }}"> @css('css/custom.css')
<!-- STYLESHEETS -->
{!! Asset::styles() !!}
@yield('page-styles') @yield('page-styles')
</head> </head>

View File

@ -5,8 +5,8 @@
<!-- BEGIN TOP BAR LEFT PART --> <!-- BEGIN TOP BAR LEFT PART -->
<div class="col-md-6 col-sm-6 additional-shop-info"> <div class="col-md-6 col-sm-6 additional-shop-info">
<ul class="list-unstyled list-inline"> <ul class="list-unstyled list-inline">
<li><i class="fas fa-phone mr-4"></i><span>{!! $site->site_phone !!}</span></li> <li><i class="fas fa-phone mr-4"></i><span>{!! $so->site_phone !!}</span></li>
<li><i class="fas fa-envelope mr-4"></i><span>{!! $site->site_email !!}</span></li> <li><i class="fas fa-envelope mr-4"></i><span>{!! $so->site_email !!}</span></li>
</ul> </ul>
</div> </div>
<!-- END TOP BAR LEFT PART --> <!-- END TOP BAR LEFT PART -->
@ -29,14 +29,14 @@
<!-- BEGIN HEADER --> <!-- BEGIN HEADER -->
<div class="header"> <div class="header">
<div class="container"> <div class="container">
<a class="site-logo" href="{{ url('/') }}"><img src="{{ $site->site_logo }}" alt="{{ $site->site_description }}" height="32"></a> <a class="site-logo" href="{{ url('/') }}"><img src="{{ $so->site_logo }}" alt="{{ $so->site_description }}" height="32"></a>
<a href="javascript:void(0);" class="mobi-toggler"><i class="fa fa-bars"></i></a> <a href="javascript:void(0);" class="mobi-toggler"><i class="fa fa-bars"></i></a>
<!-- BEGIN NAVIGATION --> <!-- BEGIN NAVIGATION -->
<div class="header-navigation pull-right font-transform-inherit"> <div class="header-navigation pull-right font-transform-inherit">
<ul> <ul>
{{-- @todo Replace this with a function that can traverse children with multiple depths --}} {{-- @todo Replace this with a function that can traverse children with multiple depths --}}
@foreach ($site->top_menu as $item => $menu) @foreach ($so->top_menu as $item => $menu)
<li class="dropdown {{ Request::is($menu['url']) ? 'active' : '' }}"> <li class="dropdown {{ Request::is($menu['url']) ? 'active' : '' }}">
@if (! \Illuminate\Support\Arr::get($menu,'children')) @if (! \Illuminate\Support\Arr::get($menu,'children'))

View File

@ -18,5 +18,5 @@
@if(file_exists('js/custom.js')) @if(file_exists('js/custom.js'))
<!-- Any Custom JS --> <!-- Any Custom JS -->
<script type="text/javascript" src="{{ asset('js/custom.js') }}"></script> <script src="{{ asset('js/custom.js') }}"></script>
@endif @endif

View File

@ -13,40 +13,17 @@ class Carbon extends CarbonBase
{ {
const MONTHS_PER_HALF = 6; const MONTHS_PER_HALF = 6;
public function __get(string $name): mixed public function __get($name)
{ {
switch ($name) { switch (true) {
case 'half': case $name === 'half':
return (int) ceil($this->month / static::MONTHS_PER_HALF); return (int) ceil($this->month / static::MONTHS_PER_HALF);
case 'quarter_string':
return sprintf('%dQ%d',$this->year,$this->quarter);
default: default:
return parent::__get($name); return parent::__get($name);
} }
} }
public function addHalf(): self
{
return $this->addHalves(1);
}
public function addHalves(int $unit): self
{
return $this->addQuarters(2*$unit);
}
public function subHalf(): self
{
return $this->subHalves(1);
}
public function subHalves(int $unit): self
{
return $this->subQuarters(2*$unit);
}
/** /**
* Modify to the first occurrence of a given day of the week * Modify to the first occurrence of a given day of the week
* in the current quarter. If no dayOfWeek is provided, modify to the * in the current quarter. If no dayOfWeek is provided, modify to the
@ -57,7 +34,7 @@ class Carbon extends CarbonBase
* *
* @return static * @return static
*/ */
public function startOfHalf(int $dayOfWeek=NULL) public function startOfHalf($dayOfWeek = null)
{ {
return $this->setDate($this->year, $this->half * static::MONTHS_PER_HALF - 5, 1)->firstOfMonth($dayOfWeek); return $this->setDate($this->year, $this->half * static::MONTHS_PER_HALF - 5, 1)->firstOfMonth($dayOfWeek);
} }
@ -72,7 +49,7 @@ class Carbon extends CarbonBase
* *
* @return static * @return static
*/ */
public function endOfHalf(int $dayOfWeek=NULL) public function endOfHalf($dayOfWeek = null)
{ {
return $this->setDate($this->year, $this->half * static::MONTHS_PER_HALF, 1)->lastOfMonth($dayOfWeek); return $this->setDate($this->year, $this->half * static::MONTHS_PER_HALF, 1)->lastOfMonth($dayOfWeek);
} }

View File

@ -1,30 +0,0 @@
<?php
namespace Leenooks\Casts;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
use Illuminate\Database\Eloquent\Model;
use Leenooks\Carbon;
class LeenooksCarbon implements CastsAttributes
{
/**
* Cast the given value.
*
* @param array<string, mixed> $attributes
*/
public function get(Model $model, string $key, mixed $value, array $attributes): ?Carbon
{
return $value ? Carbon::create($value) : NULL;
}
/**
* Prepare the given value for storage.
*
* @param array<string, mixed> $attributes
*/
public function set(Model $model, string $key, mixed $value, array $attributes): string|null
{
return ($value instanceof Carbon ? $value : $this->get($model,$key,$value,$attributes))?->format('Y-m-d H:i:s');
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace Leenooks\Commands;
use Illuminate\Console\Command;
use Illuminate\Console\Scheduling\Schedule;
class ScheduleList extends Command
{
protected $signature = 'schedule:list';
protected $description = 'List when scheduled commands are executed.';
/**
* @var Schedule
*/
protected $schedule;
/**
* ScheduleList constructor.
*
* @param Schedule $schedule
*/
public function __construct(Schedule $schedule)
{
parent::__construct();
$this->schedule = $schedule;
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$events = array_map(function ($event) {
return [
'cron' => $event->expression,
'command' => static::fixupCommand($event->command),
];
}, $this->schedule->events());
$this->table(
['Cron', 'Command'],
$events
);
}
/**
* If it's an artisan command, strip off the PHP
*
* @param $command
* @return string
*/
protected static function fixupCommand($command)
{
$parts = explode(' ', $command);
if (count($parts) > 2 && $parts[1] === "'artisan'") {
array_shift($parts);
}
return implode(' ', $parts);
}
}

View File

@ -0,0 +1,54 @@
<?php
namespace Leenooks\Controllers;
use Illuminate\Support\Facades\Auth;
use App\Http\Controllers\Controller;
use Redirect;
use Session;
use App\Models\User;
class AdminController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
public function switch_authorised($id)
{
return (method_exists(Auth::user(),'isAdmin') && Auth::user()->isAdmin($id)) ? TRUE : FALSE;
}
public function switch_session()
{
return ! Session::get('orig_user');
}
public function user_switch_start($id)
{
if ($this->switch_session() AND $this->switch_authorised($id))
{
$uo = User::find($id);
if (! $uo)
abort(404,'User not found');
Session::put('orig_user',Auth::id());
Auth::login($uo);
}
return Redirect::to('/home');
}
public function user_switch_stop()
{
if ($id = Session::pull('orig_user')) {
$uo = User::find($id);
Auth::login($uo);
}
return Redirect::to('/home');
}
}

View File

@ -1,61 +0,0 @@
<?php
namespace Leenooks\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use Redirect;
use Session;
use App\Models\User;
class SwitchUserController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
/**
* Determine if the user is authorised to switch to another user
*
* @param User $user
* @return bool
*/
public function switch_authorised(User $user): bool
{
return (method_exists(Auth::user(),'isAdmin') && Auth::user()->isAdmin($user)) ? TRUE : FALSE;
}
/**
* Switch to a different user
*
* @param User $user
* @return mixed
*/
public function switch_start(User $user)
{
if ($user->switched)
abort(403,'User already switched');
if ($this->switch_authorised($user)) {
Session::put('orig_user',Auth::user());
Auth::login($user);
}
return Redirect::to('/home');
}
/**
* Return back from the switch users
*
* @return mixed
*/
public function switch_stop()
{
if ($user = Session::pull('orig_user'))
Auth::login($user);
return Redirect::to('/home');
}
}

View File

@ -1,26 +0,0 @@
<?php
namespace Leenooks\Http\Middleware;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class ActiveUser
{
/**
* Handle an incoming request.
*
* @param Request $request
* @param \Closure $next
* @return mixed
*/
public function handle(Request $request,\Closure $next)
{
if ((! Auth::user()?->exists) || (! Auth::user()->active)) {
Auth::logout();
abort(403,'Your account is not active');
}
return $next($request);
}
}

View File

@ -1,213 +0,0 @@
<?php
namespace Leenooks;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
/**
* Useful tools (js/css) used when rendering pages
*/
class PageAssets
{
// Types that we can handle
private const array types = [
'css',
'js',
];
public const array assets = [
'datatables' => [
'base' => [
'css' => [
'//cdn.datatables.net/2.1.2/css/dataTables.bootstrap4.css',
//'//cdn.datatables.net/2.1.2/css/dataTables.dataTables.min.css',
],
'js' => [
'//cdn.datatables.net/2.1.2/js/dataTables.min.js',
'//cdn.datatables.net/2.1.2/js/dataTables.bootstrap4.min.js',
],
],
'buttons' => [
'css' => [
'//cdn.datatables.net/buttons/3.1.0/css/buttons.bootstrap4.min.css',
//'//cdn.datatables.net/buttons/3.1.0/css/buttons.dataTables.min.css',
],
'js' => [
'//cdn.datatables.net/buttons/3.1.0/js/dataTables.buttons.min.js',
//'//cdn.datatables.net/buttons/3.1.0/js/buttons.dataTables.min.js',
'//cdn.datatables.net/buttons/3.1.0/js/buttons.bootstrap4.min.js',
'//cdnjs.cloudflare.com/ajax/libs/jszip/3.2.0/jszip.min.js',
],
],
'conditionalpaging' => [
'js' => [
'//cdn.datatables.net/plug-ins/2.0.5/features/conditionalPaging/dataTables.conditionalPaging.min.js',
],
],
'fixedheader' => [
'css' => [
'//cdn.datatables.net/fixedheader/4.0.1/css/fixedHeader.bootstrap4.min.css',
//'//cdn.datatables.net/fixedheader/4.0.1/css/fixedHeader.dataTables.min.css',
],
'js' => [
'//cdn.datatables.net/fixedheader/4.0.1/js/dataTables.fixedHeader.min.js',
//'//cdn.datatables.net/fixedheader/4.0.1/js/fixedHeader.dataTables.min.js',
'//cdn.datatables.net/fixedheader/4.0.1/js/fixedHeader.bootstrap4.min.js',
]
],
'responsive' => [
'css' => [
'//cdn.datatables.net/responsive/3.0.2/css/responsive.bootstrap4.min.css',
//'//cdn.datatables.net/responsive/3.0.2/css/responsive.dataTables.min.css',
],
'js' => [
'//cdn.datatables.net/responsive/3.0.2/js/dataTables.responsive.min.js',
//'//cdn.datatables.net/responsive/3.0.2/js/responsive.bootstrap.min.js',
'//cdn.datatables.net/responsive/3.0.2/js/responsive.bootstrap4.min.js',
]
],
'rowgroup' => [
'css' => [
'//cdn.datatables.net/rowgroup/1.5.0/css/rowGroup.bootstrap4.min.css',
//'//cdn.datatables.net/rowgroup/1.5.0/css/rowGroup.dataTables.min.css',
],
'js' => [
'//cdn.datatables.net/rowgroup/1.5.0/js/dataTables.rowGroup.min.js',
//'//cdn.datatables.net/rowgroup/1.5.0/js/rowGroup.dataTables.min.js',
'//cdn.datatables.net/rowgroup/1.5.0/js/rowGroup.bootstrap4.min.js',
],
],
'searchpanes' => [
'css' => [
'//cdn.datatables.net/searchpanes/2.3.1/css/searchPanes.bootstrap4.min.css',
//'//cdn.datatables.net/searchpanes/2.3.1/css/searchPanes.dataTables.min.css',
],
'js' => [
'//cdn.datatables.net/searchpanes/2.3.1/js/dataTables.searchPanes.min.js',
//'//cdn.datatables.net/searchpanes/2.3.1/js/searchPanes.dataTables.min.js',
'//cdn.datatables.net/searchpanes/2.3.1/js/searchPanes.bootstrap4.min.js',
],
],
'searchpanes-left' => [
'css' => [
'/plugin/dataTables/leftSearchPanes.css',
],
],
'select' => [
'css' => [
'//cdn.datatables.net/select/2.0.3/css/select.bootstrap4.min.css',
//'//cdn.datatables.net/select/2.0.3/css/select.dataTables.min.css',
],
'js' => [
'//cdn.datatables.net/select/2.0.3/js/dataTables.select.min.js',
//'//cdn.datatables.net/select/2.0.3/js/select.dataTables.min.js',
'//cdn.datatables.net/select/2.0.3/js/select.bootstrap4.min.js',
]
],
],
'select2' => [
'base' => [
'css' => [
'//cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css',
],
'js' => [
'//cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js',
],
],
'autofocus' => [
'js' => [
'/plugin/select2/fix-autofocus.js',
],
]
],
'simplemde' => [
'base' => [
'css' => [
'//cdn.jsdelivr.net/simplemde/latest/simplemde.min.css',
],
'js' => [
'//cdn.jsdelivr.net/simplemde/latest/simplemde.min.js',
],
],
],
];
// Items to manage
public static Collection $items;
// Add an item to the list
public static function add(string $type,Collection|array|string $asset): void
{
if (! in_array($type,self::types))
throw new \Exception('Invalid type: '.$type);
if (! isset(self::$items))
self::init();
if (is_string($asset))
self::$items
->get($type)
->push($asset)
->unique();
else
self::$items->put($type,
self::$items
->get($type)
->merge($asset->values())
->unique());
}
// Add a predefined asset
public static function asset(string $id): void
{
if (! isset(self::$items))
self::init();
if (str_contains($id,',')) {
[$item,$arguments] = explode(',',$id,2);
$arguments = collect(explode('|',$arguments));
} else {
$item = $id;
$arguments = collect();
}
$arguments = $arguments->prepend('base');
$asset = collect(Arr::get(self::assets,$item))->only($arguments);
foreach (self::types as $type)
if ($x=$asset->pluck($type)->filter()->flatten())
self::add($type,$x);
}
// Render the CSS items
public static function css(): string
{
return isset(self::$items)
? self::$items
->get('css')
->map(fn($item)=>sprintf('<link rel="stylesheet" href="%s">',$item))
->join('')
: '';
}
public static function init(): void
{
self::$items = collect([
'js' => collect(),
'css' => collect(),
]);
}
// Render the JS items
public static function js(): string
{
return isset(self::$items)
? self::$items
->get('js')
->map(fn($item)=>sprintf('<script type="text/javascript" src="%s"></script>',$item))
->join('')
: '';
}
}

View File

@ -1,188 +0,0 @@
<?php
namespace Leenooks\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\ServiceProvider;
class CustomBladeServiceProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
Blade::directive('css',function(string $expression) {
return $this->resolve('css',$expression);
});
Blade::directive('js',function($expression) {
return $this->resolve('js',$expression);
});
}
private function resolve(string $content,string $expression): string
{
if (str_contains($expression,',')) {
[$type,$arguments] = explode(',',$expression,2);
$arguments = explode('|',$arguments);
} else {
$type = $expression;
$arguments = [];
}
$return = collect();
$css = collect();
$js = collect();
switch ($type) {
case 'datatables':
case 'select2':
case 'simplemde':
Log::alert(sprintf('Blade @css/@js for %s deprecicated, use @pa',$type));
break;
case 'datepick':
switch ($content) {
case 'css':
$css->put($type,'https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/css/bootstrap-datepicker.min.css');
break;
case 'js':
$js->put($type,'https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/js/bootstrap-datepicker.min.js');
}
break;
case 'debounce':
switch ($content) {
case 'js':
$js->put($type,'js/debounce.js');
}
break;
case 'highcharts':
switch ($content) {
case 'js':
// Base
$js->put($type,'https://code.highcharts.com/highcharts.js');
foreach ($arguments as $option) {
$key = $type.':'.$option;
switch ($option) {
case '3d':
$js->put($key,'https://code.highcharts.com/highcharts-3d.js');
$js->put($key.'mouseover','/plugin/highcharts/3dmouseover.js');
break;
case 'data':
$js->put($key,'https://code.highcharts.com/modules/data.js');
break;
case 'defaults':
$js->put($key,'/plugin/highcharts/defaults.js');
break;
case 'drilldown':
$js->put($key,'https://code.highcharts.com/modules/drilldown.js');
break;
case 'export':
$js->put($key,'https://code.highcharts.com/modules/exporting.js');
$js->put($key.'data','https://code.highcharts.com/modules/export-data.js');
break;
case 'funnel':
$js->put($key,'https://code.highcharts.com/modules/funnel.js');
break;
case 'heatmap':
$js->put($key,'https://code.highcharts.com/modules/heatmap.js');
break;
case 'solidguage':
$js->put($key,'https://code.highcharts.com/highcharts-more.js');
$js->put($key.'accessiblity','https://code.highcharts.com/modules/accessibility.js');
$js->put($key.'solid-guage','https://code.highcharts.com/modules/solid-gauge.js');
break;
case 'theme-dark':
$js->put($key,'https://code.highcharts.com/themes/dark-unica.js');
break;
default:
throw new \Exception(sprintf('Unknown [%s] option: [%s:%s]',$type,$content,$option));
}
}
}
break;
case 'highcharts-stock':
switch ($content) {
case 'js':
// Base
$js->put($type,'https://code.highcharts.com/stock/highstock.js');
foreach ($arguments as $option) {
$key = $type.':'.$option;
switch ($option) {
case 'data':
$js->put($key,'https://code.highcharts.com/stock/modules/data.js');
break;
case 'export':
$js->put($key,'https://code.highcharts.com/stock/modules/exporting.js');
break;
default:
throw new \Exception(sprintf('Unknown [%s] option: [%s:%s]',$type,$content,$option));
}
}
}
break;
case 'summernote':
switch ($content) {
case 'css':
// Base
$css->put($type,'https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.18/summernote-bs4.css');
break;
case 'js':
// Base
$js->put($type,'https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.18/summernote-bs4.js');
}
break;
case 'validation':
switch ($content) {
case 'js':
// Base
$js->put('validate','https://cdn.jsdelivr.net/npm/jquery-validation@1.19.3/dist/jquery.validate.min.js');
$js->put('validate.additional','https://cdn.jsdelivr.net/npm/jquery-validation@1.19.3/dist/additional-methods.min.js');
}
break;
default:
throw new \Exception(sprintf('Unknown Expression: [%s]',$expression));
}
if ($js->count())
$return = $return->merge($js->map(fn($item)=>sprintf('<script type="text/javascript" src="%s"></script>',$item)));
if ($css->count())
$return = $return->merge($css->map(fn($item)=>sprintf('<link rel="stylesheet" href="%s">',$item)));
return $return->join('');
}
}

View File

@ -2,14 +2,9 @@
namespace Leenooks\Providers; namespace Leenooks\Providers;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Support\Facades\Blade;
use Illuminate\Routing\Router;
use Illuminate\Support\Collection;
use Illuminate\Support\ServiceProvider;
use Leenooks\Http\Middleware\GuestUser; use Leenooks\Http\Middleware\GuestUser;
use Leenooks\PageAssets; use Illuminate\Routing\Router;
use Leenooks\Traits\SingleOrFail; use Illuminate\Support\ServiceProvider;
/** /**
* Class GuestUserServiceProvider. * Class GuestUserServiceProvider.
@ -18,9 +13,7 @@ use Leenooks\Traits\SingleOrFail;
*/ */
class LeenooksServiceProvider extends ServiceProvider class LeenooksServiceProvider extends ServiceProvider
{ {
use SingleOrFail; private $_path = '';
private string $_path = '';
/** /**
* Bootstrap the application services. * Bootstrap the application services.
@ -29,12 +22,6 @@ class LeenooksServiceProvider extends ServiceProvider
*/ */
public function boot(Router $router) public function boot(Router $router)
{ {
self::bootSingleOrfail();
// Custom Aliases
$loader = AliasLoader::getInstance();
$loader->alias('PageAssets',PageAssets::class);
$router->pushMiddlewareToGroup('web',GuestUser::class); $router->pushMiddlewareToGroup('web',GuestUser::class);
$this->loadViewsFrom($this->_path.'/resources/themes/adminlte/views/', 'adminlte'); $this->loadViewsFrom($this->_path.'/resources/themes/adminlte/views/', 'adminlte');
@ -44,17 +31,10 @@ class LeenooksServiceProvider extends ServiceProvider
$this->loadViewsFrom($this->_path.'/resources/themes/metronic/views/', 'metronic'); $this->loadViewsFrom($this->_path.'/resources/themes/metronic/views/', 'metronic');
//Blade::componentNamespace('Leenooks\\Components','leenooks');
Blade::anonymousComponentPath($this->_path.'/resources/components', 'leenooks');
// Add our page assets
Blade::directive('pa',function($expression) {
return sprintf('<?php PageAssets::asset(\'%s\') ?>',$expression);
});
// Enable a Collect::recursive() function // Enable a Collect::recursive() function
Collection::macro('recursive', function () { \Illuminate\Support\Collection::macro('recursive', function () {
return $this->map(function ($value) { return $this->map(function ($value) {
if (is_array($value) || is_object($value)) { if (is_array($value) || is_object($value)) {
return collect($value)->recursive(); return collect($value)->recursive();
} }

View File

@ -25,90 +25,33 @@ trait CompositeKeys {
{ {
$keys = $this->getKeyName(); $keys = $this->getKeyName();
return !is_array($keys) if (! is_array($keys)) {
? parent::setKeysForSaveQuery($query) return parent::setKeysForSaveQuery($query);
: $query->where(function($q) use($keys) {
foreach ($keys as $key){
$q->where($key,$this->getAttribute($key));
} }
});
foreach($keys as $keyName) {
$query->where($keyName, '=', $this->getKeyForSaveQuery($keyName));
}
return $query;
} }
/** /**
* Get the casts array. * Get the primary key value for a save query.
*
* @return array
*/
public function getCasts()
{
if ($this->getIncrementing())
return array_merge([$this->getKeyName() => $this->getKeyType()],$this->casts);
return $this->casts;
}
/**
* @return false
*/
public function getIncrementing()
{
return FALSE;
}
/**
* Get the value of the model's primary key.
* *
* @param mixed $keyName
* @return mixed * @return mixed
*/ */
public function getKey() protected function getKeyForSaveQuery($keyName = null)
{ {
$fields = $this->getKeyName(); if (is_null($keyName)) {
$keys = []; $keyName = $this->getKeyName();
array_map(function($key) use(&$keys) {
$keys[] = $this->getAttribute($key);
}, $fields);
return $keys;
} }
/** if (isset($this->original[$keyName])) {
* Finds model by primary keys return $this->original[$keyName];
*
* @param array $ids
* @return mixed
*/
public static function find(array $ids)
{
$modelClass = get_called_class();
$model = new $modelClass();
$keys = $model->primaryKey;
return $model->where(function($query) use($ids,$keys) {
foreach ($keys as $idx => $key) {
if (isset($ids[$idx]))
$query->where($key, $ids[$idx]);
else
$query->whereNull($key);
}
})->first();
} }
/** return $this->getAttribute($keyName);
* Find model by primary key or throws ModelNotFoundException
*
* @param array $ids
* @return mixed
*/
public static function findOrFail(array $ids)
{
$modelClass = get_called_class();
$model = new $modelClass();
$record = $model->find($ids);
if (! $record)
throw new ModelNotFoundException;
return $record;
} }
} }

View File

@ -1,15 +0,0 @@
<?php
/**
* Fix for when there is a call to pluck() for values resolved via __get()
*/
namespace Leenooks\Traits;
trait ObjectIssetFix
{
// Fix for a call to pluck('something') (which is resolved via __get()), but it returns false.
public function __isset($key)
{
return (bool)$this->{$key};
}
}

View File

@ -1,45 +0,0 @@
<?php
/**
* Extend Eloquent so that it includes singleOrFail calls to test that a query returns only 1 record
*/
namespace Leenooks\Traits;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\ModelNotFoundException;
trait SingleOrFail
{
public static function bootSingleOrfail(): void
{
// When a query should return 1 object, or FAIL if it doesnt
Builder::macro('singleOrFail',function () {
$result = $this->get();
if (($x=$result->count()) == 1)
return $result->first();
throw new ModelNotFoundException(sprintf('Query brings back %d record(s) called for singleOrFail()',$x));
});
// When a query should return 1 object, or NULL if it doesnt
Builder::macro('single',function () {
$result = $this->get();
if ($result->count() == 1)
return $result->first();
return NULL;
});
// When a query should return 1 object, or setup to create a new object
Builder::macro('singleOrNew',function (array $args=[]) {
$result = $this->where($args)->get();
if ($result->count() == 1)
return $result->first();
return $this->newModelInstance($args);
});
}
}

View File

@ -7,27 +7,14 @@ namespace Leenooks\Traits;
use Session; use Session;
use App\Models\User;
trait UserSwitch trait UserSwitch
{ {
/**
* Return if this is a switched user
*
* @return mixed
*/
public function getSwitchedAttribute() public function getSwitchedAttribute()
{ {
return Session::get('orig_user'); return Session::get('orig_user');
} }
/** public function isAdmin($id)
* If the user record has an admin attribute, we'll return that
*
* @param User|null $user
* @return false|mixed
*/
public function isAdmin(User $user=NULL)
{ {
return isset($this->admin) ? $this->admin : FALSE; return isset($this->admin) ? $this->admin : FALSE;
} }