Skip to content

Commit

Permalink
Merge pull request #570 from SavageLearning/feature/lookup
Browse files Browse the repository at this point in the history
Dispatch Timezone and Lookup View
#519 #569
  • Loading branch information
esteban-gs authored Dec 1, 2019
2 parents 8b209ea + d150bce commit 72ec34f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
24 changes: 23 additions & 1 deletion Machete.Service/WorkAssignmentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,29 @@ public override WorkAssignment Get(int id)
IQueryable<WorkAssignment> q = waRepo.GetAllQ();
//
//
if (o.date != null) IndexViewBase.diffDays((DateTime) o.date, ref q);
if (o.date != null)
{
var requestedDate = o.date.Value.DateBasedOn(_clientTimeZoneInfo);
var endOfDay = requestedDate.AddDays(1).AddMilliseconds(-1);

DateTime sunday;
if (requestedDate.DayOfWeek == DayOfWeek.Saturday)
{
sunday = requestedDate.AddDays(1);
q = q.Where(p =>
p.workOrder.dateTimeofWork.DateTimeFrom(_clientTimeZoneInfo).Date >= requestedDate.Date
&& p.workOrder.dateTimeofWork.DateTimeFrom(_clientTimeZoneInfo).Date <= sunday.Date
);
}
else
{
q = q.Where(p => p.workOrder.dateTimeofWork.DateTimeFrom(_clientTimeZoneInfo).Date == requestedDate.Date);
}

// IndexViewBase.diffDays((DateTime) o.date, ref q);
}


if (o.typeofwork_grouping > 0) IndexViewBase.typeOfWork(o, ref q, lRepo);
if (o.woid > 0) IndexViewBase.WOID(o, ref q);
if (o.personID > 0) IndexViewBase.WID(o, ref q);
Expand Down
8 changes: 4 additions & 4 deletions Machete.Web/Controllers/Legacy/ConfigController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public LookupController(ILookupService serv,
public ActionResult Index()
{
ViewBag.configCategories = def.configCategories();
return View("~/Views/Config/Index.cshtml");
return View("~/Views/Lookup/Index.cshtml");
}
[Authorize(Roles = "Administrator, Manager")]
public ActionResult AjaxHandler(jQueryDataTableParam param)
Expand Down Expand Up @@ -90,7 +90,7 @@ public ActionResult Create()
{
var m = map.Map<Lookup, ViewModel.Lookup>(new Lookup());
m.def = def;
return PartialView("~/Views/Config/Create.cshtml", m);
return PartialView("~/Views/Lookup/Create.cshtml", m);
}
/// <summary>
///
Expand Down Expand Up @@ -127,7 +127,7 @@ public ActionResult Edit(int id)
{
var m = map.Map<Lookup, ViewModel.Lookup>(serv.Get(id));
m.def = def;
return PartialView("~/Views/Config/Edit.cshtml", m);
return PartialView("~/Views/Lookup/Edit.cshtml", m);
}
/// <summary>
///
Expand Down Expand Up @@ -160,7 +160,7 @@ public ActionResult View(int id)
{
var m = map.Map<Lookup, ViewModel.Lookup>(serv.Get(id));
m.def = def;
return PartialView("~/Views/Config/Edit.cshtml", m);
return PartialView("~/Views/Lookup/Edit.cshtml", m);
}
/// <summary>
///
Expand Down

0 comments on commit 72ec34f

Please sign in to comment.