Update date component with props and functionality
This commit is contained in:
parent
c21857df9c
commit
5e291f0332
@ -60,6 +60,10 @@ export default {
|
|||||||
default: false,
|
default: false,
|
||||||
description: "Input readonly status"
|
description: "Input readonly status"
|
||||||
},
|
},
|
||||||
|
props: {
|
||||||
|
type: Number,
|
||||||
|
description: "Payment period"
|
||||||
|
},
|
||||||
disabled: {
|
disabled: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
@ -150,12 +154,12 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
addDays(dateInput) {
|
addDays(dateInput) {
|
||||||
if(!default_payment_terms) return;
|
if(!this.period) return;
|
||||||
|
|
||||||
const dateString = new Date(dateInput);
|
const dateString = new Date(dateInput);
|
||||||
const aMillisec = 86400000;
|
const aMillisec = 86400000;
|
||||||
const dateInMillisecs = dateString.getTime();
|
const dateInMillisecs = dateString.getTime();
|
||||||
const settingPaymentTermInMs = parseInt(default_payment_terms) * aMillisec;
|
const settingPaymentTermInMs = parseInt(this.period) * aMillisec;
|
||||||
const prospectedDueDate = new Date(dateInMillisecs + settingPaymentTermInMs);
|
const prospectedDueDate = new Date(dateInMillisecs + settingPaymentTermInMs);
|
||||||
|
|
||||||
return prospectedDueDate;
|
return prospectedDueDate;
|
||||||
@ -168,13 +172,11 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
dateConfig: function() {
|
dateConfig: function() {
|
||||||
if(!default_payment_terms || this.real_model < this.dateConfig.minDate) {
|
if(this.dateConfig.minDate) {
|
||||||
this.real_model = this.dateConfig.minDate;
|
if(this.real_model < this.dateConfig.minDate){
|
||||||
}
|
|
||||||
|
|
||||||
if(this.dateConfig.minDate && this.real_model > this.dateConfig.minDate ) {
|
|
||||||
this.real_model = this.addDays(this.dateConfig.minDate);
|
this.real_model = this.addDays(this.dateConfig.minDate);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user