From 84db5ede7695ca035af867bb0bb3ccbbe14c5011 Mon Sep 17 00:00:00 2001 From: denisdulici Date: Mon, 24 Dec 2018 11:01:00 +0300 Subject: [PATCH] added date picker #681 --- app/Listeners/Updates/Version135.php | 30 +++++++++++++++++++ database/seeds/Settings.php | 4 +-- resources/lang/en-GB/settings.php | 20 ++++++------- .../views/settings/settings/edit.blade.php | 22 +++++++++++--- 4 files changed, 60 insertions(+), 16 deletions(-) create mode 100644 app/Listeners/Updates/Version135.php diff --git a/app/Listeners/Updates/Version135.php b/app/Listeners/Updates/Version135.php new file mode 100644 index 000000000..f913ebe3b --- /dev/null +++ b/app/Listeners/Updates/Version135.php @@ -0,0 +1,30 @@ +check($event)) { + return; + } + + // Add financial year start to settings + setting(['general.financial_start' => Date::now()->startOfYear()->format('d F')]); + setting()->save(); + } +} diff --git a/database/seeds/Settings.php b/database/seeds/Settings.php index a1d3217ff..7b7ec7c8c 100644 --- a/database/seeds/Settings.php +++ b/database/seeds/Settings.php @@ -28,10 +28,10 @@ class Settings extends Seeder $company_id = $this->command->argument('company'); Setting::set([ - 'general.date_format' => 'd M Y', 'general.financial_start' => Date::now()->startOfYear()->format('d F'), - 'general.date_separator' => 'space', 'general.timezone' => 'Europe/London', + 'general.date_format' => 'd M Y', + 'general.date_separator' => 'space', 'general.percent_position' => 'after', 'general.invoice_number_prefix' => 'INV-', 'general.invoice_number_digit' => '5', diff --git a/resources/lang/en-GB/settings.php b/resources/lang/en-GB/settings.php index 3b7409ced..a7156faba 100644 --- a/resources/lang/en-GB/settings.php +++ b/resources/lang/en-GB/settings.php @@ -11,17 +11,17 @@ return [ ], 'localisation' => [ 'tab' => 'Localisation', - 'date' => [ - 'format' => 'Date Format', - 'financial_start' => 'Financial year start', - 'separator' => 'Date Separator', - 'dash' => 'Dash (-)', - 'dot' => 'Dot (.)', - 'comma' => 'Comma (,)', - 'slash' => 'Slash (/)', - 'space' => 'Space ( )', - ], + 'financial_start' => 'Financial Year Start', 'timezone' => 'Time Zone', + 'date' => [ + 'format' => 'Date Format', + 'separator' => 'Date Separator', + 'dash' => 'Dash (-)', + 'dot' => 'Dot (.)', + 'comma' => 'Comma (,)', + 'slash' => 'Slash (/)', + 'space' => 'Space ( )', + ], 'percent' => [ 'title' => 'Percent (%) Position', 'before' => 'Before Number', diff --git a/resources/views/settings/settings/edit.blade.php b/resources/views/settings/settings/edit.blade.php index 6f84b4e0a..4da10ef70 100644 --- a/resources/views/settings/settings/edit.blade.php +++ b/resources/views/settings/settings/edit.blade.php @@ -44,14 +44,15 @@
- {{ 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::selectGroup('date_separator', trans('settings.localisation.date.separator'), 'minus', $date_separators, null, []) }} + {{ 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('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, []) }}
@@ -155,10 +156,15 @@ @endsection @push('js') + + @if (language()->getShortCode() != 'en') + + @endif @endpush @push('css') + @endpush @@ -222,6 +228,14 @@ 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({ text : '{{ trans('general.form.select.file') }}', style : 'btn-default',