added date picker #681

This commit is contained in:
denisdulici
2018-12-24 11:01:00 +03:00
parent 57352840e2
commit 84db5ede76
4 changed files with 60 additions and 16 deletions

View File

@ -0,0 +1,30 @@
<?php
namespace App\Listeners\Updates;
use App\Events\UpdateFinished;
class Version135 extends Listener
{
const ALIAS = 'core';
const VERSION = '1.3.5';
/**
* Handle the event.
*
* @param $event
* @return void
*/
public function handle(UpdateFinished $event)
{
// Check if should listen
if (!$this->check($event)) {
return;
}
// Add financial year start to settings
setting(['general.financial_start' => Date::now()->startOfYear()->format('d F')]);
setting()->save();
}
}

View File

@ -28,10 +28,10 @@ class Settings extends Seeder
$company_id = $this->command->argument('company'); $company_id = $this->command->argument('company');
Setting::set([ Setting::set([
'general.date_format' => 'd M Y',
'general.financial_start' => Date::now()->startOfYear()->format('d F'), 'general.financial_start' => Date::now()->startOfYear()->format('d F'),
'general.date_separator' => 'space',
'general.timezone' => 'Europe/London', 'general.timezone' => 'Europe/London',
'general.date_format' => 'd M Y',
'general.date_separator' => 'space',
'general.percent_position' => 'after', 'general.percent_position' => 'after',
'general.invoice_number_prefix' => 'INV-', 'general.invoice_number_prefix' => 'INV-',
'general.invoice_number_digit' => '5', 'general.invoice_number_digit' => '5',

View File

@ -11,9 +11,10 @@ return [
], ],
'localisation' => [ 'localisation' => [
'tab' => 'Localisation', 'tab' => 'Localisation',
'financial_start' => 'Financial Year Start',
'timezone' => 'Time Zone',
'date' => [ 'date' => [
'format' => 'Date Format', 'format' => 'Date Format',
'financial_start' => 'Financial year start',
'separator' => 'Date Separator', 'separator' => 'Date Separator',
'dash' => 'Dash (-)', 'dash' => 'Dash (-)',
'dot' => 'Dot (.)', 'dot' => 'Dot (.)',
@ -21,7 +22,6 @@ return [
'slash' => 'Slash (/)', 'slash' => 'Slash (/)',
'space' => 'Space ( )', 'space' => 'Space ( )',
], ],
'timezone' => 'Time Zone',
'percent' => [ 'percent' => [
'title' => 'Percent (%) Position', 'title' => 'Percent (%) Position',
'before' => 'Before Number', 'before' => 'Before Number',

View File

@ -44,14 +44,15 @@
</div> </div>
<div class="tab-pane tab-margin" id="localisation"> <div class="tab-pane tab-margin" id="localisation">
{{ Form::selectGroup('date_format', trans('settings.localisation.date.format'), 'calendar', $date_formats, null, ['autocomplete' => 'off']) }}
{{ Form::textGroup('financial_start', trans('settings.localisation.date.financial_start'), 'calendar-check-o', []) }} {{ Form::textGroup('financial_start', trans('settings.localisation.financial_start'), 'calendar-check-o', ['id' => 'financial_start', 'class' => 'form-control', 'data-inputmask' => '\'alias\': \'dd MM\'', 'data-mask' => '', 'autocomplete' => 'off']) }}
{{ Form::selectGroup('date_separator', trans('settings.localisation.date.separator'), 'minus', $date_separators, null, []) }}
{{ Form::selectGroup('timezone', trans('settings.localisation.timezone'), 'globe', $timezones, null, []) }} {{ Form::selectGroup('timezone', trans('settings.localisation.timezone'), 'globe', $timezones, null, []) }}
{{ Form::selectGroup('date_format', trans('settings.localisation.date.format'), 'calendar', $date_formats, null, ['autocomplete' => 'off']) }}
{{ Form::selectGroup('date_separator', trans('settings.localisation.date.separator'), 'minus', $date_separators, null, []) }}
{{ Form::selectGroup('percent_position', trans('settings.localisation.percent.title'), 'percent', $percent_positions, null, []) }} {{ Form::selectGroup('percent_position', trans('settings.localisation.percent.title'), 'percent', $percent_positions, null, []) }}
</div> </div>
@ -155,10 +156,15 @@
@endsection @endsection
@push('js') @push('js')
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/bootstrap-datepicker.js') }}"></script>
@if (language()->getShortCode() != 'en')
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/locales/bootstrap-datepicker.' . language()->getShortCode() . '.js') }}"></script>
@endif
<script src="{{ asset('public/js/bootstrap-fancyfile.js') }}"></script> <script src="{{ asset('public/js/bootstrap-fancyfile.js') }}"></script>
@endpush @endpush
@push('css') @push('css')
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/datepicker3.css') }}">
<link rel="stylesheet" href="{{ asset('public/css/bootstrap-fancyfile.css') }}"> <link rel="stylesheet" href="{{ asset('public/css/bootstrap-fancyfile.css') }}">
@endpush @endpush
@ -222,6 +228,14 @@
placeholder: "{{ trans('general.form.select.field', ['field' => trans('settings.system.session.handler')]) }}" placeholder: "{{ trans('general.form.select.field', ['field' => trans('settings.system.session.handler')]) }}"
}); });
$('#financial_start').datepicker({
format: 'dd MM',
todayBtn: 'linked',
weekStart: 1,
autoclose: true,
language: '{{ language()->getShortCode() }}'
});
$('#company_logo').fancyfile({ $('#company_logo').fancyfile({
text : '{{ trans('general.form.select.file') }}', text : '{{ trans('general.form.select.file') }}',
style : 'btn-default', style : 'btn-default',