Autocomplete service center name
This commit is contained in:
@@ -105,5 +105,11 @@ namespace MileageTraker.Web.Controllers
|
|||||||
}
|
}
|
||||||
return View(viewModel);
|
return View(viewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JsonResult ServiceCenterNameAutocomplete(string term)
|
||||||
|
{
|
||||||
|
var names = DataService.GetServiceCenterNamesAutocomplete(term);
|
||||||
|
return Json(names, JsonRequestBehavior.AllowGet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -858,6 +858,23 @@ namespace MileageTraker.Web.DAL
|
|||||||
return vehicleServices;
|
return vehicleServices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IQueryable<string> GetServiceCenterNames()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
from l in GetVehicleServices()
|
||||||
|
group l by new {l.ServiceCenterName}
|
||||||
|
into g
|
||||||
|
select g.Key.ServiceCenterName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<string> GetServiceCenterNamesAutocomplete(string term)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
from name in GetServiceCenterNames()
|
||||||
|
where name.StartsWith(term)
|
||||||
|
select name;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ $(function () {
|
|||||||
minLength: 2
|
minLength: 2
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("input#ServiceCenterName").autocomplete({
|
||||||
|
source: "/VehicleService/ServiceCenterNameAutocomplete",
|
||||||
|
minLength: 2
|
||||||
|
});
|
||||||
|
|
||||||
$("form select#Year").change(function () {
|
$("form select#Year").change(function () {
|
||||||
var year = $(this).val();
|
var year = $(this).val();
|
||||||
var months = availableLogYearMonths[year];
|
var months = availableLogYearMonths[year];
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
ViewBag.Title = "No Fuel Logs";
|
ViewBag.Title = "No Fuel Logs";
|
||||||
}
|
}
|
||||||
|
|
||||||
<h2 class="center-content">@ViewBag.Title</h2>
|
<h2 class="center-content"><i class="fa fa-tachometer"></i> @ViewBag.Title</h2>
|
||||||
|
|
||||||
<div class="center-content well">
|
<div class="center-content well">
|
||||||
No Fuel logs have been added yet. @Html.ActionLink("Import", "ImportUpload", null, new { @class = "btn" })
|
No Fuel logs have been added yet. @Html.ActionLink("Import", "ImportUpload", null, new { @class = "btn" })
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
@{
|
||||||
|
ViewBag.Title = "No Vehicle Service";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h2 class="center-content"><i class="fa fa-wrench"></i> @ViewBag.Title</h2>
|
||||||
|
|
||||||
|
<div class="center-content well">
|
||||||
|
No Vehicle Services have been added yet. @Html.ActionLink("Add Service", "Create", null, new { @class = "btn" })
|
||||||
|
</div>
|
||||||
@@ -335,6 +335,7 @@
|
|||||||
<Content Include="Views\VehicleService\Edit.cshtml" />
|
<Content Include="Views\VehicleService\Edit.cshtml" />
|
||||||
<Content Include="Views\VehicleService\Details.cshtml" />
|
<Content Include="Views\VehicleService\Details.cshtml" />
|
||||||
<Content Include="Views\Shared\EditorTemplates\VehicleServiceResultsViewModel.cshtml" />
|
<Content Include="Views\Shared\EditorTemplates\VehicleServiceResultsViewModel.cshtml" />
|
||||||
|
<Content Include="Views\VehicleService\Empty.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Content\Account.Login.css" />
|
<Content Include="Content\Account.Login.css" />
|
||||||
|
|||||||
Reference in New Issue
Block a user