Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Foundation/Assets/js/common/foundation.commerce.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import B2bUsersOrganization from "Features/MyOrganization/Users/b2b-users-organi
import Stores from "Features/Stores/stores";
import People from "Features/People/people";
import Market from "Features/Markets/market";
import QuickOrderBlock from "Features/MyOrganization/QuickOrderBlock/quick-order-block";

export default class FoundationCommerce {
init() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@using Foundation.Features.MyOrganization.QuickOrderBlock

@model QuickOrderBlock
@model QuickOrderViewModel

<h3>@Html.PropertyFor(m => m.Title)</h3>
<h3>@Html.PropertyFor(m => m.CurrentBlock.Title)</h3>
<div class="row">
<div class="col-12">
@Html.PropertyFor(m => m.MainBody)
@Html.PropertyFor(m => m.CurrentBlock.MainBody)
</div>
</div>

Expand All @@ -24,7 +24,7 @@
@Html.TextBoxFor(x => x.ProductsList[i].ProductName, new { @class = "form-control square-box", @readonly = "readonly" })
</div>
<div class="form-group col-xs-12 col-sm-12 col-md-6 col-lg-2">
@Html.TextBoxFor(x => x.ProductsList[i].Sku, new { @class = "form-control square-box", required = "required", @class = "position-relative;" })
@Html.TextBoxFor(x => x.ProductsList[i].Sku, new { @class = "form-control square-box position-relative", required = "required" })
</div>
<div class="form-group col-xs-12 col-sm-12 col-md-6 col-lg-2">
@Html.TextBoxFor(x => x.ProductsList[i].UnitPrice, "{0:0.00}", new { @class = "form-control square-box", @readonly = "readonly" })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
using EPiServer.Core;
using EPiServer.DataAbstraction;
using EPiServer.DataAnnotations;
using EPiServer.Security;
using Foundation.Features.Shared;
using Foundation.Infrastructure;
using Mediachase.Commerce.Security;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace Foundation.Features.MyOrganization.QuickOrderBlock
Expand All @@ -24,23 +21,5 @@ public class QuickOrderBlock : FoundationBlockData
[CultureSpecific]
[Display(Name = "Main body", GroupName = SystemTabNames.Content, Order = 10)]
public virtual XhtmlString MainBody { get; set; }

[Ignore]
[Display(Name = "Product list", Order = 20)]
public List<QuickOrderProductViewModel> ProductsList { get; set; }

[Ignore]
[Display(Name = "Returned messages", Order = 30)]
public List<string> ReturnedMessages { get; set; }

[Ignore]
public bool HasOrganization
{
get
{
var contact = PrincipalInfo.CurrentPrincipal.GetCustomerContact();
return contact?.OwnerId != null;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ public QuickOrderBlockController(
}
public override ActionResult Index(QuickOrderBlock currentBlock)
{
currentBlock.ReturnedMessages = TempData["messages"] as List<string>;
currentBlock.ProductsList = TempData["products"] as List<QuickOrderProductViewModel>;
return PartialView(currentBlock);
var model = new QuickOrderViewModel(currentBlock);

model.ReturnedMessages = TempData["messages"] as List<string>;
model.ProductsList = TempData["products"] as List<QuickOrderProductViewModel>;
return PartialView(model);
}

[HttpPost]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using EPiServer.Security;
using Mediachase.Commerce.Security;
using System.Collections.Generic;

namespace Foundation.Features.MyOrganization.QuickOrderBlock
{
public class QuickOrderViewModel
{
public QuickOrderBlock CurrentBlock { get; set; }
public List<QuickOrderProductViewModel> ProductsList { get; set; }
public List<string> ReturnedMessages { get; set; }
public bool HasOrganization
{
get
{
var contact = PrincipalInfo.CurrentPrincipal.GetCustomerContact();
return contact?.OwnerId != null;
}
}

public QuickOrderViewModel(QuickOrderBlock currentBlock)
{
CurrentBlock = currentBlock;
ProductsList = new List<QuickOrderProductViewModel>();
ReturnedMessages = new List<string>();
}
}
}
3 changes: 1 addition & 2 deletions src/Foundation/Features/StandardPage/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@
}
else if (!ContentReference.IsNullOrEmpty(Model.CurrentContent.BackgroundImage))
{
<div class="standard-page__background" style="background:@Model.CurrentContent.BackgroundColor;opacity:@(Model.CurrentContent.BackgroundOpacity?.ToString("N") ?? "1");"></div>
<img class="standard-page__banner lazyload" src="@Url.ContentUrl(Model.CurrentContent.BackgroundImage)?width=1440&format=webp" />
<div class="hero__gradient">
</div>
<div class="standard-page__background" style="background:@Model.CurrentContent.BackgroundColor;opacity:@(Model.CurrentContent.BackgroundOpacity?.ToString("N") ?? "1");">
</div>
}
else if (!ContentReference.IsNullOrEmpty(Model.CurrentContent.PageImage))
{
Expand Down
1 change: 1 addition & 0 deletions src/Foundation/Features/StandardPage/_standard-page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
}

&__background {
position: absolute;
left: 0;
top: 0;
height: 100%;
Expand Down
1 change: 1 addition & 0 deletions src/Foundation/Foundation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,7 @@
<Compile Include="Features\MyOrganization\Organization\OrganizationPage.cs" />
<Compile Include="Features\MyOrganization\Organization\OrganizationPageViewModel.cs" />
<Compile Include="Features\MyOrganization\Organization\OrganizationService.cs" />
<Compile Include="Features\MyOrganization\QuickOrderBlock\QuickOrderViewModel.cs" />
<Compile Include="Features\MyOrganization\QuickOrderPage\QuickOrderData.cs" />
<Compile Include="Features\MyOrganization\QuickOrderPage\QuickOrderPage.cs" />
<Compile Include="Features\MyOrganization\QuickOrderPage\QuickOrderPageViewModel.cs" />
Expand Down