fix data binding for the timelogs to the timelog table.
fixed formatting for convertToHours to correct for one decimal place minutes (less than 10). added convertToDisplayTime method to convert the timelog timestamp to a logical format (hh:mm). #15
This commit is contained in:
parent
78acd50ba6
commit
7b5077ff5b
@ -199,9 +199,6 @@
|
||||
<div id="datePickerContainer">
|
||||
<div id="weeklyDatePicker"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" data-bind="value: $root.selectedCalendarWeek">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-9 col-xs-12 well">
|
||||
<!-- main content panel. -->
|
||||
@ -209,12 +206,10 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Day Of Week</th>
|
||||
<!-- ko foreach: new Array(MaxDailyLogCount/2) -->
|
||||
<th>In</th>
|
||||
<th>Out</th>
|
||||
<th>In</th>
|
||||
<th>Out</th>
|
||||
<th>In</th>
|
||||
<th>Out</th>
|
||||
<!-- /ko -->
|
||||
<th>Sub-Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -222,17 +217,17 @@
|
||||
<!-- ko foreach: TimeLogs-->
|
||||
<tr>
|
||||
<td class="valign" data-bind="text: DayOfWeek"></td>
|
||||
<td class="valign" data-bind="text: DailyTotal"></td>
|
||||
<!-- ko foreach: Logs -->
|
||||
<td class="valign" data-bind="text: $root.convertToDisplayTime(EventTime)"></td>
|
||||
<!-- /ko -->
|
||||
<!-- ko foreach: new Array($parent.MaxDailyLogCount-LogCount)-->
|
||||
<td class="valign"></td>
|
||||
<td class="valign"></td>
|
||||
<td class="valign"></td>
|
||||
<td class="valign"></td>
|
||||
<td class="valign"></td>
|
||||
<td class="valign">8</td>
|
||||
<!-- /ko -->
|
||||
<td class="valign"data-bind="text: $root.convertToHours(DailyTotal)"></td>
|
||||
</tr>
|
||||
<!-- /ko -->
|
||||
<tr>
|
||||
<td class="valign" colspan="7" for="monday">Weekly Total</td>
|
||||
<td class="valign" data-bind="attr:{colspan: MaxDailyLogCount+1}">Weekly Total</td>
|
||||
<td class="valign" for="dailyHrsTotal" data-bind="text: $root.convertToHours(WeeklyTotal)"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@ -130,8 +130,16 @@
|
||||
}
|
||||
};
|
||||
self.convertToHours = function (value) {
|
||||
return value / 60;
|
||||
var hrs = value / 60;
|
||||
if (hrs < 1) {
|
||||
return value + " mins";
|
||||
}
|
||||
return (value / 60)+" hrs";
|
||||
};
|
||||
self.convertToDisplayTime = function (dateValue) {
|
||||
var date = new Date(dateValue);
|
||||
return date.getHours() + ":" + (date.getMinutes() < 10 ? '0' : '') + date.getMinutes();
|
||||
};
|
||||
self.dismissAlert = function(data, event) {
|
||||
self.errorData(null);
|
||||
};
|
||||
@ -156,7 +164,6 @@
|
||||
value: pageNumber
|
||||
}
|
||||
];
|
||||
|
||||
var url = self.createRequestUrl("users", args, false, false);
|
||||
location.hash = url;
|
||||
console.log(url);
|
||||
@ -171,7 +178,6 @@
|
||||
todayHighlight: true,
|
||||
calendarWeeks: true
|
||||
});
|
||||
|
||||
if (!selectedDate) {
|
||||
selectedDate = new Date();
|
||||
} else {
|
||||
@ -190,7 +196,7 @@
|
||||
// moment(kk).weeksInYear()
|
||||
//);
|
||||
self.selectedCalendarWeek(moment(kk).isoWeek());
|
||||
self.goToTimeLogs(self.chosenTimeLogUserId, null, [{ key: "selectedDate", value: kk.toISOString() }]);
|
||||
self.goToTimeLogs(self.chosenTimeLogUserId, null, [{ key: "selectedDate", value: moment(kk).format("MM-DD-YYYY") }]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user