diff --git a/src/html/index.html b/src/html/index.html
index 016a7de..d1a0140 100644
--- a/src/html/index.html
+++ b/src/html/index.html
@@ -148,7 +148,24 @@
-
+
+
+
+
diff --git a/src/html/js/entries.js b/src/html/js/entries.js
index e6022f5..5510ff0 100644
--- a/src/html/js/entries.js
+++ b/src/html/js/entries.js
@@ -214,6 +214,16 @@ var ListViewModel = function() {
var entries = [self.newEntry()].concat(ko.utils.arrayMap($.parseJSON(data), ko.mapping.fromJS));
self.entries(entries);
+
+ // Initialize date picker for value date column.
+ $("#new_value_date").datepicker().on('changeDate', function(ev){
+ self.newEntry().value_date(ev.date.format(ev.currentTarget.dataset.dateFormat));
+ });
+
+ // Initialize date picker for operation date column.
+ $("#new_operation_date").datepicker().on('changeDate', function(ev){
+ self.newEntry().operation_date(ev.date.format(ev.currentTarget.dataset.dateFormat));
+ });
});
} else {
// If no month, just remove all entries.
@@ -293,7 +303,7 @@ var ListViewModel = function() {
// Function to select template in function of selected item.
self.templateToUse = function (item) {
- return self.selectedItem() === item || self.newEntry() === item ? 'editTmpl' : 'itemsTmpl';
+ return self.newEntry() === item ? 'newTmpl' : self.selectedItem() === item ? 'editTmpl' : 'itemsTmpl';
};
// Function to edit an item