Merge pull request #2118 from brkcvn/min-date-control

Flatpickr minimum date controlled Invoice and Reconciliations page.
This commit is contained in:
Cüneyt Şentürk 2021-06-18 18:26:47 +03:00 committed by GitHub
commit 856e10a2dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 781 additions and 757 deletions

View File

@ -5,6 +5,7 @@
{'readonly': readonly},
{'disabled': disabled},
{'hidden-year': hiddenYear},
{'data-value-min': dataValueMin},
formClasses
]"
:footer-error="formError"
@ -98,6 +99,9 @@ export default {
},
hiddenYear: {
type: [Boolean, String]
},
dataValueMin: {
type: [Boolean, String, Date]
}
},
@ -149,7 +153,11 @@ export default {
watch: {
value: function(val) {
this.real_model = val;
}
},
dataValueMin: function(val) {
this.dateConfig.minDate = val;
},
}
}
</script>

View File

@ -36,6 +36,7 @@ const app = new Vue({
cleared_amount: 0,
difference: 0,
},
min_due_date: false
}
},
@ -50,6 +51,10 @@ const app = new Vue({
},
methods:{
setDueMinDate(date) {
this.min_due_date = date;
},
onReconcilition() {
let form = document.getElementById('form-create-reconciliation');
@ -119,3 +124,4 @@ const app = new Vue({
}
},
});

View File

@ -54,6 +54,7 @@ const app = new Vue({
taxes: [],
page_loaded: false,
currencies: [],
min_due_date: false,
}
},
@ -544,6 +545,10 @@ const app = new Vue({
}
}, this);
},
setDueMinDate(date) {
this.min_due_date = date;
},
},
created() {
@ -642,3 +647,4 @@ const app = new Vue({
}
}
});

View File

@ -16,9 +16,9 @@
<div class="card-body">
<div class="row align-items-center">
{{ Form::dateGroup('started_at', trans('reconciliations.start_date'), 'calendar', ['id' => 'started_at', 'class' => 'form-control datepicker', 'required' => 'required', 'show-date-format' => company_date_format(), 'date-format' => 'Y-m-d', 'autocomplete' => 'off'], request('started_at', Date::now()->firstOfMonth()->toDateString()), 'col-xl-3') }}
{{ Form::dateGroup('started_at', trans('reconciliations.start_date'), 'calendar', ['id' => 'started_at', 'class' => 'form-control datepicker', 'required' => 'required', 'show-date-format' => company_date_format(), 'date-format' => 'Y-m-d', 'autocomplete' => 'off', 'change' => 'setDueMinDate'], request('started_at', Date::now()->firstOfMonth()->toDateString()), 'col-xl-3') }}
{{ Form::dateGroup('ended_at', trans('reconciliations.end_date'), 'calendar', ['id' => 'ended_at', 'class' => 'form-control datepicker', 'required' => 'required', 'show-date-format' => company_date_format(), 'date-format' => 'Y-m-d', 'autocomplete' => 'off'], request('ended_at', Date::now()->endOfMonth()->toDateString()), 'col-xl-3') }}
{{ Form::dateGroup('ended_at', trans('reconciliations.end_date'), 'calendar', ['id' => 'ended_at', 'class' => 'form-control datepicker', 'required' => 'required', 'show-date-format' => company_date_format(), 'date-format' => 'Y-m-d', 'autocomplete' => 'off', 'min-date' => 'form.started_at', 'min-date-dynamic' => 'min_due_date', 'data-value-min' => true], request('ended_at', Date::now()->endOfMonth()->toDateString()), 'col-xl-3') }}
{{ Form::moneyGroup('closing_balance', trans('reconciliations.closing_balance'), 'balance-scale', ['required' => 'required', 'autofocus' => 'autofocus', 'currency' => $currency, 'dynamic-currency' => 'currency', 'input' => 'onCalculate'], request('closing_balance', 0.00), 'col-xl-2') }}

View File

@ -22,7 +22,7 @@
<div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
<div class="row">
@if (!$hideIssuedAt)
{{ Form::dateGroup('issued_at', trans($textIssuedAt), 'calendar', ['id' => 'issued_at', 'class' => 'form-control datepicker', 'required' => 'required', 'show-date-format' => company_date_format(), 'date-format' => 'Y-m-d', 'autocomplete' => 'off'], $issuedAt) }}
{{ Form::dateGroup('issued_at', trans($textIssuedAt), 'calendar', ['id' => 'issued_at', 'class' => 'form-control datepicker', 'required' => 'required', 'show-date-format' => company_date_format(), 'date-format' => 'Y-m-d', 'autocomplete' => 'off', 'change' => 'setDueMinDate'], $issuedAt) }}
@endif
@if (!$hideDocumentNumber)
@ -30,7 +30,7 @@
@endif
@if (!$hideDueAt)
{{ Form::dateGroup('due_at', trans($textDueAt), 'calendar', ['id' => 'due_at', 'class' => 'form-control datepicker', 'required' => 'required', 'show-date-format' => company_date_format(), 'date-format' => 'Y-m-d', 'autocomplete' => 'off'], $dueAt) }}
{{ Form::dateGroup('due_at', trans($textDueAt), 'calendar', ['id' => 'due_at', 'class' => 'form-control datepicker', 'required' => 'required', 'show-date-format' => company_date_format(), 'date-format' => 'Y-m-d', 'autocomplete' => 'off', 'min-date' => 'form.issued_at', 'min-date-dynamic' => 'min_due_date', 'data-value-min' => true], $dueAt) }}
@else
{{ Form::hidden('due_at', old('issued_at', $issuedAt), ['id' => 'due_at', 'v-model' => 'form.issued_at']) }}
@endif

View File

@ -55,6 +55,10 @@
hidden-year
@endif
@if (!empty($attributes['min-date-dynamic']))
:data-value-min="{{ $attributes['min-date-dynamic'] }}"
@endif
@if (!empty($attributes['change']))
@change="{{ $attributes['change'] }}"
@endif