Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Added support for date type checkout attribute #168

DanielŻuławski3b8456153fe2
diff --git a/src/Web/Grand.Web/Views/ShoppingCart/_CheckoutAttributes.cshtml b/src/Web/Grand.Web/Views/ShoppingCart/_CheckoutAttributes.cshtml
index 50442042c..80c69d898 100644
--- a/src/Web/Grand.Web/Views/ShoppingCart/_CheckoutAttributes.cshtml
+++ b/src/Web/Grand.Web/Views/ShoppingCart/_CheckoutAttributes.cshtml
@@ -78,6 +78,12 @@
<template v-if="attribute.AttributeControlType == 10">
<textarea class="form-control" :id="'checkout_attribute_' + attribute.Id" :name="'checkout_attribute_' + attribute.Id" v-model="attribute.DefaultValue" :value="attribute.DefaultValue" onchange="checkoutAttributeChange()">{{attribute.DefaultValue}}</textarea>
</template>
+ <template v-if="attribute.AttributeControlType == 20">
+ <input id="dateDay" :name="'checkout_attribute_' + attribute.Id + '_day'" type="hidden" />
+ <input id="dateMonth" :name="'checkout_attribute_' + attribute.Id + '_month'" type="hidden" />
+ <input id="dateYear" :name="'checkout_attribute_' + attribute.Id + '_year'" type="hidden" />
+ <input type="date" class="form-control" v-model="vmorder.date" />
+ </template>
<template v-if="attribute.AttributeControlType == 30">
<template>
<div :id="'checkout_attribute_' + attribute.Id + 'uploader'">
diff --git a/src/Web/Grand.Web/Views/ShoppingCart/_ModelScript.cshtml b/src/Web/Grand.Web/Views/ShoppingCart/_ModelScript.cshtml
index 6dfc89da9..fc7a964f5 100644
--- a/src/Web/Grand.Web/Views/ShoppingCart/_ModelScript.cshtml
+++ b/src/Web/Grand.Web/Views/ShoppingCart/_ModelScript.cshtml
@@ -6,6 +6,7 @@
cart: @Json.Serialize(Model),
totals: null,
checkoutAsGuest: false,
+ date: null,
// confirm order
MinOrderTotalWarning: null,
TermsOfServiceOnOrderConfirmPage: null,
@@ -24,6 +25,22 @@
if (this.terms == true) {
this.acceptTerms = false;
}
+ },
+ date: function () {
+ var d = new Date(this.date);
+
+ if (!!d.valueOf()) { // Valid date
+
+ const day = d.getDate();
+ const month = d.getMonth();
+ const year = d.getFullYear();
+
+ document.getElementById("dateDay").value = day;
+ document.getElementById("dateMonth").value = month;
+ document.getElementById("dateYear").value = year;
+
+ checkoutAttributeChange();
+ }
}
},
methods: {