Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @using System.Text.Json;
- @model List<Web.Mediator.Arguments.BuyRequestArguments>
- @{
- ViewData["Title"] = "Cart";
- }
- @section Styles {
- <link rel="stylesheet" href="~/css/cart.css" />
- }
- <form asp-controller="Cart" asp-action="Save">
- <div class="container py-3">
- <div class="row d-flex justify-content-center align-items-center">
- <div class="bg-white">
- <div class="row">
- @*Go to shop link start*@
- <div class="pt-5 ">
- <h6 class="mb-0 pt-2 ps-5">
- <a asp-controller="Cars" asp-action="Index" class="text-body">
- <span class="link-danger"><i class="fas fa-long-arrow-alt-left me-2"></i>Back to shop</span>
- </a>
- </h6>
- </div>
- @*Go to shop link end*@
- <div class="col-lg-8 pb-4">
- <div class="px-5 pt-3 pb-2">
- @*Cart items table head start*@
- <div class="d-flex justify-content-between align-items-center mb-5">
- <h2 class="fw-bold mb-0 text-black">Shopping Cart</h2>
- <h4 class="mb-0 text-muted">@ViewBag.TotalCount items</h4>
- </div>
- <hr class="my-4">
- @*Cart items table head end*@
- @*Cart items start*@
- @if (Model != null)
- @for (int i = 0; i < Model.Count; i++)
- {
- @*@await Html.PartialAsync("Partials/_CartItem")*@
- <div class="row mb-4 d-flex justify-content-between align-items-center">
- @*Product name start*@
- <div class="col-12 col-md-5 text-center">
- <a>
- <h6 class="text-black lg-font">@Model[i].Mark @Model[i].Model</h6>
- </a>
- </div>
- @*Product name end*@
- <div class="col-12 col-md-3 text-center">
- <h6 class="lg-font">$@Model[i].Price</h6>
- </div>
- @*Count*@
- <input asp-for="@Model[i].Count" class="cinput" id="@i" onchange="updatePrice(@Model[i].Price, @ViewBag.TotalPrice, @i)" type="number" min="1" value="1"/>
- <script>
- function updatePrice(thisprice, totalprice, id) {
- var inVal = document.getElementById(id).value;
- totalprice = totalprice - thisprice;
- document.getElementById("total").innerHTML = "$" + (inVal*thisprice + totalprice);
- }
- </script>
- @*Remove cart item button start*@
- <div class="col-md-1 col-lg-1 col-xl-1 order-first order-md-2 text-end">
- <a asp-controller="Cart" asp-action="Delete" asp-route-id=@i class="link-danger" style="font-size: 1.5rem;"><i class="fas fa-times"></i></a>
- </div>
- @*Remove cart item button end*@
- </div>
- <hr class="my-4">
- }
- @*Cart items end*@
- </div>
- </div>
- @*Purchase information start*@
- <div class="col-lg-4 bg-grey">
- <div class="row p-5 pt-2">
- <h2 class="fw-bold mb-4 mt-2">Summary</h2>
- <hr class="my-4">
- <div class="d-flex justify-content-between mb-2">
- <h5 class="text-uppercase">Total price</h5>
- <h5 id="total">$@ViewBag.TotalPrice</h5>
- </div>
- ---------------------------САБМИТ, НО НЕ САБМИТИТ---------------------------
- <button type="submit" class="btn btn-danger fw-bold" style="width: 100%;" asp-route-list="@JsonSerializer.Serialize(Model)">Confirm</button>
- -------------------------------------------------------------------------------
- </div>
- </div>
- @*Purchase information end*@
- </div>
- </div>
- </div>
- </div>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement