Show due date calendar after start date is changed to another month

This commit is contained in:
benguozakinci@gmail.com 2021-07-07 16:20:46 +03:00
parent 528b9b78bb
commit efe21a74c4

View File

@ -117,16 +117,14 @@ export default {
this.dateConfig.locale = lang; this.dateConfig.locale = lang;
} }
this.real_model = this.value;
}, },
mounted() { mounted() {
this.real_model = this.value;
if (this.model) { if (this.model) {
this.real_model = this.model; this.real_model = this.model;
} }
this.$emit('interface', this.real_model);
}, },
methods: { methods: {
@ -147,16 +145,30 @@ export default {
wrapper.classList.remove('hidden-year-flatpickr'); 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: { watch: {
value: function(val) { dateConfig: function() {
this.real_model = val; if(!default_payment_terms || this.real_model < this.dateConfig.minDate){
}, this.real_model = this.dateConfig.minDate;
}
dataValueMin: function(val) { if(this.dateConfig.minDate && this.real_model > this.dateConfig.minDate ){
this.dateConfig.minDate = val; this.real_model = this.addDays(this.real_model);
}
}, },
} }
} }
@ -166,4 +178,4 @@ export default {
.hidden-year-flatpickr { .hidden-year-flatpickr {
display: none !important; display: none !important;
} }
</style> </style>