Nearing feature complete for driver auth

This commit is contained in:
2013-01-09 21:33:57 -05:00
parent 0b4c7914b3
commit bc019923d2
49 changed files with 609 additions and 335 deletions
+37 -72
View File
@@ -1,24 +1,16 @@
$(function () {
$("tbody > tr:odd").addClass("odd");
$("input:submit, .ui-button").button();
$("input#Date").datepicker({ maxDate: '+0d' });
$(".display-field-container")
.filter(".source,.userHostAddress,.userAgent")
.children(".display-label")
.css('text-decoration', 'underline')
.click(function () {
$(this).parent().children('.display-field').toggle();
})
.end()
.children('.display-field').hide();
$("input#CityName").autocomplete({
source: "/City/Autocomplete",
minLength: 2
});
$("input#EmployeeName, input#Assigned").autocomplete({
$("input#EmployeeName, input#Assigned, input#UserFullName").autocomplete({
source: "/Employee/Autocomplete",
minLength: 2
});
$("form select#Year").change(function () {
$.getJSON('/Log/GetValidLogMonths', { year: $(this).val() }, function (months) {
var options = '<option>Select Month</option>';
@@ -28,7 +20,9 @@ $(function () {
$("form select#Month").html(options);
});
});
$("input#ModelYear,input#Price,input#VehicleId,input#EndOdometer,input#GasPurchased").numeric();
$(".report-miles").append('&nbsp;<span class="muted">&#9652;</span>').each(function () {
var content = $(this).next('.report-calculation');
$(this).qtip({
@@ -57,58 +51,16 @@ $(function () {
}
});
});
});
if ($("input#EmployeeName").filter(':not(:hidden)').filter(':not(.search-query)').length > 0) {
$("input#EmployeeName")
.after('<span id="icon-employee-history" class="add-on"><i class="icon-search" /></span>')
.add('#icon-employee-history')
.wrapAll('<div class="input-append"></div>');
function employeeHistoryKeydownHandler(data) {
employeeHistoryIconUpdate($(data.target), $("#icon-employee-history"));
}
function employeeHistoryIconUpdate($input, $icon) {
if (!$input.hasClass("input-validation-error") // not invalid
&& $input.attr("value").length > 0) // has text
$icon.removeClass("transparent");
else
$icon.addClass("transparent");
}
$("input#EmployeeName").change(employeeHistoryKeydownHandler).keydown(employeeHistoryKeydownHandler);
employeeHistoryIconUpdate($("input#EmployeeName"), $("#icon-employee-history"));
$("#icon-employee-history").qtip({
content: {
text: "<p class=\"loading\">Recent Logs...</p>",
},
style: {
width: 310,
classes: 'qtip-light'
},
position: {
my: "top right",
at: "bottom right"
},
hide: {
fixed: true,
delay: 500
},
events: {
show: function(event, api) {
$.ajax({
url: "/CreateLog/RecentLogs",
data: {
employeeName: $("input#EmployeeName").val()
},
success: function(data) {
api.set("content.text", data);
}
});
}
// add recent logs to a div if it exists
$(function () {
var $recentLogs = $("#RecentLogs");
if ($recentLogs.length > 0) {
$.ajax({
url: "/CreateLog/RecentLogs",
success: function (data) {
$recentLogs.append(data);
}
});
}
@@ -119,16 +71,18 @@ $(function() {
$('label[for]').each(function() {
var $label = $(this);
var $for = $label.attr('for');
var $input = $('input#' + $for + ':checkbox');
if ($input.length > 0) {
$input.prependTo($label);
$label.addClass('checkbox');
if ($for.length > 0) {
var $input = $('input#' + $for + ',input[name="' + $for + '"]');
if ($input.filter(':checkbox').length > 0) {
$input.prependTo($label);
$label.addClass('checkbox');
}
}
});
});
// Add active class to nav
$(function() {
// Add active class to nav
var idNavActiveRegex = {
'log-nav': /\/log/i,
'vehicle-nav': /\/vehicle/i,
@@ -161,8 +115,8 @@ $(function () {
.prepend('<i class="icon-user icon-white" /> ');
});
// Convert MVC3 WebGrid paging to Bootstrap
$(function() {
// Convert MVC3 WebGrid paging to Bootstrap
var $paging = $('table.table tfoot tr td');
var $currentPage =
@@ -177,9 +131,20 @@ $(function() {
}
});
// auto complete email address based on username
$(function () {
$('input#Username').keyup(function (e) {
$('input#Email').val($(this).val() + "@ethra.org");
$('.create-user input#FullName').keyup(function () {
var fullName = $(this).val();
var names = fullName.split(' '); ///[a-z().]+(\s+[a-z().]+)+/i.test(fullName)
if (names.length > 1) {
var username = names[0][0] + names[names.length - 1];
$('.create-user input#Username').val(username);
$('.create-user input#Email').val(username + "@ethra.org");
}
});
$('.create-user input#Username').keyup(function () {
$('.create-user input#Email').val($(this).val() + "@ethra.org");
});
});
@@ -198,7 +163,7 @@ $(function() {
ajax: {
url: element.attr('href')
},
text: "<p class=\"loading\">Recent Logs...</p>"
text: "<p class=\"loading\">...</p>"
},
hide: {
fixed: true,