Changed chart display, in order to add another chart. Changed remove item confirmation dialog to bootstrap modal.
This commit is contained in:
@ -40,6 +40,7 @@ var ListViewModel = function() {
|
||||
|
||||
self.selectedItem = ko.observable();
|
||||
self.savedItem = ko.observable();
|
||||
self.itemToRemove = ko.observable();
|
||||
|
||||
self.entriesChart = ko.computed(function() {
|
||||
var entries = self.entries().slice().reverse();
|
||||
@ -250,17 +251,24 @@ var ListViewModel = function() {
|
||||
|
||||
self.remove = function (item) {
|
||||
if (item.id()) {
|
||||
if (confirm('Are you sure you wish to delete this item?')) {
|
||||
$.post("api/entry.php", {action: "remove_entry", entry:item}).success(function (result) {
|
||||
self.selectedItem(null);
|
||||
self.loadAccounts();
|
||||
});
|
||||
}
|
||||
self.itemToRemove(item);
|
||||
$('#remove-confirm').modal();
|
||||
} else {
|
||||
self.entries.remove(item);
|
||||
}
|
||||
};
|
||||
|
||||
self.confirmRemove = function() {
|
||||
var item = self.itemToRemove();
|
||||
|
||||
$.post("api/entry.php", {action: "remove_entry", entry:item}).success(function (result) {
|
||||
self.loadAccounts();
|
||||
}).complete(function (result) {
|
||||
self.itemToRemove(null);
|
||||
$('#remove-confirm').modal('hide');
|
||||
});
|
||||
};
|
||||
|
||||
self.selectMonth = function(month) {
|
||||
if(month) {
|
||||
self.month(month);
|
||||
@ -383,9 +391,6 @@ ko.bindingHandlers.chart = {
|
||||
$.jqplot(element.id, chartValues, {
|
||||
axes:{
|
||||
xaxis:{
|
||||
//autoscale: true,
|
||||
//min: firstDate.toString(),
|
||||
//max: lastDate.toString(),
|
||||
renderer:$.jqplot.DateAxisRenderer,
|
||||
tickOptions: {formatString: "%F"}
|
||||
},
|
||||
|
Reference in New Issue
Block a user