Mobilversion:

Einträge ohne Uhrzeit nehmen new Date() anstelle des 01.01.1900.
This commit is contained in:
Lyndon Jetten
2020-09-15 16:03:49 +02:00
parent af424556f2
commit bd7350106c
4 changed files with 30 additions and 8 deletions

View File

@@ -62,9 +62,30 @@ namespace BeWoPlanerMobil.Controllers
[HttpPost]
public ActionResult CreateServiceOverview(FormCollection formCollection)
{
var test1 = formCollection["CustomerSelect"];
var test2 = formCollection["MonthSelect"];
var test3 = formCollection["YearSelect"];
if(Model == null)
{
return Logout();
}
var customerOidString = formCollection["SelectedCustomerOid"];
var monthString = formCollection["SelectedMonth"];
var yearString = formCollection["SelectedYear"];
var isCustomerOidSuccessful = long.TryParse(customerOidString, out var customerOid);
var isMonthSuccessful = int.TryParse(monthString, out var month);
var isYearSuccessful = int.TryParse(yearString, out var year);
if(!isCustomerOidSuccessful || !isMonthSuccessful || !isYearSuccessful)
{
return Report();
}
var selectedCustomer = Model.Customers.FirstOrDefault(customer => customer.CustomerOid == customerOid);
Model.SelectedCustomer = selectedCustomer;
Model.SelectedYear = year;
Model.SelectedMonth = month;
return RedirectToActionPermanent("Report");
}

View File

@@ -9,7 +9,8 @@ namespace BeWoPlanerMobil.Models
{
public class ReportModel : AbstractModel
{
[Display(Name = "Klient")] public long? SelectedCustomerOid => SelectedCustomer?.CustomerOid;
[Display(Name = "Klient")]
public long? SelectedCustomerOid => SelectedCustomer?.CustomerOid;
public CompactCustomerDC SelectedCustomer { get; set; }

View File

@@ -506,7 +506,7 @@ function getStartAndEndDate() {
// Bei leeren Start- und Endfeldern. Muss ein Dummydate zurückgeben,
// damit das Speichern ohne Angabe der Start- und Endzeit möglich ist.
if($("#start-time").val().length === 0 || $("#end-time").val().length === 0) {
var dummyDate = moment(new Date(0, 0, 1));
var dummyDate = moment(new Date());
return [dummyDate, dummyDate];
}

View File

@@ -24,7 +24,7 @@ Info:
<div class="col-md">
<div class="form-group mb-1">
@Html.LabelFor(m => m.SelectedCustomerOid)
@Html.DropDownListFor(m => m.SelectedCustomerOid, Model.CustomerListItems, new { id = "customers-drop-down", @class = "form-control", name = "CustomerSelect" })
@Html.DropDownListFor(m => m.SelectedCustomerOid, Model.CustomerListItems, new { id = "customers-drop-down", @class = "form-control" })
</div>
</div>
</div>
@@ -35,13 +35,13 @@ Info:
<div class="col-md">
<div class="form-group mb-1">
@Html.LabelFor(m => m.SelectedMonth)
@Html.DropDownListFor(m => m.SelectedMonth, Model.Months, new { @class = "form-control", name = "MonthSelect" })
@Html.DropDownListFor(m => m.SelectedMonth, Model.Months, new { @class = "form-control" })
</div>
</div>
<div class="col-md">
<div class="form-group mb-1">
@Html.LabelFor(m => m.SelectedYear)
@Html.DropDownListFor(m => m.SelectedYear, Model.Years, new { @class = "form-control", name = "YearSelect" })
@Html.DropDownListFor(m => m.SelectedYear, Model.Years, new { @class = "form-control" })
</div>
</div>
</div>