This commit is contained in:
@@ -96,7 +96,7 @@ namespace Aberwyn.Controllers
|
|||||||
order.CustomerName = customerName.Trim();
|
order.CustomerName = customerName.Trim();
|
||||||
order.PizzaName = pizzaName.Trim();
|
order.PizzaName = pizzaName.Trim();
|
||||||
order.IngredientsJson = ingredients;
|
order.IngredientsJson = ingredients;
|
||||||
order.Status = "Ej bekräftad"; // återställ status om du vill
|
order.Status = "Unconfirmed";// återställ status om du vill
|
||||||
_context.SaveChanges();
|
_context.SaveChanges();
|
||||||
|
|
||||||
TempData["Success"] = $"Din beställning har uppdaterats!";
|
TempData["Success"] = $"Din beställning har uppdaterats!";
|
||||||
@@ -110,7 +110,7 @@ namespace Aberwyn.Controllers
|
|||||||
CustomerName = customerName.Trim(),
|
CustomerName = customerName.Trim(),
|
||||||
PizzaName = pizzaName.Trim(),
|
PizzaName = pizzaName.Trim(),
|
||||||
IngredientsJson = ingredients,
|
IngredientsJson = ingredients,
|
||||||
Status = "Ej bekräftad",
|
Status = "Unconfirmed",
|
||||||
OrderedAt = DateTime.Now
|
OrderedAt = DateTime.Now
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -139,11 +139,11 @@ namespace Aberwyn.Controllers
|
|||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
ViewBag.ActiveOrders = allOrders
|
ViewBag.ActiveOrders = allOrders
|
||||||
.Where(o => o.Status != "Klar")
|
.Where(o => o.Status != "Finished")
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
ViewBag.CompletedOrders = allOrders
|
ViewBag.CompletedOrders = allOrders
|
||||||
.Where(o => o.Status == "Klar")
|
.Where(o => o.Status == "Finished")
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
return View();
|
return View();
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace Aberwyn.Models
|
|||||||
|
|
||||||
public string? IngredientsJson { get; set; } // lista i JSON-form
|
public string? IngredientsJson { get; set; } // lista i JSON-form
|
||||||
|
|
||||||
public string Status { get; set; } = "Ej bekräftad"; // "Ej bekräftad", "Bekräftad", "Klar"
|
public string Status { get; set; } = "Unconfirmed"; // "Ej bekräftad", "Bekräftad", "Klar"
|
||||||
|
|
||||||
public DateTime OrderedAt { get; set; } = DateTime.Now;
|
public DateTime OrderedAt { get; set; } = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,12 +88,13 @@
|
|||||||
ingredients = order.IngredientsJson.Split('\n').ToList();
|
ingredients = order.IngredientsJson.Split('\n').ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
var cardClass = order.Status switch
|
var cardClass = order.Status switch
|
||||||
{
|
{
|
||||||
"Bekräftad" => "border-warning",
|
"Confirmed" => "border-warning",
|
||||||
"Klar" => "border-success",
|
"Ready" => "border-success",
|
||||||
_ => "border-info"
|
_ => "border-info"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
<div class="card @cardClass">
|
<div class="card @cardClass">
|
||||||
<div class="card-header">@order.CustomerName</div>
|
<div class="card-header">@order.CustomerName</div>
|
||||||
@@ -109,16 +110,17 @@
|
|||||||
<input type="hidden" name="id" value="@order.Id" />
|
<input type="hidden" name="id" value="@order.Id" />
|
||||||
<input type="hidden" name="ingredientsJson" value='@System.Text.Json.JsonSerializer.Serialize(ingredients)' />
|
<input type="hidden" name="ingredientsJson" value='@System.Text.Json.JsonSerializer.Serialize(ingredients)' />
|
||||||
<div class="d-flex gap-2">
|
<div class="d-flex gap-2">
|
||||||
@if (order.Status == "Ej bekräftad")
|
@if (order.Status == "Unconfirmed")
|
||||||
{
|
{
|
||||||
<input type="hidden" name="status" value="Bekräftad" />
|
<input type="hidden" name="status" value="Confirmed" />
|
||||||
<button type="submit" class="btn btn-sm btn-outline-primary">Bekräfta</button>
|
<button type="submit" class="btn btn-sm btn-outline-primary">Confirm</button>
|
||||||
}
|
}
|
||||||
else if (order.Status == "Bekräftad")
|
else if (order.Status == "Confirmed")
|
||||||
{
|
{
|
||||||
<input type="hidden" name="status" value="Klar" />
|
<input type="hidden" name="status" value="Finished" />
|
||||||
<button type="submit" class="btn btn-sm btn-outline-success">✔ Klar</button>
|
<button type="submit" class="btn btn-sm btn-outline-success">✔ Mark as Finished</button>
|
||||||
}
|
}
|
||||||
|
|
||||||
<button type="submit" formaction="@Url.Action("UpdatePizzaOrder", new { status = "Neka", id = order.Id })" class="btn btn-sm btn-outline-danger">Neka</button>
|
<button type="submit" formaction="@Url.Action("UpdatePizzaOrder", new { status = "Neka", id = order.Id })" class="btn btn-sm btn-outline-danger">Neka</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
Reference in New Issue
Block a user