Skip to content

Commit

Permalink
Show due date calendar after start date is changed to another month
Browse files Browse the repository at this point in the history
  • Loading branch information
benguozakinci@gmail.com authored and benguozakinci@gmail.com committed Jul 7, 2021
1 parent 528b9b7 commit efe21a7
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions resources/assets/js/components/AkauntingDate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,14 @@ export default {
this.dateConfig.locale = lang;
}
},
mounted() {
this.real_model = this.value;
},
mounted() {
if (this.model) {
this.real_model = this.model;
}
this.$emit('interface', this.real_model);
},
methods: {
Expand All @@ -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);
}
},
}
}
Expand All @@ -166,4 +178,4 @@ export default {
.hidden-year-flatpickr {
display: none !important;
}
</style>
</style>

0 comments on commit efe21a7

Please sign in to comment.