Autocomplete service center name
This commit is contained in:
@@ -105,5 +105,11 @@ namespace MileageTraker.Web.Controllers
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,11 @@ $(function () {
|
||||
source: "/User/Autocomplete",
|
||||
minLength: 2
|
||||
});
|
||||
|
||||
$("input#ServiceCenterName").autocomplete({
|
||||
source: "/VehicleService/ServiceCenterNameAutocomplete",
|
||||
minLength: 2
|
||||
});
|
||||
|
||||
$("form select#Year").change(function () {
|
||||
var year = $(this).val();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
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">
|
||||
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\Details.cshtml" />
|
||||
<Content Include="Views\Shared\EditorTemplates\VehicleServiceResultsViewModel.cshtml" />
|
||||
<Content Include="Views\VehicleService\Empty.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Content\Account.Login.css" />
|
||||
|
||||
Reference in New Issue
Block a user