Merge pull request #2087 from brkcvn/financial-year-start

Localization fiscal year change bugfix sovled
This commit is contained in:
Cüneyt Şentürk 2021-06-07 17:05:59 +03:00 committed by GitHub
commit 9216b16752
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 2 deletions

View File

@ -4,12 +4,14 @@
:class="[ :class="[
{'readonly': readonly}, {'readonly': readonly},
{'disabled': disabled}, {'disabled': disabled},
{'hidden-year': hiddenYear},
formClasses formClasses
]" ]"
:footer-error="formError" :footer-error="formError"
:prependIcon="icon" :prependIcon="icon"
:readonly="readonly" :readonly="readonly"
:disabled="disabled" :disabled="disabled"
@focus="focus"
> >
<flat-picker slot-scope="{focus, blur}" <flat-picker slot-scope="{focus, blur}"
:name="dataName" :name="dataName"
@ -93,6 +95,9 @@ export default {
locale: { locale: {
type: String, type: String,
default: 'en', default: 'en',
},
hiddenYear: {
type: [Boolean, String]
} }
}, },
@ -125,6 +130,19 @@ export default {
this.$emit('interface', this.real_model); this.$emit('interface', this.real_model);
this.$emit('change', this.real_model); this.$emit('change', this.real_model);
},
focus() {
let date_wrapper_html = document.querySelectorAll('.numInputWrapper');
if(this.hiddenYear) {
date_wrapper_html.forEach((wrapper) => {
wrapper.classList.add('hidden-year-flatpickr');
});
} else {
date_wrapper_html.forEach((wrapper) => {
wrapper.classList.remove('hidden-year-flatpickr');
});
}
} }
}, },
@ -135,3 +153,9 @@ export default {
} }
} }
</script> </script>
<style>
.hidden-year-flatpickr {
display: none !important;
}
</style>

View File

@ -8,7 +8,6 @@
@else @else
:form-classes="[{'has-error': form.errors.get('{{ $name }}') }]" :form-classes="[{'has-error': form.errors.get('{{ $name }}') }]"
@endif @endif
:group_class="'{{ $group_class }}'" :group_class="'{{ $group_class }}'"
icon="fa fa-{{ $icon }}" icon="fa fa-{{ $icon }}"
@ -52,6 +51,10 @@
@interface="form.errors.clear('{{ $name }}'); form.{{ $name }} = $event" @interface="form.errors.clear('{{ $name }}'); form.{{ $name }} = $event"
@endif @endif
@if (!empty($attributes['hidden_year']))
hidden-year
@endif
@if (!empty($attributes['change'])) @if (!empty($attributes['change']))
@change="{{ $attributes['change'] }}" @change="{{ $attributes['change'] }}"
@endif @endif

View File

@ -18,7 +18,7 @@
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<div class="row"> <div class="row">
{{ Form::dateGroup('financial_start', trans('settings.localisation.financial_start'), 'calendar', ['id' => 'financial_start', 'class' => 'form-control datepicker', 'show-date-format' => 'j F', 'date-format' => 'd-m', 'autocomplete' => 'off'], setting('localisation.financial_start')) }} {{ Form::dateGroup('financial_start', trans('settings.localisation.financial_start'), 'calendar', ['id' => 'financial_start', 'class' => 'form-control datepicker', 'show-date-format' => 'j F', 'date-format' => 'd-m', 'autocomplete' => 'off', 'hidden_year' => true], setting('localisation.financial_start')) }}
{{ Form::selectGroup('financial_denote', trans('settings.localisation.financial_denote.title'), 'calendar', $financial_denote_options, setting('localisation.financial_denote'), []) }} {{ Form::selectGroup('financial_denote', trans('settings.localisation.financial_denote.title'), 'calendar', $financial_denote_options, setting('localisation.financial_denote'), []) }}