Min date control development
This commit is contained in:
parent
af685b6c17
commit
1a6ba034bd
@ -5,6 +5,8 @@
|
|||||||
{'readonly': readonly},
|
{'readonly': readonly},
|
||||||
{'disabled': disabled},
|
{'disabled': disabled},
|
||||||
{'hidden-year': hiddenYear},
|
{'hidden-year': hiddenYear},
|
||||||
|
{'data-value-control': dataValueControl},
|
||||||
|
{'data-value-min': dataValueMin},
|
||||||
formClasses
|
formClasses
|
||||||
]"
|
]"
|
||||||
:footer-error="formError"
|
:footer-error="formError"
|
||||||
@ -98,6 +100,12 @@ export default {
|
|||||||
},
|
},
|
||||||
hiddenYear: {
|
hiddenYear: {
|
||||||
type: [Boolean, String]
|
type: [Boolean, String]
|
||||||
|
},
|
||||||
|
dataValueControl: {
|
||||||
|
type: [Boolean, String, Date]
|
||||||
|
},
|
||||||
|
dataValueMin: {
|
||||||
|
type: [Boolean, String, Date]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -126,6 +134,18 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
dataControlEvent() {
|
||||||
|
if(this.dataValueControl) {
|
||||||
|
let date_control = document.querySelector('.data-value-control .datepicker');
|
||||||
|
|
||||||
|
if(this.dataValueMin) {
|
||||||
|
debugger;
|
||||||
|
this.dateConfig.minDate = date_control.value;
|
||||||
|
// this.$set(this.dateConfig,'minDate', date_control.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
change() {
|
change() {
|
||||||
this.$emit('interface', this.real_model);
|
this.$emit('interface', this.real_model);
|
||||||
|
|
||||||
@ -143,13 +163,18 @@ export default {
|
|||||||
wrapper.classList.remove('hidden-year-flatpickr');
|
wrapper.classList.remove('hidden-year-flatpickr');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
//this.dataControlEvent();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
value: function(val) {
|
value: function(val) {
|
||||||
this.real_model = val;
|
this.real_model = val;
|
||||||
}
|
},
|
||||||
|
|
||||||
|
dataValueMin: function(val) {
|
||||||
|
this.dateConfig.minDate = val;
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
28
resources/assets/js/views/common/documents.js
vendored
28
resources/assets/js/views/common/documents.js
vendored
@ -4,22 +4,22 @@
|
|||||||
* building robust, powerful web applications using Vue and Laravel.
|
* building robust, powerful web applications using Vue and Laravel.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require('./../../bootstrap');
|
require('./../../bootstrap');
|
||||||
|
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
|
||||||
import DashboardPlugin from './../../plugins/dashboard-plugin';
|
import DashboardPlugin from './../../plugins/dashboard-plugin';
|
||||||
|
|
||||||
import Global from './../../mixins/global';
|
import Global from './../../mixins/global';
|
||||||
|
|
||||||
import Form from './../../plugins/form';
|
import Form from './../../plugins/form';
|
||||||
import Error from './../../plugins/error';
|
import Error from './../../plugins/error';
|
||||||
import BulkAction from './../../plugins/bulk-action';
|
import BulkAction from './../../plugins/bulk-action';
|
||||||
|
|
||||||
// plugin setup
|
// plugin setup
|
||||||
Vue.use(DashboardPlugin);
|
Vue.use(DashboardPlugin);
|
||||||
|
|
||||||
const app = new Vue({
|
const app = new Vue({
|
||||||
el: '#main-body',
|
el: '#main-body',
|
||||||
|
|
||||||
mixins: [
|
mixins: [
|
||||||
@ -54,6 +54,7 @@ const app = new Vue({
|
|||||||
taxes: [],
|
taxes: [],
|
||||||
page_loaded: false,
|
page_loaded: false,
|
||||||
currencies: [],
|
currencies: [],
|
||||||
|
min_due_date: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -544,6 +545,10 @@ const app = new Vue({
|
|||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setDueMinDate(date) {
|
||||||
|
this.min_due_date = date;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
@ -641,4 +646,5 @@ const app = new Vue({
|
|||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -22,7 +22,7 @@
|
|||||||
<div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
|
<div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@if (!$hideIssuedAt)
|
@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', 'data-value-control' => true, 'change' => 'setDueMinDate'], $issuedAt) }}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if (!$hideDocumentNumber)
|
@if (!$hideDocumentNumber)
|
||||||
@ -30,7 +30,7 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if (!$hideDueAt)
|
@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-control' => true, 'data-value-min' => true], $dueAt) }}
|
||||||
@else
|
@else
|
||||||
{{ Form::hidden('due_at', old('issued_at', $issuedAt), ['id' => 'due_at', 'v-model' => 'form.issued_at']) }}
|
{{ Form::hidden('due_at', old('issued_at', $issuedAt), ['id' => 'due_at', 'v-model' => 'form.issued_at']) }}
|
||||||
@endif
|
@endif
|
||||||
|
@ -55,6 +55,14 @@
|
|||||||
hidden-year
|
hidden-year
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@if (!empty($attributes['data-value-control']))
|
||||||
|
data-value-control
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if (!empty($attributes['min-date-dynamic']))
|
||||||
|
:data-value-min="{{ $attributes['min-date-dynamic'] }}"
|
||||||
|
@endif
|
||||||
|
|
||||||
@if (!empty($attributes['change']))
|
@if (!empty($attributes['change']))
|
||||||
@change="{{ $attributes['change'] }}"
|
@change="{{ $attributes['change'] }}"
|
||||||
@endif
|
@endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user