Skip to content

Commit

Permalink
added date picker #681
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Dec 24, 2018
1 parent 5735284 commit 84db5ed
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 15 deletions.
30 changes: 30 additions & 0 deletions app/Listeners/Updates/Version135.php
Original file line number Diff line number Diff line change
@@ -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();
}
}
4 changes: 2 additions & 2 deletions database/seeds/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ private function create()
$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',
Expand Down
18 changes: 9 additions & 9 deletions resources/lang/en-GB/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
],
'localisation' => [
'tab' => 'Localisation',
'financial_start' => 'Financial Year Start',
'timezone' => 'Time Zone',
'date' => [
'format' => 'Date Format',
'financial_start' => 'Financial year start',
'separator' => 'Date Separator',
'dash' => 'Dash (-)',
'dot' => 'Dot (.)',
'comma' => 'Comma (,)',
'slash' => 'Slash (/)',
'space' => 'Space ( )',
'format' => 'Date Format',
'separator' => 'Date Separator',
'dash' => 'Dash (-)',
'dot' => 'Dot (.)',
'comma' => 'Comma (,)',
'slash' => 'Slash (/)',
'space' => 'Space ( )',
],
'timezone' => 'Time Zone',
'percent' => [
'title' => 'Percent (%) Position',
'before' => 'Before Number',
Expand Down
22 changes: 18 additions & 4 deletions resources/views/settings/settings/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@
</div>

<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::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, []) }}
</div>

Expand Down Expand Up @@ -155,10 +156,15 @@
@endsection

@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>
@endpush

@push('css')
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/datepicker3.css') }}">
<link rel="stylesheet" href="{{ asset('public/css/bootstrap-fancyfile.css') }}">
@endpush

Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 84db5ed

Please sign in to comment.