Show due date calendar after start date is changed to another month
This commit is contained in:
parent
528b9b78bb
commit
efe21a74c4
@ -117,16 +117,14 @@ export default {
|
||||
|
||||
this.dateConfig.locale = lang;
|
||||
}
|
||||
|
||||
this.real_model = this.value;
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.real_model = this.value;
|
||||
|
||||
if (this.model) {
|
||||
this.real_model = this.model;
|
||||
}
|
||||
|
||||
this.$emit('interface', this.real_model);
|
||||
},
|
||||
|
||||
methods: {
|
||||
@ -147,16 +145,30 @@ export default {
|
||||
wrapper.classList.remove('hidden-year-flatpickr');
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
addDays(dateInput) {
|
||||
if(!default_payment_terms) return;
|
||||
|
||||
const dateString = new Date(dateInput);
|
||||
const aMillisec = 86400000;
|
||||
const dateInMillisecs = dateString.getTime();
|
||||
const settingPaymentTermInMs = default_payment_terms * aMillisec;
|
||||
const prospectedDueDate = new Date(dateInMillisecs + settingPaymentTermInMs);
|
||||
|
||||
return prospectedDueDate;
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
value: function(val) {
|
||||
this.real_model = val;
|
||||
},
|
||||
dateConfig: function() {
|
||||
if(!default_payment_terms || this.real_model < this.dateConfig.minDate){
|
||||
this.real_model = this.dateConfig.minDate;
|
||||
}
|
||||
|
||||
dataValueMin: function(val) {
|
||||
this.dateConfig.minDate = val;
|
||||
if(this.dateConfig.minDate && this.real_model > this.dateConfig.minDate ){
|
||||
this.real_model = this.addDays(this.real_model);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -166,4 +178,4 @@ export default {
|
||||
.hidden-year-flatpickr {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
Loading…
x
Reference in New Issue
Block a user