hook into the selected week changed event to get timelogs from the api.
needs to change the datetime picker to show the selected date rather than today date. #5
This commit is contained in:
parent
760f37b14b
commit
7923867c2d
@ -7,6 +7,7 @@
|
||||
self.chosenUserDetails = ko.observable(null);
|
||||
self.userTimeLogData = ko.observable(null);
|
||||
self.unassignedCardData = ko.observable(null);
|
||||
self.chosenTimeLogUserId = -1;
|
||||
self.selectedCalendarWeek = ko.observable(0);
|
||||
self.errorData = ko.observable(null);
|
||||
self.apiEndpoints = {
|
||||
@ -25,7 +26,13 @@
|
||||
};
|
||||
self.goToMenuOption = function (menu) { location.hash = menu; console.log("goToMenuOption: " + menu); };
|
||||
self.goToUserDetails = function (user) { location.hash = self.uiPages.userDetails + "/" + user.UserId; };
|
||||
self.goToTimeLogs = function (user) { location.hash = "timelogs" + "/" + user.UserId; };
|
||||
self.goToTimeLogs = function (user, week) {
|
||||
var url = "timelogs" + "/" + user.UserId;
|
||||
if (week) {
|
||||
url += "/" + week;
|
||||
}
|
||||
location.hash = url;
|
||||
};
|
||||
self.assignErrorObject = function(errCode, errMessage, errorSource) {
|
||||
var errDat = {
|
||||
errorCode: errCode,
|
||||
@ -58,6 +65,11 @@
|
||||
};
|
||||
}
|
||||
};
|
||||
self.selectedCalendarWeek.subscribe(function (selectedWeek) {
|
||||
console.log("Calendar week changed to: " + selectedWeek);
|
||||
self.goToTimeLogs(self.chosenTimeLogUserId, selectedWeek);
|
||||
//self.getTimeLogData(self.chosenTimeLogUserId, selectedWeek);
|
||||
});
|
||||
/**
|
||||
* Create a request URL - references apiEndpoints object to construct url with args, and optional callback url.
|
||||
* @param {string} routePath
|
||||
@ -249,11 +261,18 @@
|
||||
self.getUnassignedCardData();
|
||||
//$.get("http://localhost:3000", { menu: this.params.menu }, self.chosenMenuData);
|
||||
});
|
||||
this.get("#timelogs/:userId", function () {
|
||||
this.get("#timelogs/:userId/:calendarWeek", function () {
|
||||
self.chosenMenuItemId("Other");
|
||||
self.userList(null);
|
||||
self.chosenUserDetails(null);
|
||||
self.getTimeLogData(this.params.userId, self.selectedCalendarWeek());
|
||||
self.chosenTimeLogUserId = this.params.userId;
|
||||
var week;
|
||||
if (self.params.calendarWeek) {
|
||||
week = this.params.calendarWeek;
|
||||
} else {
|
||||
week = self.selectedCalendarWeek();
|
||||
}
|
||||
self.getTimeLogData(this.params.userId, week);
|
||||
});
|
||||
this.get("#newUser", function () {
|
||||
self.chosenMenuItemId("newUser");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user