fix issue with pre-setting the date for the dialog when in manual log creation screen.

still not great as its still an issue with context menu getting relevant context.. its like when there is 1 data entry, columns get created and when you right click an empty cell, then it cannot get the context for the cell.
#82
This commit is contained in:
chris.watts90@outlook.com 2020-02-25 16:07:03 +00:00
parent fe5bcd3256
commit 7557a29350

View File

@ -410,18 +410,27 @@ function DataVM() {
self.assignUpdateHandler(); self.assignUpdateHandler();
}; };
function createlog(data, event) { function createlog(data, event) {
var logDateInitVal = moment(self.selectedTimeLogDate()).add((data.Day - 1), 'days').toISOString(); var createDate = "";
if (data && data.UserId && data.IdentifierId) {
createDate = data.EventTime;
} else if (data && data.Day) {
var mondayDate = moment(moment(self.userTimeLogData().SelectedDate).day("Monday").toISOString());
createDate = mondayDate.add(data.Day-1, 'days').toISOString();
} else {
createDate = self.userTimeLogData().SelectedDate;
}
self.manualLog({ self.manualLog({
CalendarWeek:-1, CalendarWeek:-1,
Direction:-1, Direction:-1,
EventTime: logDateInitVal, EventTime: createDate,
Id: -1, Id: -1,
IdentifierId: -1, IdentifierId: -1,
UserId: self.chosenTimeLogUserId, UserId: self.chosenTimeLogUserId,
Year: 0 Year: 0
}); });
$('#manualLogDialog').modal("show"); $('#manualLogDialog').modal("show");
self.initialiseManualLogDateTimePicker(logDateInitVal); self.initialiseManualLogDateTimePicker(createDate);
self.assignUpdateHandler(); self.assignUpdateHandler();
}; };
function deleteLog(data) { function deleteLog(data) {