Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
Grand.Web.Vendor - Code cleanup
support67abfd1934bb
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Home/AccessDenied.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Home/AccessDenied.cshtmlindex 8185e8cec..4cc19dcd6 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Home/AccessDenied.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Home/AccessDenied.cshtml@@ -1,8 +1,8 @@-<input id="active-menu-item" type="hidden" value="/Vendor" />+<input id="active-menu-item" type="hidden" value="/Vendor"/><div class="row"><div class="col-md-12"><div class="x_panel light form-fit">- <vc:vendor-widget widget-zone="vendor_security_access_denied_top" additional-data="null" />+ <vc:vendor-widget widget-zone="vendor_security_access_denied_top" additional-data="null"/><div class="x_title"><div class="caption level-caption"><i class="fa fa-list-alt"></i>@@ -14,7 +14,7 @@@Loc["Vendor.AccessDenied.Description"]</div></div>- <vc:vendor-widget widget-zone="vendor_security_access_denied_bottom" additional-data="null" />+ <vc:vendor-widget widget-zone="vendor_security_access_denied_bottom" additional-data="null"/></div></div></div>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Home/Statistics.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Home/Statistics.cshtmlindex eea790d64..d9833f3db 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Home/Statistics.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Home/Statistics.cshtml@@ -20,7 +20,7 @@</div><div class="content">- <vc:vendor-widget widget-zone="vendor_dashboard_statistics_before" />+ <vc:vendor-widget widget-zone="vendor_dashboard_statistics_before"/><div class="row"><div class="col-md-12"><div class="row">@@ -51,5 +51,5 @@</div></div></div>- <vc:vendor-widget widget-zone="vendor_dashboard_statistics_after" />+ <vc:vendor-widget widget-zone="vendor_dashboard_statistics_after"/></div>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Login/Index.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Login/Index.cshtmlindex 94fad1d60..afad15922 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Login/Index.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Login/Index.cshtml@@ -1,73 +1,75 @@-@model Grand.Web.Vendor.Models.Common.LoginModel+@model LoginModel@{//page titleLayout = Constants.LayoutVendorLogin;}<form asp-route="VendorLogin" asp-area="@Constants.AreaVendor" method="post">- <div class="card col-xl-6 col-lg-8 col-md-10 col-12">- <h5 class="card-header"><strong>@Loc["Vendor.Login.Title"]</strong></h5>- <div class="card-body">- <div class="row">- <div asp-validation-summary="All" class="message-error text-center"></div>- <div class="col-12 form-group mb-0">- @if (Model.UsernamesEnabled)- {- <div class="form-group row">- <div class="col-lg-3 col-12 d-flex align-items-start justify-content-sm-start">- <label asp-for="Username" class="h5 m-0">@Loc["Vendor.Login.UserName"]:</label>- </div>- <div class="col-lg-9 col-12">- <input asp-for="Username" class="form-control username" autofocus="autofocus" />- <span asp-validation-for="Username"></span>- </div>+ <div class="card col-xl-6 col-lg-8 col-md-10 col-12">+ <h5 class="card-header">+ <strong>@Loc["Vendor.Login.Title"]</strong>+ </h5>+ <div class="card-body">+ <div class="row">+ <div asp-validation-summary="All" class="message-error text-center"></div>+ <div class="col-12 form-group mb-0">+ @if (Model.UsernamesEnabled)+ {+ <div class="form-group row">+ <div class="col-lg-3 col-12 d-flex align-items-start justify-content-sm-start">+ <label asp-for="Username" class="h5 m-0">@Loc["Vendor.Login.UserName"]:</label></div>- }- else- {- <div class="form-group row">- <div class="col-lg-3 col-12 d-flex align-items-start justify-content-start">- <label asp-for="Email" class="h5 m-0">@Loc["Vendor.Login.Email"]:</label>- </div>- <div class="col-lg-9 col-12">- <input asp-for="Email" class="form-control email" autofocus="autofocus" />- <span asp-validation-for="Email"></span>- </div>+ <div class="col-lg-9 col-12">+ <input asp-for="Username" class="form-control username" autofocus="autofocus"/>+ <span asp-validation-for="Username"></span></div>- }+ </div>+ }+ else+ {<div class="form-group row">- <div class="col-lg-3 col-12 d-flex align-items-center justify-content-start">- <label asp-for="Password" class="h5 m-0">@Loc["Vendor.Login.Password"]:</label>+ <div class="col-lg-3 col-12 d-flex align-items-start justify-content-start">+ <label asp-for="Email" class="h5 m-0">@Loc["Vendor.Login.Email"]:</label></div><div class="col-lg-9 col-12">- <input asp-for="Password" class="form-control password" autocomplete="off" />- <span asp-validation-for="Password"></span>+ <input asp-for="Email" class="form-control email" autofocus="autofocus"/>+ <span asp-validation-for="Email"></span></div></div>- <div class="inputs d-flex flex-sm-row flex-column justify-content-center">- <label class="custom-control custom-checkbox">- <input class="custom-control-input" asp-for="RememberMe" />- <input class="custom-control-label" name="RememberMe" type="hidden" value="false">- <span class="custom-control-label"></span>- <span class="custom-control-description">@Loc["Vendor.Login.RememberMe"]</span>- </label>- <span class="ml-3 forgot-password">- <a asp-route="PasswordRecovery">@Loc["Vendor.Login.ForgotPassword"]</a>- </span>+ }+ <div class="form-group row">+ <div class="col-lg-3 col-12 d-flex align-items-center justify-content-start">+ <label asp-for="Password" class="h5 m-0">@Loc["Vendor.Login.Password"]:</label>+ </div>+ <div class="col-lg-9 col-12">+ <input asp-for="Password" class="form-control password" autocomplete="off"/>+ <span asp-validation-for="Password"></span></div>- @if (Model.DisplayCaptcha)- {- <div class="captcha-box">- <captcha />- </div>- }</div>+ <div class="inputs d-flex flex-sm-row flex-column justify-content-center">+ <label class="custom-control custom-checkbox">+ <input class="custom-control-input" asp-for="RememberMe"/>+ <input class="custom-control-label" name="RememberMe" type="hidden" value="false">+ <span class="custom-control-label"></span>+ <span class="custom-control-description">@Loc["Vendor.Login.RememberMe"]</span>+ </label>+ <span class="ml-3 forgot-password">+ <a asp-route="PasswordRecovery">@Loc["Vendor.Login.ForgotPassword"]</a>+ </span>+ </div>+ @if (Model.DisplayCaptcha)+ {+ <div class="captcha-box">+ <captcha/>+ </div>+ }</div></div>- <div class="card-footer px-0">- <div class="buttons">- <input class="btn btn-info login-button px-5" type="submit" value="@Loc["Vendor.Login.LoginButton"]" />- </div>+ </div>+ <div class="card-footer px-0">+ <div class="buttons">+ <input class="btn btn-info login-button px-5" type="submit" value="@Loc["Vendor.Login.LoginButton"]"/></div></div>-</form>+ </div>+</form>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Login/TwoFactorAuthorization.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Login/TwoFactorAuthorization.cshtmlindex 2b5a825ec..ba563d2f8 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Login/TwoFactorAuthorization.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Login/TwoFactorAuthorization.cshtml@@ -3,11 +3,12 @@Layout = Constants.LayoutVendorLogin;//titlepagebuilder.AddTitleParts(Loc["Vendor.Login.TwoFactor"]);-}<form asp-action="TwoFactorAuthorization" asp-controller="Login" asp-area="@Constants.AreaVendor" method="post"><div class="card col-xl-6 col-lg-8 col-md-10 col-12">- <h5 class="card-header"><strong>@Loc["Vendor.Login.TwoFactor.EnterCode"]</strong></h5>+ <h5 class="card-header">+ <strong>@Loc["Vendor.Login.TwoFactor.EnterCode"]</strong>+ </h5><div class="card-body"><div class="row"><div asp-validation-summary="All" class="col-12 justify-content-around text-danger"></div>@@ -17,7 +18,7 @@<label name="token" class="h5 m-0">@Loc["Vendor.Login.TwoFactor.DigitCode"]</label></div><div class="col-lg-9 col-12">- <input name="token" type="text" class="form-control" autofocus />+ <input name="token" type="text" class="form-control" autofocus/></div></div></div>@@ -25,7 +26,7 @@</div><div class="card-footer"><div class="buttons">- <input class="btn btn-info login-button px-5" type="submit" value="@Loc["Vendor.Login.TwoFactor.SendCode"]" />+ <input class="btn btn-info login-button px-5" type="submit" value="@Loc["Vendor.Login.TwoFactor.SendCode"]"/></div></div></div>diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/Edit.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/Edit.cshtmlindex 4bbb8e037..db68623be 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/Edit.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/Edit.cshtml@@ -4,7 +4,7 @@ViewBag.Title = Loc["Vendor.Orders.MerchandiseReturns.EditMerchandiseReturnDetails"];}<form asp-area="@Constants.AreaVendor" asp-controller="MerchandiseReturn" asp-action="Edit" method="post">-+<div class="row"><div class="col-md-12"><div class="x_panel light form-fit">@@ -12,22 +12,30 @@<div class="caption"><i class="fa fa-truck"></i>@Loc["Vendor.Orders.MerchandiseReturns.EditMerchandiseReturnDetails"]- <small><i class="fa fa-arrow-circle-left"></i> @Html.ActionLink(Loc["Vendor.Orders.MerchandiseReturns.BackToList"], "List")</small>+ <small>+ <i class="fa fa-arrow-circle-left"></i> @Html.ActionLink(Loc["Vendor.Orders.MerchandiseReturns.BackToList"], "List")+ </small></div><div class="actions"><div class="btn-group btn-group-devided">- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Vendor.Common.Save"] </button>- <button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @Loc["Vendor.Common.SaveContinue"] </button>- <span id="merchandisereturn-delete" class="btn red"><i class="fa fa-trash-o"></i> @Loc["Vendor.Common.Delete"]</span>- <vc:vendor-widget widget-zone="vendor_merchandisereturn_details_buttons" additional-data="Model" />+ <button class="btn btn-success" type="submit" name="save">+ <i class="fa fa-check"></i> @Loc["Vendor.Common.Save"]+ </button>+ <button class="btn btn-success" type="submit" name="save-continue">+ <i class="fa fa-check-circle"></i> @Loc["Vendor.Common.SaveContinue"]+ </button>+ <span id="merchandisereturn-delete" class="btn red">+ <i class="fa fa-trash-o"></i> @Loc["Vendor.Common.Delete"]+ </span>+ <vc:vendor-widget widget-zone="vendor_merchandisereturn_details_buttons" additional-data="Model"/></div></div></div><div class="x_content form">- <partial name="Partials/CreateOrUpdate" model="Model" />+ <partial name="Partials/CreateOrUpdate" model="Model"/></div></div></div></div></form>-<admin-delete-confirmation button-id="merchandisereturn-delete"/>+<admin-delete-confirmation button-id="merchandisereturn-delete"/>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/List.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/List.cshtmlindex 84e3332d9..b1495b5a4 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/List.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/List.cshtml@@ -5,7 +5,7 @@ViewBag.Title = Loc["Vendor.Orders.MerchandiseReturns"];}<form asp-area="@Constants.AreaVendor" asp-controller="MerchandiseReturn" asp-action="List" method="post">-+<div class="row"><div class="col-md-12"><div class="x_panel light form-fit popup-window">@@ -14,7 +14,7 @@<i class="fa fa-truck"></i>@Loc["Vendor.Orders.MerchandiseReturns"]</div>- <vc:vendor-widget widget-zone="vendor_merchandisereturn_list_buttons" additional-data="null" />+ <vc:vendor-widget widget-zone="vendor_merchandisereturn_list_buttons" additional-data="null"/></div><div class="x_content form"><div class="form-horizontal">@@ -23,17 +23,17 @@<div class="row align-items-end"><div class="col-md-4 col-ms-12 col-12"><div class="form-group mb-0">- <admin-label asp-for="SearchCustomerEmail" class="control-label" />- <admin-input asp-for="SearchCustomerEmail" />+ <admin-label asp-for="SearchCustomerEmail" class="control-label"/>+ <admin-input asp-for="SearchCustomerEmail"/></div></div><div class="col-md-4 col-ms-12 col-12"><div class="form-group mb-0">- <admin-label asp-for="GoDirectlyToId" class="control-label" />+ <admin-label asp-for="GoDirectlyToId" class="control-label"/><div class="input-group mb-0" style="text-align:left">- <admin-input asp-for="GoDirectlyToId" />+ <admin-input asp-for="GoDirectlyToId"/><span class="input-group-append">- <input type="submit" id="go-to-merchandisereturn" asp-action="GoToId" name="go-to-merchandisereturn" class="btn default" value="@Loc["Vendor.Common.Go"]" />+ <input type="submit" id="go-to-merchandisereturn" asp-action="GoToId" name="go-to-merchandisereturn" class="btn default" value="@Loc["Vendor.Common.Go"]"/></span></div></div>@@ -56,27 +56,27 @@<div class="collapse" id="filterCollapse"><div class="drop-filters-container w-100"><div class="form-group">- <admin-label asp-for="StartDate" class="col-sm-3 control-label" />+ <admin-label asp-for="StartDate" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="StartDate" />+ <admin-input asp-for="StartDate"/></div></div><div class="form-group">- <admin-label asp-for="EndDate" class="col-sm-3 control-label" />+ <admin-label asp-for="EndDate" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="EndDate" />+ <admin-input asp-for="EndDate"/></div></div><div class="form-group">- <admin-label asp-for="SearchCustomerEmail" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchCustomerEmail" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchCustomerEmail" />+ <admin-input asp-for="SearchCustomerEmail"/></div></div><div class="form-group">- <admin-label asp-for="SearchMerchandiseReturnStatusId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchMerchandiseReturnStatusId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="SearchMerchandiseReturnStatusId" asp-items="Model.MerchandiseReturnStatus" />+ <admin-select asp-for="SearchMerchandiseReturnStatusId" asp-items="Model.MerchandiseReturnStatus"/></div></div></div>@@ -86,13 +86,13 @@<div class="x_content form"><div class="x_content"><div id="merchandisereturns-grid"></div>- </div>+ </div></div></div></div></div></form>- <script>+<script>$(document).ready(function() {$("#merchandisereturns-grid").kendoGrid({dataSource: {@@ -171,7 +171,7 @@});</script>- <script>+<script>function additionalData() {var data = {SearchMerchandiseReturnStatusId: $('#@Html.IdFor(model => model.SearchMerchandiseReturnStatusId)').val(),diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/Partials/CreateOrUpdate.TabAddress.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/Partials/CreateOrUpdate.TabAddress.cshtmlindex d37ed1428..04241ccd3 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/Partials/CreateOrUpdate.TabAddress.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/Partials/CreateOrUpdate.TabAddress.cshtml@@ -1,15 +1,15 @@@model MerchandiseReturnModel<div class="form-horizontal">- <vc:vendor-widget widget-zone="vendor_merchandisereturn_tab_address_top" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_merchandisereturn_tab_address_top" additional-data="Model"/><div class="form-body">@if (Model.PickupAddress != null){<div class="form-group">- <admin-label asp-for="PickupAddress" />- <br />- <admin-input asp-for="PickupAddress" asp-template="Address" />+ <admin-label asp-for="PickupAddress"/>+ <br/>+ <admin-input asp-for="PickupAddress" asp-template="Address"/></div>}</div>- <vc:vendor-widget widget-zone="vendor_merchandisereturn_tab_address_bottom" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_merchandisereturn_tab_address_bottom" additional-data="Model"/></div>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/Partials/CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/Partials/CreateOrUpdate.TabInfo.cshtmlindex 1c7abbea3..5483669bc 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/Partials/CreateOrUpdate.TabInfo.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/Partials/CreateOrUpdate.TabInfo.cshtml@@ -3,28 +3,28 @@@inject OrderSettings orderSettings<div class="form-horizontal">- <vc:vendor-widget widget-zone="vendor_merchandisereturn_tab_info_top" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_merchandisereturn_tab_info_top" additional-data="Model"/><div class="form-body"><div class="form-group">- <admin-label asp-for="ReturnNumber" />+ <admin-label asp-for="ReturnNumber"/><div class="col-md-9 col-sm-9"><label class="control-label">@Model.ReturnNumber</label></div></div><div class="form-group">- <admin-label asp-for="ExternalId" />+ <admin-label asp-for="ExternalId"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="ExternalId" />+ <admin-input asp-for="ExternalId"/></div></div><div class="form-group">- <admin-label asp-for="OrderId" />+ <admin-label asp-for="OrderId"/><div class="col-md-9 col-sm-9"><label class="control-label">@Html.ActionLink(Loc["Vendor.Common.View"], "Edit", "Order", new { id = Model.OrderId }, new { })</label></div></div><div class="form-group">- <admin-label asp-for="CustomerId" />+ <admin-label asp-for="CustomerId"/><div class="col-md-9 col-sm-9"><label class="control-label">@Html.DisplayFor(model => model.CustomerInfo)@@ -32,21 +32,21 @@</div></div><div class="form-group">- <admin-label asp-for="MerchandiseReturnStatusId" />+ <admin-label asp-for="MerchandiseReturnStatusId"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="MerchandiseReturnStatusId" asp-items="((MerchandiseReturnStatus)Model.MerchandiseReturnStatusId).ToSelectList(Context)" />+ <admin-select asp-for="MerchandiseReturnStatusId" asp-items="((MerchandiseReturnStatus)Model.MerchandiseReturnStatusId).ToSelectList(Context)"/><span asp-validation-for="MerchandiseReturnStatusId"></span></div></div><div class="form-group">- <admin-label asp-for="CustomerComments" />+ <admin-label asp-for="CustomerComments"/><div class="col-md-9 col-sm-9"><admin-textarea asp-for="CustomerComments"></admin-textarea><span asp-validation-for="CustomerComments"></span></div></div><div class="form-group">- <admin-label asp-for="StaffNotes" />+ <admin-label asp-for="StaffNotes"/><div class="col-md-9 col-sm-9"><admin-textarea asp-for="StaffNotes"></admin-textarea><span asp-validation-for="StaffNotes"></span>@@ -55,23 +55,23 @@@if (orderSettings.MerchandiseReturns_AllowToSpecifyPickupDate){<div class="form-group">- <admin-label asp-for="PickupDate" />+ <admin-label asp-for="PickupDate"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="PickupDate" />+ <admin-input asp-for="PickupDate"/></div></div>}<div class="form-group">- <admin-label asp-for="CreatedOn" />+ <admin-label asp-for="CreatedOn"/><div class="col-md-9 col-sm-9"><label class="control-label">@Html.DisplayFor(model => model.CreatedOn)</label></div></div><div class="form-group">- <admin-label asp-for="NotifyCustomer" />+ <admin-label asp-for="NotifyCustomer"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="NotifyCustomer" />+ <admin-input asp-for="NotifyCustomer"/><div class="control__indicator"></div></label><span asp-validation-for="NotifyCustomer"></span>@@ -81,7 +81,7 @@<div id="products-grid"></div></div></div>- <vc:vendor-widget widget-zone="vendor_merchandisereturn_tab_info_bottom" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_merchandisereturn_tab_info_bottom" additional-data="Model"/></div>diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/Partials/CreateOrUpdate.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/Partials/CreateOrUpdate.cshtmlindex db52e4f3a..71b2e6112 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/Partials/CreateOrUpdate.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/Partials/CreateOrUpdate.cshtml@@ -2,13 +2,13 @@@inject OrderSettings orderSettings<div asp-validation-summary="All"></div>-<input asp-for="Id" type="hidden" />+<input asp-for="Id" type="hidden"/><admin-tabstrip name="merchandisereturn-edit"><items><tabstrip-item text="@Loc["Vendor.Orders.MerchandiseReturns.Info"]" tab-index="0"><content><div>- <partial name="Partials/CreateOrUpdate.TabInfo" model="Model" />+ <partial name="Partials/CreateOrUpdate.TabInfo" model="Model"/></div></content></tabstrip-item>@@ -17,7 +17,7 @@<tabstrip-item text="@Loc["Vendor.Orders.MerchandiseReturns.Address"]" tab-index="1"><content><div>- <partial name="Partials/CreateOrUpdate.TabAddress" model="Model" />+ <partial name="Partials/CreateOrUpdate.TabAddress" model="Model"/></div></content></tabstrip-item>@@ -25,10 +25,10 @@<tabstrip-item text="@Loc["Vendor.Orders.MerchandiseReturns.MerchandiseReturnNotes"]" tab-index="2"><content><div>- <partial name="Partials/MerchandiseReturnNotes" model="Model" />+ <partial name="Partials/MerchandiseReturnNotes" model="Model"/></div></content></tabstrip-item>- <vc:vendor-widget widget-zone="vendor_merchandisereturn_details_tabs" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_merchandisereturn_details_tabs" additional-data="Model"/></items></admin-tabstrip>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/Partials/MerchandiseReturnNotes.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/Partials/MerchandiseReturnNotes.cshtmlindex e86746a79..6e63698a8 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/Partials/MerchandiseReturnNotes.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/MerchandiseReturn/Partials/MerchandiseReturnNotes.cshtml@@ -1,10 +1,10 @@@model MerchandiseReturnModel<div class="panel panel-default">- <vc:vendor-widget widget-zone="vendor_merchandisereturn_details_notes_top" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_merchandisereturn_details_notes_top" additional-data="Model"/><div class="panel-body"><div id="merchandisereturnnotes-grid"></div></div>- <vc:vendor-widget widget-zone="vendor_merchandisereturn_details_notes_bottom" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_merchandisereturn_details_notes_bottom" additional-data="Model"/></div><script>$(document).ready(function () {@@ -100,17 +100,17 @@<div class="form-horizontal"><div class="form-body"><div class="form-group">- <admin-label asp-for="AddMerchandiseReturnNoteMessage" />+ <admin-label asp-for="AddMerchandiseReturnNoteMessage"/><div class="col-md-9 col-sm-9"><admin-textarea asp-for="AddMerchandiseReturnNoteMessage"></admin-textarea><span asp-validation-for="AddMerchandiseReturnNoteMessage"></span></div></div><div class="form-group">- <admin-label asp-for="AddMerchandiseReturnNoteDisplayToCustomer" />+ <admin-label asp-for="AddMerchandiseReturnNoteDisplayToCustomer"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="AddMerchandiseReturnNoteDisplayToCustomer" />+ <admin-input asp-for="AddMerchandiseReturnNoteDisplayToCustomer"/><div class="control__indicator"></div></label><span asp-validation-for="AddMerchandiseReturnNoteDisplayToCustomer"></span>@@ -159,4 +159,4 @@});});});-</script>+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Order/Edit.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Order/Edit.cshtmlindex 33c40d61e..03c24262b 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Order/Edit.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Order/Edit.cshtml@@ -4,7 +4,7 @@ViewBag.Title = Loc["Vendor.Orders.EditOrderDetails"];}<form asp-area="@Constants.AreaVendor" asp-controller="Order" asp-action="Edit" method="post" id="order-form">- <input type="hidden" asp-for="Id" />+ <input type="hidden" asp-for="Id"/><div asp-validation-summary="All"></div><div class="row"><div class="col-md-12">@@ -13,14 +13,16 @@<div class="caption"><i class="icon-basket"></i>@Loc["Vendor.Orders.EditOrderDetails"] - @Model.OrderNumber- <small><i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["Vendor.Orders.BackToList"], "List")</small>+ <small>+ <i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["Vendor.Orders.BackToList"], "List")+ </small></div><div class="actions"><div class="btn-group btn-group-devided util-btn-margin-bottom-5"><a href="@Url.Action("PdfInvoice", new { orderId = Model.Id, area = Constants.AreaVendor })" class="btn purple"><i class="fa fa-file-pdf-o"></i> @Loc["Vendor.Orders.PdfInvoice"]</a>- <input type="submit" id="btnRefreshPage" style="display: none" />+ <input type="submit" id="btnRefreshPage" style="display: none"/><script>$(document).ready(function () {$('#btnRefreshPage').click(function () {@@ -29,7 +31,7 @@});});</script>- <vc:vendor-widget widget-zone="vendor_order_details_buttons" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_order_details_buttons" additional-data="Model"/></div></div></div>@@ -39,7 +41,7 @@<tabstrip-item text="@Loc["Vendor.Orders.Info"]" tab-index="0"><content><div>- <partial name="Partials/OrderDetails.Info" model="Model" />+ <partial name="Partials/OrderDetails.Info" model="Model"/></div></content></tabstrip-item>@@ -47,7 +49,7 @@<tabstrip-item text="@Loc["Vendor.Orders.Addresses"]" tab-index="1"><content><div>- <partial name="Partials/OrderDetails.Addresses" model="Model" />+ <partial name="Partials/OrderDetails.Addresses" model="Model"/></div></content></tabstrip-item>@@ -56,7 +58,7 @@<tabstrip-item text="@Loc["Vendor.Orders.Shipments"]" tab-index="2"><content><div>- <partial name="Partials/OrderDetails.Shipment" model="Model" />+ <partial name="Partials/OrderDetails.Shipment" model="Model"/></div></content></tabstrip-item>@@ -64,11 +66,11 @@<tabstrip-item text="@Loc["Vendor.Orders.Products"]" tab-index="3"><content><div>- <partial name="Partials/OrderDetails.Products" model="Model" />+ <partial name="Partials/OrderDetails.Products" model="Model"/></div></content></tabstrip-item>- <vc:vendor-widget widget-zone="vendor_order_details_tabs" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_order_details_tabs" additional-data="Model"/></items></admin-tabstrip></div>@@ -76,4 +78,4 @@</div></div></form>-<admin-delete-confirmation button-id="order-delete" />+<admin-delete-confirmation button-id="order-delete"/>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Order/List.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Order/List.cshtmlindex 17749aad2..d12002753 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Order/List.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Order/List.cshtml@@ -5,7 +5,7 @@ViewBag.Title = Loc["Vendor.Orders"];}<form asp-area="@Constants.AreaVendor" asp-controller="Order" asp-action="List" method="post">-+<div class="row"><div class="col-md-12"><div class="x_panel light form-fit popup-window">@@ -38,16 +38,16 @@<div class="row"><div class="col-md-6 col-sm-12 col-12"><div class="form-group mb-0">- <admin-label asp-for="BillingEmail" class="control-label" />- <admin-input asp-for="BillingEmail" />+ <admin-label asp-for="BillingEmail" class="control-label"/>+ <admin-input asp-for="BillingEmail"/></div></div><div class="col-md-6 col-sm-12 col-12">- <admin-label asp-for="GoDirectlyToNumber" class="control-label" />+ <admin-label asp-for="GoDirectlyToNumber" class="control-label"/><div class="input-group mb-0">- <admin-input asp-for="GoDirectlyToNumber" />+ <admin-input asp-for="GoDirectlyToNumber"/><div class="input-group-append">- <input type="submit" name="go-to-order-by-number" id="gotoorderbynumber" asp-action="GoToOrderId" class="input-group btn btn-default" value="@Loc["Vendor.Common.Go"]" />+ <input type="submit" name="go-to-order-by-number" id="gotoorderbynumber" asp-action="GoToOrderId" class="input-group btn btn-default" value="@Loc["Vendor.Common.Go"]"/></div></div></div>@@ -60,7 +60,7 @@<i class="fa fa-search"></i> @Loc["Vendor.Common.Search"]</button><button class="btn btn-info" type="button" data-toggle="collapse" data-target="#filterCollapse" aria-expanded="false" aria-controls="filterCollapse">- <i class="fa fa-filter"></i> @Loc["Vendor.Common.Filters"]+ <i class="fa fa-filter"></i> @Loc["Vendor.Common.Filters"]</button></div></div>@@ -70,35 +70,35 @@<div class="collapse" id="filterCollapse"><div class="drop-filters-container"><div class="form-group">- <admin-label asp-for="StartDate" class="col-sm-3 control-label" />+ <admin-label asp-for="StartDate" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="StartDate" />+ <admin-input asp-for="StartDate"/></div></div><div class="form-group">- <admin-label asp-for="EndDate" class="col-sm-3 control-label" />+ <admin-label asp-for="EndDate" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="EndDate" />+ <admin-input asp-for="EndDate"/></div></div><div class="form-group">- <admin-label asp-for="OrderGuid" class="col-sm-3 control-label" />+ <admin-label asp-for="OrderGuid" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="OrderGuid" />+ <admin-input asp-for="OrderGuid"/></div></div><div class="form-group">- <admin-label asp-for="BillingCountryId" class="col-sm-3 control-label" />+ <admin-label asp-for="BillingCountryId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="BillingCountryId" asp-items="Model.AvailableCountries" />+ <admin-select asp-for="BillingCountryId" asp-items="Model.AvailableCountries"/></div></div><div class="form-group">- <admin-label asp-for="ProductId" class="col-sm-3 control-label" />+ <admin-label asp-for="ProductId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <input class="form-control" type="text" id="search-product-name" autocomplete="off" />+ <input class="form-control" type="text" id="search-product-name" autocomplete="off"/><span id="search-product-friendly-name"></span>- <input type="button" id="search-product-clear" class="k-button" style="display:none;" value="@Loc["Vendor.Common.Clear"]" />+ <input type="button" id="search-product-clear" class="k-button" style="display:none;" value="@Loc["Vendor.Common.Clear"]"/>@Html.TextBoxFor(model => model.ProductId, new { autocomplete = "off", style = "display:none;" })<script>$(document).ready(function() {@@ -127,27 +127,27 @@</div></div><div class="form-group">- <admin-label asp-for="BillingLastName" class="col-sm-3 control-label" />+ <admin-label asp-for="BillingLastName" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="BillingLastName" />+ <admin-input asp-for="BillingLastName"/></div></div><div class="form-group">- <admin-label asp-for="PaymentStatusId" class="col-sm-3 control-label" />+ <admin-label asp-for="PaymentStatusId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="PaymentStatusId" asp-items="Model.AvailablePaymentStatuses" />+ <admin-select asp-for="PaymentStatusId" asp-items="Model.AvailablePaymentStatuses"/></div></div><div class="form-group">- <admin-label asp-for="WarehouseId" class="col-sm-3 control-label" />+ <admin-label asp-for="WarehouseId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="WarehouseId" asp-items="Model.AvailableWarehouses" />+ <admin-select asp-for="WarehouseId" asp-items="Model.AvailableWarehouses"/></div></div><div class="form-group">- <admin-label asp-for="OrderTag" class="col-sm-3 control-label" />+ <admin-label asp-for="OrderTag" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="OrderTag" asp-items="Model.AvailableOrderTags" />+ <admin-select asp-for="OrderTag" asp-items="Model.AvailableOrderTags"/></div></div></div>@@ -425,7 +425,7 @@</script><form asp-area="@Constants.AreaVendor" asp-controller="Order" asp-action="PdfInvoiceSelected" method="post" id="pdf-invoice-selected-form">- <input type="hidden" id="selectedIds" name="selectedIds" value="" />+ <input type="hidden" id="selectedIds" name="selectedIds" value=""/></form><script>@@ -440,4 +440,4 @@});});-</script>+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Order/Partials/OrderDetails.Addresses.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Order/Partials/OrderDetails.Addresses.cshtmlindex 8e0fa8918..ea34563eb 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Order/Partials/OrderDetails.Addresses.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Order/Partials/OrderDetails.Addresses.cshtml@@ -1,5 +1,6 @@-@model OrderModel-<vc:vendor-widget widget-zone="vendor_order_details_address_top" additional-data="Model" />+@using Constants = Grand.SharedUIResources.Constants+@model OrderModel+<vc:vendor-widget widget-zone="vendor_order_details_address_top" additional-data="Model"/><div class="card col-md-6"><div class="card-body"><h4 class="card-title">@Loc["Vendor.Orders.BillingInfo"]</h4>@@ -290,14 +291,14 @@}</table><div style="padding-top: 15px;">- <img alt="google maps" src="@Url.Content($"{Grand.SharedUIResources.Constants.WwwRoot}/administration/build/images/google-maps.gif")" />+ <img alt="google maps" src="@Url.Content($"{Constants.WwwRoot}/administration/build/images/google-maps.gif")"/><a href="@Html.Raw(Model.ShippingAddressGoogleMapsUrl)" target="_blank">@Loc["Vendor.Orders.Fields.ShippingAddress.ViewOnGoogleMaps"]</a></div>}@if (Model.PickupAddress != null){<div class="form-group">- <admin-label asp-for="PickupAddress" />+ <admin-label asp-for="PickupAddress"/><div class="col-md-9 col-sm-9"><table class="table table-bordered table-striped table-hover">@if (!string.IsNullOrEmpty(Model.PickupAddress.Address1))@@ -355,12 +356,12 @@<div class="form-body"><div class="form-group">- <admin-label asp-for="ShippingMethod" />+ <admin-label asp-for="ShippingMethod"/><div class="col-md-9 col-sm-9"><label class="control-label" id="lblShippingMethod">@Model.ShippingMethod</label>@if (!string.IsNullOrEmpty(Model.ShippingAdditionDescription)){- <br />+ <br/><label>@Html.Raw(Model.ShippingAdditionDescription)</label>}</div>@@ -375,10 +376,9 @@}else{- <div class="card col-md-6">- <div class="note note-info">@Loc["Vendor.Orders.ShippingInfo.NotRequired"]</div>- </div>-+ <div class="card col-md-6">+ <div class="note note-info">@Loc["Vendor.Orders.ShippingInfo.NotRequired"]</div>+ </div>}-<vc:vendor-widget widget-zone="vendor_order_details_address_bottom" additional-data="Model" />\ No newline at end of file+<vc:vendor-widget widget-zone="vendor_order_details_address_bottom" additional-data="Model"/>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Order/Partials/OrderDetails.Shipment.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Order/Partials/OrderDetails.Shipment.cshtmlindex db37c07cb..81a5db470 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Order/Partials/OrderDetails.Shipment.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Order/Partials/OrderDetails.Shipment.cshtml@@ -1,16 +1,18 @@-@model OrderModel-@inject Grand.Business.Core.Interfaces.Common.Security.IPermissionService permissionService;-<vc:vendor-widget widget-zone="vendor_order_details_address_top" additional-data="Model" />+@using Grand.Business.Core.Interfaces.Common.Security+@using Grand.Business.Core.Utilities.Common.Security+@model OrderModel+@inject IPermissionService permissionService;+<vc:vendor-widget widget-zone="vendor_order_details_address_top" additional-data="Model"/>@if (Model.IsShippable){- @if (await permissionService.Authorize(Grand.Business.Core.Utilities.Common.Security.PermissionSystemName.Shipments))+ @if (await permissionService.Authorize(PermissionSystemName.Shipments)){<div class="card col-md-12"><div class="card-body"><h4 class="card-title">@Loc["Vendor.Orders.Shipments"]</h4><div class="card-text"><div class="panel panel-default">- <vc:vendor-widget widget-zone="vendor_order_details_shipping_top" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_order_details_shipping_top" additional-data="Model"/><div class="panel-body"><div id="shipments-grid"></div></div>@@ -20,7 +22,7 @@<button type="submit" id="btnAddNewShipment" name="btnAddNewShipment" onclick="javascript:setLocation('@(Url.Action("AddShipment", "Shipment", new { orderId = Model.Id, area = Constants.AreaVendor }))'); return false;" class="k-button"><i class="fa fa-plus"></i> @Loc["Vendor.Orders.Shipments.AddNew"]</button>}</div>- <vc:vendor-widget widget-zone="vendor_order_details_shipping_bottom" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_order_details_shipping_bottom" additional-data="Model"/></div></div></div>@@ -160,7 +162,6 @@ else<div class="card col-md-6"><div class="note note-info">@Loc["Vendor.Orders.ShippingInfo.NotRequired"]</div></div>-}-<vc:vendor-widget widget-zone="vendor_order_details_address_bottom" additional-data="Model" />+<vc:vendor-widget widget-zone="vendor_order_details_address_bottom" additional-data="Model"/>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/PdfTemplates/OrderPdfTemplate.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/PdfTemplates/OrderPdfTemplate.cshtmlindex 595b09726..e20589acf 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/PdfTemplates/OrderPdfTemplate.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/PdfTemplates/OrderPdfTemplate.cshtml@@ -122,6 +122,7 @@{<div>@Html.Raw(_pdfSettings.InvoiceHeaderText)</div>}+<h4>@store.CompanyName</h4>if (logoExists){@@ -130,6 +131,7 @@<img src="@url" title="logo" alt="logo"/></div>}+<h6>@(string.Format(_translationService.GetResource("PDFInvoice.Order#", order.CustomerLanguageId), order.OrderNumber)) (@order.CreatedOnUtc)</h6><table class="CodeTable"><tr>@@ -142,6 +144,7 @@{@(string.Format(_translationService.GetResource("PDFInvoice.Company", order.CustomerLanguageId), order.BillingAddress.Company))<br/>}+@(string.Format(_translationService.GetResource("PDFInvoice.Name", order.CustomerLanguageId), order.BillingAddress.FirstName + " " + order.BillingAddress.LastName))<br/>@(string.Format(_translationService.GetResource("PDFInvoice.Phone", order.CustomerLanguageId), order.BillingAddress.PhoneNumber))<br/>@(string.Format(_translationService.GetResource("PDFInvoice.Address", order.CustomerLanguageId), order.BillingAddress.Address1))<br/>@@ -150,9 +153,9 @@<br/>var paymentMethod = _paymentService.LoadPaymentMethodBySystemName(order.PaymentMethodSystemName);var paymentMethodStr = paymentMethod != null ? paymentMethod.FriendlyName : order.PaymentMethodSystemName;- <b>@(string.Format(_translationService.GetResource("PDFInvoice.PaymentMethod", order.CustomerLanguageId), paymentMethodStr))</b><br/>+ <b>@(string.Format(_translationService.GetResource("PDFInvoice.PaymentMethod", order.CustomerLanguageId), paymentMethodStr))</b>+ <br/>@await Component.InvokeAsync("Widget", new { widgetZone = "pdf_payment_method_below", additionalData = order.Id })-}</td><td class="line">@@ -164,13 +167,15 @@{@(string.Format(_translationService.GetResource("PDFInvoice.Company", order.CustomerLanguageId), order.ShippingAddress.Company))<br/>}+@(string.Format(_translationService.GetResource("PDFInvoice.Name", order.CustomerLanguageId), order.ShippingAddress.FirstName + " " + order.ShippingAddress.LastName))<br/>@(string.Format(_translationService.GetResource("PDFInvoice.Phone", order.CustomerLanguageId), order.ShippingAddress.PhoneNumber))<br/>@(string.Format(_translationService.GetResource("PDFInvoice.Address", order.CustomerLanguageId), order.ShippingAddress.Address1))<br/>@(order.ShippingAddress.City + ", " + order.ShippingAddress.ZipPostalCode)<br/>@((await _countryService.GetCountryById(order.ShippingAddress.CountryId))?.Name)<br/><br/>- <b>@(string.Format(_translationService.GetResource("PDFInvoice.ShippingMethod", order.CustomerLanguageId), order.ShippingMethod))</b><br/>+ <b>@(string.Format(_translationService.GetResource("PDFInvoice.ShippingMethod", order.CustomerLanguageId), order.ShippingMethod))</b>+ <br/>}</td></tr>@@ -243,25 +248,27 @@@if (order.OrderSubTotalDiscountInclTax > 0 || order.OrderSubTotalDiscountExclTax > 0){@(_translationService.GetResource("PDFInvoice.Discount", order.CustomerLanguageId)) @if (priceIncludesTax)- {- @order.OrderSubTotalDiscountInclTax.ToString("N2")- }- else- {- @order.OrderSubTotalDiscountExclTax.ToString("N2")- }+ {+ @order.OrderSubTotalDiscountInclTax.ToString("N2")+ }+ else+ {+ @order.OrderSubTotalDiscountExclTax.ToString("N2")+ }+@order.CustomerCurrencyCode}@if (order.PaymentMethodAdditionalFeeInclTax > 0 || order.PaymentMethodAdditionalFeeExclTax > 0){@(_translationService.GetResource("PDFInvoice.PaymentmethodAdditionalFee", order.CustomerLanguageId)) @if (priceIncludesTax)- {- @order.PaymentMethodAdditionalFeeInclTax.ToString("N2")- }- else- {- @order.PaymentMethodAdditionalFeeExclTax.ToString("N2")- }+ {+ @order.PaymentMethodAdditionalFeeInclTax.ToString("N2")+ }+ else+ {+ @order.PaymentMethodAdditionalFeeExclTax.ToString("N2")+ }+@order.CustomerCurrencyCode<br/>}@(_translationService.GetResource("PDFInvoice.Shipping", order.CustomerLanguageId))@@ -295,23 +302,28 @@@order.OrderTax.ToString("N2")@order.CustomerCurrencyCode<br/>}- <b>@(_translationService.GetResource("PDFInvoice.OrderTotal", order.CustomerLanguageId)) @order.OrderTotal.ToString("N2") @order.CustomerCurrencyCode<br/></b>+ <b>+ @(_translationService.GetResource("PDFInvoice.OrderTotal", order.CustomerLanguageId)) @order.OrderTotal.ToString("N2") @order.CustomerCurrencyCode<br/>+ </b></div></div>}+if (!string.IsNullOrEmpty(_pdfSettings.InvoiceFooterText)){<footer class="footer">@Html.Raw(_pdfSettings.InvoiceFooterText)</footer>}+if (Model.Item1.Count - 1 > i){<div style="display:block; clear:both; page-break-after:always;"></div>}+i++;}</main></body>-</html>+</html>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/PdfTemplates/ShipmentPdfTemplate.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/PdfTemplates/ShipmentPdfTemplate.cshtmlindex ba7e01c13..899c29b45 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/PdfTemplates/ShipmentPdfTemplate.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/PdfTemplates/ShipmentPdfTemplate.cshtml@@ -1,7 +1,7 @@+@using Grand.Business.Core.Interfaces.Catalog.Products@using Grand.Business.Core.Interfaces.Checkout.Orders@using Grand.Business.Core.Interfaces.Common.Directory@using Grand.Business.Core.Interfaces.Common.Localization-@using Grand.Business.Core.Interfaces.Catalog.Products@model IList<Grand.Domain.Shipping.Shipment>@inject IOrderService _orderService@inject IProductService _productService@@ -78,7 +78,7 @@</style></head><body>- <main style="padding:10pt; font-size:12px">+<main style="padding:10pt; font-size:12px">@for (var i = 0; i < Model.Count; i++){var order = await _orderService.GetOrderById(Model[i].OrderId);@@ -91,18 +91,21 @@{<div><h6>@(_translationService.GetResource("PDFInvoice.ShippingInformation", order.CustomerLanguageId))</h6>- @if (!string.IsNullOrEmpty(order.ShippingAddress.Company))- {- @(string.Format(_translationService.GetResource("PDFPackagingSlip.Company", order.CustomerLanguageId), order.ShippingAddress.Company))<br/>- }- @(string.Format(_translationService.GetResource("PDFPackagingSlip.Name", order.CustomerLanguageId), order.ShippingAddress.FirstName + " " + order.ShippingAddress.LastName))<br/>- @(string.Format(_translationService.GetResource("PDFPackagingSlip.Phone", order.CustomerLanguageId), order.ShippingAddress.PhoneNumber))<br/>- @(string.Format(_translationService.GetResource("PDFPackagingSlip.Address", order.CustomerLanguageId), order.ShippingAddress.Address1))<br/>- @(order.ShippingAddress.City + ", " + order.ShippingAddress.ZipPostalCode)<br/>- @((await _countryService.GetCountryById(order.ShippingAddress.CountryId))?.Name)<br/>+ @if (!string.IsNullOrEmpty(order.ShippingAddress.Company))+ {+ @(string.Format(_translationService.GetResource("PDFPackagingSlip.Company", order.CustomerLanguageId), order.ShippingAddress.Company))<br/>+ }+ @(string.Format(_translationService.GetResource("PDFPackagingSlip.Name", order.CustomerLanguageId), order.ShippingAddress.FirstName + " " + order.ShippingAddress.LastName))<br/>+ @(string.Format(_translationService.GetResource("PDFPackagingSlip.Phone", order.CustomerLanguageId), order.ShippingAddress.PhoneNumber))<br/>+ @(string.Format(_translationService.GetResource("PDFPackagingSlip.Address", order.CustomerLanguageId), order.ShippingAddress.Address1))<br/>+ @(order.ShippingAddress.City + ", " + order.ShippingAddress.ZipPostalCode)<br/>+ @((await _countryService.GetCountryById(order.ShippingAddress.CountryId))?.Name)<br/></div>}- <div><strong>@(string.Format(_translationService.GetResource("PDFPackagingSlip.ShippingMethod", order.CustomerLanguageId), order.ShippingMethod))</strong></div>++ <div>+ <strong>@(string.Format(_translationService.GetResource("PDFPackagingSlip.ShippingMethod", order.CustomerLanguageId), order.ShippingMethod))</strong>+ </div><div class="summary">@(_translationService.GetResource("PDFInvoice.Product(s)", order.CustomerLanguageId))</div>@@ -122,7 +125,7 @@@((await _productService.GetProductByIdIncludeArch(item.ProductId)).Name)@if (!string.IsNullOrEmpty(orderItem.AttributeDescription)){- <br />+ <br/><small>@(Html.Raw(orderItem.AttributeDescription))</small>}</td>@@ -134,6 +137,6 @@}</table>}- </main>+</main></body></html>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/AssociateProductToAttributeValuePopup.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/AssociateProductToAttributeValuePopup.cshtmlindex 893311e37..28875a17f 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/AssociateProductToAttributeValuePopup.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/AssociateProductToAttributeValuePopup.cshtml@@ -7,7 +7,7 @@}<form asp-area="@Constants.AreaVendor" asp-controller="Product" asp-action="AssociateProductToAttributeValuePopup"- asp-route-productIdInput="@Context.Request.Query["productIdInput"]"+ asp-route-productIdInput="@Context.Request.Query["productIdInput"]"asp-route-productNameInput="@Context.Request.Query["productNameInput"]" id="associateproduct"><div class="row"><div class="col-md-12">@@ -25,8 +25,8 @@<div class="row align-items-end"><div class="col-md col-ms-12 col-12"><div class="form-group mb-0">- <admin-label asp-for="SearchProductName" class="control-label" />- <admin-input asp-for="SearchProductName" />+ <admin-label asp-for="SearchProductName" class="control-label"/>+ <admin-input asp-for="SearchProductName"/></div></div><div class="col-md-auto col-sm-12 col-12">@@ -46,31 +46,31 @@<div class="collapse" id="filterCollapse"><div class="drop-filters-container w-100"><div class="form-group">- <admin-label asp-for="SearchCategoryId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchCategoryId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchCategoryId" />+ <admin-input asp-for="SearchCategoryId"/></div></div><div class="form-group">- <admin-label asp-for="SearchBrandId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchBrandId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchBrandId" />+ <admin-input asp-for="SearchBrandId"/></div></div><div class="form-group">- <admin-label asp-for="SearchCollectionId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchCollectionId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchCollectionId" />+ <admin-input asp-for="SearchCollectionId"/></div></div><div class="form-group">- <admin-label asp-for="SearchProductTypeId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchProductTypeId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="SearchProductTypeId" asp-items="Model.AvailableProductTypes" />+ <admin-select asp-for="SearchProductTypeId" asp-items="Model.AvailableProductTypes"/></div></div></div>- </div>+ </div><div id="products-grid"></div></div></div>@@ -78,7 +78,7 @@</div></div></div>- <input asp-for="AssociatedToProductId" type="hidden" />+ <input asp-for="AssociatedToProductId" type="hidden"/><script>var mfp = $.magnificPopup.instance;$("#associateproduct").submit(function (e) {diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/AssociatedProductAddPopup.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/AssociatedProductAddPopup.cshtmlindex cc28145b1..818f00153 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/AssociatedProductAddPopup.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/AssociatedProductAddPopup.cshtml@@ -10,7 +10,7 @@asp-route-ProductId="@Context.Request.Query["ProductId"]"asp-route-btnId="@Context.Request.Query["btnId"]"asp-route-formId="@Context.Request.Query["formId"]">-+<div class="row"><div class="col-md-12">@@ -28,8 +28,8 @@<div class="row align-items-end"><div class="col-md col-ms-12 col-12"><div class="form-group mb-0">- <admin-label asp-for="SearchProductName" class="control-label" />- <admin-input asp-for="SearchProductName" />+ <admin-label asp-for="SearchProductName" class="control-label"/>+ <admin-input asp-for="SearchProductName"/></div></div><div class="col-md-auto col-sm-12 col-12">@@ -50,27 +50,27 @@<div class="collapse" id="filterCollapse"><div class="drop-filters-container"><div class="form-group">- <admin-label asp-for="SearchCategoryId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchCategoryId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchCategoryId" />+ <admin-input asp-for="SearchCategoryId"/></div></div><div class="form-group">- <admin-label asp-for="SearchBrandId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchBrandId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchBrandId" />+ <admin-input asp-for="SearchBrandId"/></div></div><div class="form-group">- <admin-label asp-for="SearchCollectionId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchCollectionId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchCollectionId" />+ <admin-input asp-for="SearchCollectionId"/></div></div><div class="form-group">- <admin-label asp-for="SearchProductTypeId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchProductTypeId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="SearchProductTypeId" asp-items="Model.AvailableProductTypes" />+ <admin-select asp-for="SearchProductTypeId" asp-items="Model.AvailableProductTypes"/></div></div></div>@@ -220,4 +220,4 @@updateMasterCheckbox();});</script>-</form>+</form>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/AttributeCombinationPopup.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/AttributeCombinationPopup.cshtmlindex e7e65e26f..dfe88a148 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/AttributeCombinationPopup.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/AttributeCombinationPopup.cshtml@@ -9,245 +9,252 @@asp-route-btnId="@Context.Request.Query["btnId"]"asp-route-formId="@Context.Request.Query["formId"]">-- <div asp-validation-summary="All"></div>- <input asp-for="Id" type="hidden" />- <input asp-for="ProductId" type="hidden" />- <div class="row">- <div class="col-md-12">- <div class="x_panel light form-fit">- <div class="x_title">- <div class="caption">- <i class="fa fa-cube"></i>+<div asp-validation-summary="All"></div>+<input asp-for="Id" type="hidden"/>+<input asp-for="ProductId" type="hidden"/>++<div class="row">+ <div class="col-md-12">+ <div class="x_panel light form-fit">+ <div class="x_title">+ <div class="caption">+ <i class="fa fa-cube"></i>+ @if (string.IsNullOrEmpty(Model.Id))+ {+ @Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.AddTitle"]+ }+ else+ {+ @Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Update"]+ }+ </div>+ </div>+ <div class="x_content">+ <div class="form-horizontal">+ <div class="form-body">+ @if (Model.Warnings.Count > 0)+ {+ <div class="message-box message-box-error">+ @foreach (var warning in Model.Warnings)+ {+ @warning+ <br/>+ }+ </div>+ }@if (string.IsNullOrEmpty(Model.Id)){- @Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.AddTitle"]+ <partial name="Partials/ProductAttributes" model="Model.ProductAttributes"/>}else{- @Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Update"]- }- </div>- </div>- <div class="x_content">- <div class="form-horizontal">- <div class="form-body">- @if (Model.Warnings.Count > 0)- {- <div class="message-box message-box-error">- @foreach (var warning in Model.Warnings)- {- @warning- <br />- }- </div>- }- @if (string.IsNullOrEmpty(Model.Id))- {- <partial name="Partials/ProductAttributes" model="Model.ProductAttributes" />- }- else- {- <div class="form-group">- <label class="control-label col-sm-3">- @Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Attributes"]- </label>- <div class="col-md-9 col-sm-9">- <text>@Html.Raw(Model.Attributes)</text>- </div>- </div>-- }- <br />- </div>- </div>- <div class="form-horizontal">- <div class="form-body">- @if (!Model.UseMultipleWarehouses)- {- <div class="form-group">- <admin-label asp-for="StockQuantity" class="col-sm-3 control-label" />- <div class="col-md-9 col-sm-9">- <admin-input asp-for="StockQuantity" />- <span asp-validation-for="StockQuantity"></span>- </div>- </div>- <div class="form-group">- <admin-label asp-for="ReservedQuantity" class="col-sm-3 control-label" />- <div class="col-md-9 col-sm-9">- <admin-input asp-for="ReservedQuantity" />- <span asp-validation-for="ReservedQuantity"></span>- </div>- </div>- }- else- {- <div class="form-group" id="pnlMultipleWarehouses">-- <div class="col-md-9 col-sm-9">- @if (Model.WarehouseInventoryModels.Count > 0)- {- <table style="width: 600px; border-collapse: collapse;">- <thead>- <tr>- <th>- @Loc["Vendor.Catalog.Products.ProductWarehouseInventory.Fields.Warehouse"]- </th>- <th align="center">- @Loc["Vendor.Catalog.Products.ProductWarehouseInventory.Fields.WarehouseUsed"]- </th>- <th align="center">- @Loc["Vendor.Catalog.Products.ProductWarehouseInventory.Fields.StockQuantity"]- </th>- <th align="center">- @Loc["Vendor.Catalog.Products.ProductWarehouseInventory.Fields.ReservedQuantity"]- </th>- </tr>- </thead>- <tbody>- @for (var i = 0; i < Model.WarehouseInventoryModels.Count; i++)- {- var item = Model.WarehouseInventoryModels[i];- <tr style="height:40px;">- <td style="width: 35%;">- <div style="padding-left: 5px; padding-right: 5px;">- @item.WarehouseName- <input asp-for="@Model.WarehouseInventoryModels[i].WarehouseId" type="hidden" />- </div>- </td>- <td align="center" style="width: 10%;">- <label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="@Model.WarehouseInventoryModels[i].WarehouseUsed" />- <div class="control__indicator"></div>- </label>- <td align="center" style="width: 20%;">- <admin-input asp-for="@Model.WarehouseInventoryModels[i].StockQuantity" />- </td>- <td align="center" style="width: 20%;">- <admin-input asp-for="@Model.WarehouseInventoryModels[i].ReservedQuantity" />- </td>-- </tr>- }- </tbody>- </table>- }- else- {- @Loc["Vendor.Catalog.Products.ProductWarehouseInventory.Fields.Warehouse.NotDefined"]- }- </div>- </div>- }<div class="form-group">- <admin-label asp-for="AllowOutOfStockOrders" class="col-sm-3 control-label" />+ <label class="control-label col-sm-3">+ @Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Attributes"]+ </label><div class="col-md-9 col-sm-9">- <label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="AllowOutOfStockOrders" />- <div class="control__indicator"></div>- </label>- <span asp-validation-for="AllowOutOfStockOrders"></span>+ <text>@Html.Raw(Model.Attributes)</text></div></div>+ }+ <br/>+ </div>+ </div>+ <div class="form-horizontal">+ <div class="form-body">+ @if (!Model.UseMultipleWarehouses)+ {<div class="form-group">- <admin-label asp-for="Text" class="col-sm-3 control-label" />+ <admin-label asp-for="StockQuantity" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Text" />- <span asp-validation-for="Text"></span>+ <admin-input asp-for="StockQuantity"/>+ <span asp-validation-for="StockQuantity"></span></div></div><div class="form-group">- <admin-label asp-for="Sku" class="col-sm-3 control-label" />+ <admin-label asp-for="ReservedQuantity" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Sku" />- <span asp-validation-for="Sku"></span>+ <admin-input asp-for="ReservedQuantity"/>+ <span asp-validation-for="ReservedQuantity"></span></div></div>- <div class="form-group">- <admin-label asp-for="Mpn" class="col-sm-3 control-label" />+ }+ else+ {+ <div class="form-group" id="pnlMultipleWarehouses">+<div class="col-md-9 col-sm-9">- <admin-input asp-for="Mpn" />- <span asp-validation-for="Mpn"></span>+ @if (Model.WarehouseInventoryModels.Count > 0)+ {+ <table style="width: 600px; border-collapse: collapse;">+ <thead>+ <tr>+ <th>+ @Loc["Vendor.Catalog.Products.ProductWarehouseInventory.Fields.Warehouse"]+ </th>+ <th align="center">+ @Loc["Vendor.Catalog.Products.ProductWarehouseInventory.Fields.WarehouseUsed"]+ </th>+ <th align="center">+ @Loc["Vendor.Catalog.Products.ProductWarehouseInventory.Fields.StockQuantity"]+ </th>+ <th align="center">+ @Loc["Vendor.Catalog.Products.ProductWarehouseInventory.Fields.ReservedQuantity"]+ </th>+ </tr>+ </thead>+ <tbody>+ @for (var i = 0; i < Model.WarehouseInventoryModels.Count; i++)+ {+ var item = Model.WarehouseInventoryModels[i];+ <tr style="height:40px;">+ <td style="width: 35%;">+ <div style="padding-left: 5px; padding-right: 5px;">+ @item.WarehouseName+ <input asp-for="@Model.WarehouseInventoryModels[i].WarehouseId" type="hidden"/>+ </div>+ </td>+ <td align="center" style="width: 10%;">+ <label class="mt-checkbox mt-checkbox-outline control control-checkbox">+ <admin-input asp-for="@Model.WarehouseInventoryModels[i].WarehouseUsed"/>+ <div class="control__indicator"></div>+ </label>+ <td align="center" style="width: 20%;">+ <admin-input asp-for="@Model.WarehouseInventoryModels[i].StockQuantity"/>+ </td>+ <td align="center" style="width: 20%;">+ <admin-input asp-for="@Model.WarehouseInventoryModels[i].ReservedQuantity"/>+ </td>++ </tr>+ }+ </tbody>+ </table>+ }+ else+ {+ @Loc["Vendor.Catalog.Products.ProductWarehouseInventory.Fields.Warehouse.NotDefined"]+ }</div></div>- <div class="form-group">- <admin-label asp-for="Gtin" class="col-sm-3 control-label" />- <div class="col-md-9 col-sm-9">- <admin-input asp-for="Gtin" />- <span asp-validation-for="Gtin"></span>- </div>+ }+ <div class="form-group">+ <admin-label asp-for="AllowOutOfStockOrders" class="col-sm-3 control-label"/>+ <div class="col-md-9 col-sm-9">+ <label class="mt-checkbox mt-checkbox-outline control control-checkbox">+ <admin-input asp-for="AllowOutOfStockOrders"/>+ <div class="control__indicator"></div>+ </label>+ <span asp-validation-for="AllowOutOfStockOrders"></span></div>- <div class="form-group">- <admin-label asp-for="OverriddenPrice" class="col-sm-3 control-label" />- <div class="col-md-9 col-sm-9">- <admin-input asp-for="OverriddenPrice" /> [@Model.PrimaryStoreCurrencyCode]- <span asp-validation-for="OverriddenPrice"></span>- </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="Text" class="col-sm-3 control-label"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="Text"/>+ <span asp-validation-for="Text"></span></div>- <div class="form-group">- <admin-label asp-for="NotifyAdminForQuantityBelow" class="col-sm-3 control-label" />- <div class="col-md-9 col-sm-9">- <admin-input asp-for="NotifyAdminForQuantityBelow" />- <span asp-validation-for="NotifyAdminForQuantityBelow"></span>- </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="Sku" class="col-sm-3 control-label"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="Sku"/>+ <span asp-validation-for="Sku"></span></div>- <div class="form-group">- <admin-label asp-for="PictureId" class="col-sm-3 control-label" />- <div class="col-md-9 col-sm-9">- <ul style="list-style: none;">+ </div>+ <div class="form-group">+ <admin-label asp-for="Mpn" class="col-sm-3 control-label"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="Mpn"/>+ <span asp-validation-for="Mpn"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="Gtin" class="col-sm-3 control-label"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="Gtin"/>+ <span asp-validation-for="Gtin"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="OverriddenPrice" class="col-sm-3 control-label"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="OverriddenPrice"/> [@Model.PrimaryStoreCurrencyCode]+ <span asp-validation-for="OverriddenPrice"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="NotifyAdminForQuantityBelow" class="col-sm-3 control-label"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="NotifyAdminForQuantityBelow"/>+ <span asp-validation-for="NotifyAdminForQuantityBelow"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="PictureId" class="col-sm-3 control-label"/>+ <div class="col-md-9 col-sm-9">+ <ul style="list-style: none;">+ <li style="float: left; width: 110px;">+ <p style="float: left; padding-top: 20px;">+ <input type="radio" name="@Html.NameFor(x => x.PictureId)" value="0" id="id_image_0"+ @if (!string.IsNullOrEmpty(Model.PictureId))+ {+ <text> checked="checked" </text>+ }>+ </p>+ <p style="float: left; padding-top: 20px;">+ <label for="id_image_0">+ @Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Picture.NoPicture"]+ </label>+ </p>+ </li>+ @foreach (var picture in Model.ProductPictureModels)+ {<li style="float: left; width: 110px;"><p style="float: left; padding-top: 20px;">- <input type="radio" name="@Html.NameFor(x => x.PictureId)" value="0" id="id_image_0"- @if (!string.IsNullOrEmpty(Model.PictureId)) { <text> checked="checked" </text> }>+ <input type="radio" name="@Html.NameFor(x => x.PictureId)" value="@picture.PictureId" id="[email protected]"+ @if (picture.PictureId == Model.PictureId)+ {+ <text> checked="checked" </text>+ }></p>- <p style="float: left; padding-top: 20px;">- <label for="id_image_0">- @Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Picture.NoPicture"]+ <p style="float: left;">+ <label for="[email protected]">+ <img src="@picture.PictureUrl" alt="" title="" width="75"></label></p></li>- @foreach (var picture in Model.ProductPictureModels)- {- <li style="float: left; width: 110px;">- <p style="float: left; padding-top: 20px;">- <input type="radio" name="@Html.NameFor(x => x.PictureId)" value="@picture.PictureId" id="[email protected]"- @if (picture.PictureId == Model.PictureId) { <text> checked="checked" </text> }>- </p>- <p style="float: left;">- <label for="[email protected]">- <img src="@picture.PictureUrl" alt="" title="" width="75">- </label>- </p>- </li>- }- </ul>- </div>- </div>- <div class="form-group">- <div class="offset-sm-3 offset-md-3 col-md-9 col-sm-9">- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Vendor.Common.Save"] </button>- <vc:vendor-widget widget-zone="vendor_product_details_attribute_combination_buttons" additional-data="Model" />- </div>+ }+ </ul></div></div>- @if (!string.IsNullOrEmpty(Model.Id))- {- <div class="panel panel-default">- <div class="panel-heading">- @Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.TierPrices"] [@Model.PrimaryStoreCurrencyCode]- </div>- <div class="panel-body">- <div id="tierprices-grid"></div>- </div>+ <div class="form-group">+ <div class="offset-sm-3 offset-md-3 col-md-9 col-sm-9">+ <button class="btn btn-success" type="submit" name="save">+ <i class="fa fa-check"></i> @Loc["Vendor.Common.Save"]+ </button>+ <vc:vendor-widget widget-zone="vendor_product_details_attribute_combination_buttons" additional-data="Model"/></div>- }+ </div></div>+ @if (!string.IsNullOrEmpty(Model.Id))+ {+ <div class="panel panel-default">+ <div class="panel-heading">+ @Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.TierPrices"] [@Model.PrimaryStoreCurrencyCode]+ </div>+ <div class="panel-body">+ <div id="tierprices-grid"></div>+ </div>+ </div>+ }</div></div></div></div>- <script>+</div>+<script>var mfp = $.magnificPopup.instance;$("#AttributeCombinationPopup").submit(function (e) {e.preventDefault();@@ -278,9 +285,9 @@});});</script>- @if (!string.IsNullOrEmpty(Model.Id))- {- <script>+@if (!string.IsNullOrEmpty(Model.Id))+{+ <script>$("#tierprices-grid").kendoGrid({dataSource: {transport: {@@ -383,5 +390,5 @@});</script>- }+}</form>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/BulkEdit.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/BulkEdit.cshtmlindex 08519d839..a182a4a8f 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/BulkEdit.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/BulkEdit.cshtml@@ -5,7 +5,7 @@ViewBag.Title = Loc["Vendor.Catalog.BulkEdit"];}<form asp-area="@Constants.AreaVendor" asp-controller="Product" asp-action="BulkEdit" method="post">-+<div class="row"><div class="col-md-12"><div class="x_panel light form-fit popup-window">@@ -14,7 +14,7 @@<i class="fa fa-cubes"></i>@Loc["Vendor.Catalog.BulkEdit"]</div>- <vc:vendor-widget widget-zone="vendor_product_bulk_edit_buttons" additional-data="null" />+ <vc:vendor-widget widget-zone="vendor_product_bulk_edit_buttons" additional-data="null"/></div><div class="x_content form"><div class="form-horizontal">@@ -23,8 +23,8 @@<div class="row align-items-end"><div class="col-md-8 col-ms-12 col-12"><div class="form-group mb-0">- <admin-label asp-for="SearchProductName" class="control-label" />- <admin-input asp-for="SearchProductName" />+ <admin-label asp-for="SearchProductName" class="control-label"/>+ <admin-input asp-for="SearchProductName"/></div></div><div class="col-md-4 col-sm-12 col-12">@@ -44,27 +44,27 @@<div class="collapse" id="filterCollapse"><div class="drop-filters-container w-100"><div class="form-group">- <admin-label asp-for="SearchCategoryId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchCategoryId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchCategoryId" class="col-sm-3 control-label" />+ <admin-input asp-for="SearchCategoryId" class="col-sm-3 control-label"/></div></div><div class="form-group">- <admin-label asp-for="SearchBrandId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchBrandId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchBrandId" />+ <admin-input asp-for="SearchBrandId"/></div></div><div class="form-group">- <admin-label asp-for="SearchCollectionId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchCollectionId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchCollectionId" />+ <admin-input asp-for="SearchCollectionId"/></div></div><div class="form-group">- <admin-label asp-for="SearchProductTypeId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchProductTypeId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="SearchProductTypeId" asp-items="Model.AvailableProductTypes" />+ <admin-select asp-for="SearchProductTypeId" asp-items="Model.AvailableProductTypes"/></div></div></div>@@ -86,7 +86,7 @@var allInventoryMethod = [@foreach (var method in methods){- <text>+ <text>{Id: '@(method.Value)',Name: "@Html.Raw(method.Text)"diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/BundleProductAddPopup.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/BundleProductAddPopup.cshtmlindex dcf5e18a6..11be8d781 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/BundleProductAddPopup.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/BundleProductAddPopup.cshtml@@ -27,8 +27,8 @@<div class="row align-items-end"><div class="col-md col-ms-12 col-12"><div class="form-group mb-0">- <admin-label asp-for="SearchProductName" class="control-label" />- <admin-input asp-for="SearchProductName" />+ <admin-label asp-for="SearchProductName" class="control-label"/>+ <admin-input asp-for="SearchProductName"/></div></div><div class="col-md-auto col-sm-12 col-12">@@ -49,21 +49,21 @@<div class="collapse" id="filterCollapse"><div class="drop-filters-container"><div class="form-group">- <admin-label asp-for="SearchCategoryId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchCategoryId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchCategoryId" />+ <admin-input asp-for="SearchCategoryId"/></div></div><div class="form-group">- <admin-label asp-for="SearchBrandId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchBrandId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchBrandId" />+ <admin-input asp-for="SearchBrandId"/></div></div><div class="form-group">- <admin-label asp-for="SearchCollectionId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchCollectionId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchCollectionId" />+ <admin-input asp-for="SearchCollectionId"/></div></div></div>@@ -205,4 +205,4 @@$('#mastercheckbox').prop('checked', numChkBoxes == numChkBoxesChecked && numChkBoxes > 0);}</script>-</form>+</form>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Create.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Create.cshtmlindex 451aec1ff..d5f41e079 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Create.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Create.cshtml@@ -4,7 +4,7 @@ViewBag.Title = Loc["Vendor.Catalog.Products.AddNew"];}<form asp-area="@Constants.AreaVendor" asp-controller="Product" asp-action="Create" method="post" id="product-form">-+<div class="row"><div class="col-md-12"><div class="x_panel light form-fit">@@ -12,18 +12,24 @@<div class="caption"><i class="fa fa-cube"></i>@Loc["Vendor.Catalog.Products.AddNew"]- <small><i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["Vendor.Catalog.Products.BackToList"], "List")</small>+ <small>+ <i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["Vendor.Catalog.Products.BackToList"], "List")+ </small></div><div class="actions"><div class="btn-group btn-group-devided">- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Vendor.Common.Save"] </button>- <button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @Loc["Vendor.Common.SaveContinue"] </button>- <vc:vendor-widget widget-zone="vendor_product_details_buttons" additional-data="null" />+ <button class="btn btn-success" type="submit" name="save">+ <i class="fa fa-check"></i> @Loc["Vendor.Common.Save"]+ </button>+ <button class="btn btn-success" type="submit" name="save-continue">+ <i class="fa fa-check-circle"></i> @Loc["Vendor.Common.SaveContinue"]+ </button>+ <vc:vendor-widget widget-zone="vendor_product_details_buttons" additional-data="null"/></div></div></div><div class="x_content form">- <partial name="Partials/CreateOrUpdate" model="Model" />+ <partial name="Partials/CreateOrUpdate" model="Model"/></div></div></div>diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/CrossSellProductAddPopup.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/CrossSellProductAddPopup.cshtmlindex ff06f8e9c..f82c1fe1c 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/CrossSellProductAddPopup.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/CrossSellProductAddPopup.cshtml@@ -9,7 +9,7 @@asp-route-ProductId="@Context.Request.Query["ProductId"]"asp-route-btnId="@Context.Request.Query["btnId"]"asp-route-formId="@Context.Request.Query["formId"]">-+<div class="row"><div class="col-md-12">@@ -27,8 +27,8 @@<div class="row align-items-end"><div class="col-md col-ms-12 col-12"><div class="form-group mb-0">- <admin-label asp-for="SearchProductName" class="control-label" />- <admin-input asp-for="SearchProductName" />+ <admin-label asp-for="SearchProductName" class="control-label"/>+ <admin-input asp-for="SearchProductName"/></div></div><div class="col-md-auto col-sm-12 col-12">@@ -49,31 +49,31 @@<div class="collapse" id="filterCollapse"><div class="drop-filters-container"><div class="form-group">- <admin-label asp-for="SearchCategoryId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchCategoryId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchCategoryId" />+ <admin-input asp-for="SearchCategoryId"/></div></div><div class="form-group">- <admin-label asp-for="SearchBrandId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchBrandId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchBrandId" />+ <admin-input asp-for="SearchBrandId"/></div></div><div class="form-group">- <admin-label asp-for="SearchCollectionId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchCollectionId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchCollectionId" />+ <admin-input asp-for="SearchCollectionId"/></div></div><div class="form-group">- <admin-label asp-for="SearchProductTypeId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchProductTypeId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="SearchProductTypeId" asp-items="Model.AvailableProductTypes" />+ <admin-select asp-for="SearchProductTypeId" asp-items="Model.AvailableProductTypes"/></div></div></div>- </div>+ </div><div id="products-grid"></div></div></div>diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Edit.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Edit.cshtmlindex aa847c2f6..c53b8eb7c 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Edit.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Edit.cshtml@@ -4,7 +4,7 @@ViewBag.Title = Loc["Vendor.Catalog.Products.EditProductDetails"];}<form asp-area="@Constants.AreaVendor" asp-controller="Product" asp-action="Edit" method="post" id="product-form">-+<div class="row"><div class="col-md-12"><div class="x_panel light form-fit">@@ -12,27 +12,35 @@<div class="caption"><i class="fa fa-cube"></i>@Loc["Vendor.Catalog.Products.EditProductDetails"] - @Model.Name- <small><i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["Vendor.Catalog.Products.BackToList"], "List")</small>+ <small>+ <i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["Vendor.Catalog.Products.BackToList"], "List")+ </small></div><div class="actions"><div class="btn-group btn-group-devided util-btn-margin-bottom-5">- <button type="button" onclick="window.open('@Url.RouteUrl("Product", new { Model.SeName})','_blank');" class="btn purple">+ <button type="button" onclick="window.open('@Url.RouteUrl("Product", new { Model.SeName })','_blank');" class="btn purple"><i class="fa fa-eye"></i>@Loc["Vendor.Common.Preview"]</button>- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Vendor.Common.Save"] </button>- <button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @Loc["Vendor.Common.SaveContinue"] </button>+ <button class="btn btn-success" type="submit" name="save">+ <i class="fa fa-check"></i> @Loc["Vendor.Common.Save"]+ </button>+ <button class="btn btn-success" type="submit" name="save-continue">+ <i class="fa fa-check-circle"></i> @Loc["Vendor.Common.SaveContinue"]+ </button><button type="button" name="copyproduct" class="btn blue" id="copyproduct"><i class="fa fa-clone"></i>@Loc["Vendor.Catalog.Products.Copy"]</button>- <span id="product-delete" class="btn red"><i class="fa fa-trash-o"></i> @Loc["Vendor.Common.Delete"]</span>- <vc:vendor-widget widget-zone="vendor_product_details_buttons" additional-data="Model" />+ <span id="product-delete" class="btn red">+ <i class="fa fa-trash-o"></i> @Loc["Vendor.Common.Delete"]+ </span>+ <vc:vendor-widget widget-zone="vendor_product_details_buttons" additional-data="Model"/></div></div></div><div class="x_content form">- <partial name="Partials/CreateOrUpdate" model="Model" />+ <partial name="Partials/CreateOrUpdate" model="Model"/></div></div></div>@@ -40,40 +48,40 @@</form><admin-delete-confirmation button-id="product-delete"/>- <div id="copyproduct-window" style="display:none;">- <form asp-area="@Constants.AreaVendor" asp-controller="Product" asp-action="CopyProduct" method="post">-- <input asp-for="CopyProductModel.Id" type="hidden" />- <div class="form-horizontal">- <div class="form-body">- <div class="form-group">- <admin-label asp-for="CopyProductModel.Name" class="control-label col-8 col-md-4 col-sm-4" />- <div class="col-4 col-md-8 col-sm-8">- <admin-input asp-for="CopyProductModel.Name" />- </div>- </div>- <div class="form-group">- <admin-label asp-for="CopyProductModel.Published" class="control-label col-8 col-md-4 col-sm-4" />- <div class="col-4 col-md-8 col-sm-8">- <admin-input asp-for="CopyProductModel.Published" />- </div>+<div id="copyproduct-window" style="display:none;">+ <form asp-area="@Constants.AreaVendor" asp-controller="Product" asp-action="CopyProduct" method="post">++ <input asp-for="CopyProductModel.Id" type="hidden"/>+ <div class="form-horizontal">+ <div class="form-body">+ <div class="form-group">+ <admin-label asp-for="CopyProductModel.Name" class="control-label col-8 col-md-4 col-sm-4"/>+ <div class="col-4 col-md-8 col-sm-8">+ <admin-input asp-for="CopyProductModel.Name"/></div>- <div class="form-group">- <admin-label asp-for="CopyProductModel.CopyImages" class="control-label col-8 col-md-4 col-sm-4" />- <div class="col-4 col-md-8 col-sm-8">- <admin-input asp-for="CopyProductModel.CopyImages" />- </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="CopyProductModel.Published" class="control-label col-8 col-md-4 col-sm-4"/>+ <div class="col-4 col-md-8 col-sm-8">+ <admin-input asp-for="CopyProductModel.Published"/></div></div>- <div class="form-actions">- <div class="offset-md-3 offset-sm-3 col-md-6 col-sm-6">- <input type="submit" class="btn green" value="@Loc["Vendor.Catalog.Products.Copy"]" />+ <div class="form-group">+ <admin-label asp-for="CopyProductModel.CopyImages" class="control-label col-8 col-md-4 col-sm-4"/>+ <div class="col-4 col-md-8 col-sm-8">+ <admin-input asp-for="CopyProductModel.CopyImages"/></div></div></div>- </form>- </div>- <script>+ <div class="form-actions">+ <div class="offset-md-3 offset-sm-3 col-md-6 col-sm-6">+ <input type="submit" class="btn green" value="@Loc["Vendor.Catalog.Products.Copy"]"/>+ </div>+ </div>+ </div>+ </form>+</div>+<script>$(document).ready(function () {$("#copyproduct").click(function (e) {e.preventDefault();@@ -89,4 +97,4 @@window.data('kendoWindow').center().open();});});- </script>+ </script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Additional.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Additional.cshtmlindex 2ae45dc44..c9b236134 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Additional.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Additional.cshtml@@ -1,6 +1,7 @@-@model ProductModel+@using Grand.Domain.Media+@model ProductModel@{- ViewData["DownloadType"] = Grand.Domain.Media.DownloadType.Product;+ ViewData["DownloadType"] = DownloadType.Product;ViewData["ReferenceId"] = Model.Id;}<vc:vendor-widget widget-zone="vendor_product_details_additional_top" additional-data="Model"/>diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.AssociatedProducts.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.AssociatedProducts.cshtmlindex 2ae8a9e29..36176b7d8 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.AssociatedProducts.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.AssociatedProducts.cshtml@@ -6,7 +6,7 @@<p>@Loc["Vendor.Catalog.Products.AssociatedProducts.Note2"]</p></div><div class="panel panel-default">- <vc:vendor-widget widget-zone="vendor_product_details_associated_products_top" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_associated_products_top" additional-data="Model"/><div class="panel-body"><div id="associatedproducts-grid"></div></div>@@ -14,9 +14,9 @@<a id="btnAddNewAssociatedProduct" href="@(Url.Action("AssociatedProductAddPopup", "Product", new { productId = Model.Id, btnId = "btnRefreshAssociatedProducts", formId = "product-form", area = Constants.AreaVendor }))" class="k-button">@Loc["Vendor.Catalog.Products.AssociatedProducts.AddNew"]</a>- <input type="submit" id="btnRefreshAssociatedProducts" style="display: none" />+ <input type="submit" id="btnRefreshAssociatedProducts" style="display: none"/></div>- <vc:vendor-widget widget-zone="vendor_product_details_associated_products_bottom" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_associated_products_bottom" additional-data="Model"/></div><script>$(document).ready(function () {@@ -98,7 +98,7 @@columns: [{field: "ProductName",title: "@Loc["Vendor.Catalog.Products.AssociatedProducts.Fields.Product"]",- template: '<a class="k-link" href="@Url.Action("Edit", "Product", new { id ="", area = Constants.AreaVendor })/#=Id#">#=kendo.htmlEncode(ProductName)#</a>'+ template: '<a class="k-link" href="@Url.Action("Edit", "Product", new { id = "", area = Constants.AreaVendor })/#=Id#">#=kendo.htmlEncode(ProductName)#</a>'}, {field: "DisplayOrder",title: "@Loc["Vendor.Catalog.Products.AssociatedProducts.Fields.DisplayOrder"]",@@ -122,7 +122,7 @@});});</script>-+<script>$(document).ready(function () {$('#btnRefreshAssociatedProducts').click(function () {@@ -135,7 +135,6 @@});});</script>-}else{diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Bids.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Bids.cshtmlindex ce8a67f3d..6b4a5fba0 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Bids.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Bids.cshtml@@ -2,14 +2,14 @@@inject AdminAreaSettings adminAreaSettings@if (!string.IsNullOrEmpty(Model.Id)){- <input asp-for="AuctionEnded" type="hidden" />+ <input asp-for="AuctionEnded" type="hidden"/><div class="panel panel-default">- <vc:vendor-widget widget-zone="vendor_product_details_bids_top" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_bids_top" additional-data="Model"/><div class="panel-body"><div id="bids-grid"></div></div>- <vc:vendor-widget widget-zone="vendor_product_details_bids_bottom" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_bids_bottom" additional-data="Model"/></div><script>$(document).ready(function () {diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.BundleProducts.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.BundleProducts.cshtmlindex f4a5acdcf..63c4c4c22 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.BundleProducts.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.BundleProducts.cshtml@@ -3,19 +3,19 @@@if (!string.IsNullOrEmpty(Model.Id)){-<div class="panel panel-default">- <vc:vendor-widget widget-zone="vendor_product_details_bundle_products_top" additional-data="Model" />- <div class="panel-body">- <div id="bundleproducts-grid"></div>+ <div class="panel panel-default">+ <vc:vendor-widget widget-zone="vendor_product_details_bundle_products_top" additional-data="Model"/>+ <div class="panel-body">+ <div id="bundleproducts-grid"></div>+ </div>+ <div class="panel-footer">+ <a id="btnAddNewBundleProduct" href="@(Url.Action("BundleProductAddPopup", "Product", new { productId = Model.Id, btnId = "btnRefreshBundleProducts", formId = "product-form", area = Constants.AreaVendor }))" class="k-button">+ @Loc["Vendor.Catalog.Products.BundleProducts.AddNew"]+ </a>+ <input type="submit" id="btnRefreshBundleProducts" style="display: none"/>+ </div>+ <vc:vendor-widget widget-zone="vendor_product_details_bundle_products_bottom" additional-data="Model"/></div>- <div class="panel-footer">- <a id="btnAddNewBundleProduct" href="@(Url.Action("BundleProductAddPopup", "Product", new { productId = Model.Id, btnId = "btnRefreshBundleProducts", formId = "product-form", area = Constants.AreaVendor }))" class="k-button">- @Loc["Vendor.Catalog.Products.BundleProducts.AddNew"]- </a>- <input type="submit" id="btnRefreshBundleProducts" style="display: none" />- </div>- <vc:vendor-widget widget-zone="vendor_product_details_bundle_products_bottom" additional-data="Model" />-</div><script>$(document).ready(function () {@@ -127,7 +127,7 @@});});</script>-+<script>$(document).ready(function () {$('#btnRefreshBundleProducts').click(function () {@@ -140,7 +140,6 @@});});</script>-}else{diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Calendar.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Calendar.cshtmlindex 92d58ef15..09d954ee2 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Calendar.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Calendar.cshtml@@ -2,75 +2,75 @@@inject AdminAreaSettings adminAreaSettings@if (!string.IsNullOrEmpty(Model.Id)){- <input type="hidden" asp-for="CalendarModel.ProductId" />+ <input type="hidden" asp-for="CalendarModel.ProductId"/>- <vc:vendor-widget widget-zone="vendor_product_details_calendar_top" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_calendar_top" additional-data="Model"/><div class="form-horizontal"><h2>@Loc["Vendor.Catalog.Products.Calendar.Calendarconfiguration"]</h2><div class="form-body"><div class="form-group"><div class="form-group">- <admin-label asp-for="CalendarModel.StartDate" />+ <admin-label asp-for="CalendarModel.StartDate"/><div class="col-md-3 col-sm-3">- <admin-input asp-for="CalendarModel.StartDate" />+ <admin-input asp-for="CalendarModel.StartDate"/></div><div class="col-md-6" id="pnlStartTime"><label class="col-md-3 control-label">@Loc["Vendor.Catalog.Products.Fields.Calendar.StartTime"]</label><div class="col-md-3 col-sm-3">- <admin-input asp-for="CalendarModel.StartTime" />+ <admin-input asp-for="CalendarModel.StartTime"/></div></div></div><div class="form-group">- <admin-label asp-for="CalendarModel.EndDate" />+ <admin-label asp-for="CalendarModel.EndDate"/><div class="col-md-3 col-sm-3">- <admin-input asp-for="CalendarModel.EndDate" />+ <admin-input asp-for="CalendarModel.EndDate"/></div><div class="col-md-6" id="pnlEndTime"><label class="col-md-3 control-label">@Loc["Vendor.Catalog.Products.Fields.Calendar.EndTime"]</label><div class="col-md-3 col-sm-3">- <admin-input asp-for="CalendarModel.EndTime" />+ <admin-input asp-for="CalendarModel.EndTime"/></div></div></div><div class="form-group" id="pnlIncludeBothDates">- <admin-label asp-for="CalendarModel.IncBothDate" />+ <admin-label asp-for="CalendarModel.IncBothDate"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="CalendarModel.IncBothDate" />- <div class="control__indicator"></div>+ <admin-input asp-for="CalendarModel.IncBothDate"/>+ <div class="control__indicator"></div></label></div></div></div><div class="form-group">- <admin-label asp-for="CalendarModel.Interval" />+ <admin-label asp-for="CalendarModel.Interval"/><div class="col-md-9 col-sm-9"><span id="pnlInterval">- <admin-input asp-for="CalendarModel.Interval" />+ <admin-input asp-for="CalendarModel.Interval"/></span>- <admin-select asp-for="CalendarModel.IntervalUnit" asp-items="((IntervalUnit)Model.CalendarModel.IntervalUnit).ToSelectList(Context)" class="form-control input-xsmall" style="height: 30px;padding: 0px; margin-bottom: 3px; margin-top: 3px; " />+ <admin-select asp-for="CalendarModel.IntervalUnit" asp-items="((IntervalUnit)Model.CalendarModel.IntervalUnit).ToSelectList(Context)" class="form-control input-xsmall" style="height: 30px;padding: 0px; margin-bottom: 3px; margin-top: 3px; "/></div></div><div class="form-group" id="pnlQuantity">- <admin-label asp-for="CalendarModel.Quantity" />+ <admin-label asp-for="CalendarModel.Quantity"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="CalendarModel.Quantity" />+ <admin-input asp-for="CalendarModel.Quantity"/></div></div><div class="form-group" id="pnlResource">- <admin-label asp-for="CalendarModel.Resource" />+ <admin-label asp-for="CalendarModel.Resource"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="CalendarModel.Resource" />+ <admin-input asp-for="CalendarModel.Resource"/></div></div><div class="form-group" id="pnlParameter">- <admin-label asp-for="CalendarModel.Parameter" />+ <admin-label asp-for="CalendarModel.Parameter"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="CalendarModel.Parameter" />+ <admin-input asp-for="CalendarModel.Parameter"/></div></div><div class="portlet">@@ -81,39 +81,39 @@<div class="form-group"><div class="mt-checkbox-inline "><label class="mt-checkbox control control-checkbox">- <admin-input asp-for="CalendarModel.Monday" />+ <admin-input asp-for="CalendarModel.Monday"/>@Loc["Vendor.Catalog.Products.Fields.Calendar.Monday"]- <div class="control__indicator"></div>+ <div class="control__indicator"></div></label><label class="mt-checkbox control control-checkbox">- <admin-input asp-for="CalendarModel.Tuesday" />+ <admin-input asp-for="CalendarModel.Tuesday"/>@Loc["Vendor.Catalog.Products.Fields.Calendar.Tuesday"]- <div class="control__indicator"></div>+ <div class="control__indicator"></div></label><label class="mt-checkbox control control-checkbox">- <admin-input asp-for="CalendarModel.Wednesday" />+ <admin-input asp-for="CalendarModel.Wednesday"/>@Loc["Vendor.Catalog.Products.Fields.Calendar.Wednesday"]- <div class="control__indicator"></div>+ <div class="control__indicator"></div></label><label class="mt-checkbox control control-checkbox">- <admin-input asp-for="CalendarModel.Thursday" />+ <admin-input asp-for="CalendarModel.Thursday"/>@Loc["Vendor.Catalog.Products.Fields.Calendar.Thursday"]- <div class="control__indicator"></div>+ <div class="control__indicator"></div></label><label class="mt-checkbox control control-checkbox">- <admin-input asp-for="CalendarModel.Friday" />+ <admin-input asp-for="CalendarModel.Friday"/>@Loc["Vendor.Catalog.Products.Fields.Calendar.Friday"]- <div class="control__indicator"></div>+ <div class="control__indicator"></div></label><label class="mt-checkbox control control-checkbox">- <admin-input asp-for="CalendarModel.Saturday" />+ <admin-input asp-for="CalendarModel.Saturday"/>@Loc["Vendor.Catalog.Products.Fields.Calendar.Saturday"]- <div class="control__indicator"></div>+ <div class="control__indicator"></div></label><label class="mt-checkbox control control-checkbox">- <admin-input asp-for="CalendarModel.Sunday" />+ <admin-input asp-for="CalendarModel.Sunday"/>@Loc["Vendor.Catalog.Products.Fields.Calendar.Sunday"]- <div class="control__indicator"></div>+ <div class="control__indicator"></div></label></div></div>@@ -131,7 +131,7 @@<div id="reservations-grid"></div></div></div>- <vc:vendor-widget widget-zone="vendor_product_details_calendar_bottom" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_calendar_bottom" additional-data="Model"/><script>$(document).ready(function () {@@ -166,11 +166,11 @@var datepickerFrom = $("#@Html.IdFor(model => model.CalendarModel.StartDate)").data("kendoDatePicker");var dateFrom = datepickerFrom.value();- dateFrom = kendo.toString(dateFrom, "@System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern");+ dateFrom = kendo.toString(dateFrom, "@CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern");var datepickerTo = $("#@Html.IdFor(model => model.CalendarModel.EndDate)").data("kendoDatePicker");var dateTo = datepickerTo.value();- dateTo = kendo.toString(dateTo, "@System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern");+ dateTo = kendo.toString(dateTo, "@CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern");var timeFrom = $("#@Html.IdFor(model => model.CalendarModel.StartTime)").data("kendoTimePicker");var hourFrom = timeFrom.value();@@ -373,4 +373,4 @@ else<div class="note note-info">@Loc["Vendor.Catalog.Products.Calendar.SaveBeforeEdit"]</div>-}+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Categories.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Categories.cshtmlindex 6ebe05ee8..caa71acdd 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Categories.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Categories.cshtml@@ -4,14 +4,14 @@@if (!string.IsNullOrEmpty(Model.Id)){<div class="panel panel-default">- <vc:vendor-widget widget-zone="vendor_product_details_categories_top" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_categories_top" additional-data="Model"/><div class="panel-heading">@Loc["Vendor.Catalog.Products.Categories.Fields.Category"]</div><div class="panel-body"><div id="productcategories-grid"></div></div>- <vc:vendor-widget widget-zone="vendor_product_details_categories_bottom" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_categories_bottom" additional-data="Model"/></div><script>$(document).ready(function () {@@ -161,5 +161,4 @@ else<div class="note note-info">@Loc["Vendor.Catalog.Products.Categories.SaveBeforeEdit"]</div>-}-+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Collections.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Collections.cshtmlindex b823db2ef..a11b521a6 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Collections.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Collections.cshtml@@ -2,14 +2,14 @@@if (!string.IsNullOrEmpty(Model.Id)){<div class="panel panel-default">- <vc:vendor-widget widget-zone="vendor_product_details_collections_top" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_collections_top" additional-data="Model"/><div class="panel-heading">@Loc["Vendor.Catalog.Products.Collections.Fields.Collection"]</div><div class="panel-body"><div id="productcollections-grid"></div></div>- <vc:vendor-widget widget-zone="vendor_product_details_collections_bottom" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_collections_bottom" additional-data="Model"/></div>@@ -159,4 +159,4 @@ else<div class="note note-info">@Loc["Vendor.Catalog.Products.Collections.SaveBeforeEdit"]</div>-}+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.CrossSells.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.CrossSells.cshtmlindex c65371b37..bb1365bbb 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.CrossSells.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.CrossSells.cshtml@@ -2,9 +2,8 @@@if (!string.IsNullOrEmpty(Model.Id)){-<div class="panel panel-default">- <vc:vendor-widget widget-zone="vendor_product_details_cross_sells_top" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_cross_sells_top" additional-data="Model"/><div class="panel-heading">@Loc["Vendor.Catalog.Products.CrossSells"]</div>@@ -13,9 +12,9 @@</div><div class="panel-footer"><a id="btnAddNewCrossSellProduct" href="@(Url.Action("CrossSellProductAddPopup", "Product", new { productId = Model.Id, btnId = "btnRefreshCrossSellProducts", formId = "product-form", area = Constants.AreaVendor }))" class="k-button"><i class="fa fa-plus"></i> @Loc["Vendor.Catalog.Products.CrossSells.AddNew"]</a>- <input type="submit" id="btnRefreshCrossSellProducts" style="display: none" />+ <input type="submit" id="btnRefreshCrossSellProducts" style="display: none"/></div>- <vc:vendor-widget widget-zone="vendor_product_details_cross_sells_bottom" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_cross_sells_bottom" additional-data="Model"/></div><script>@@ -95,7 +94,7 @@});});</script>-+<script>$(document).ready(function () {$('#btnRefreshCrossSellProducts').click(function () {@@ -108,7 +107,6 @@});});</script>-}else{diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Info.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Info.cshtmlindex de0b1bffc..d367cc5d4 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Info.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Info.cshtml@@ -1,5 +1,5 @@-@model ProductModel-@using Microsoft.AspNetCore.Mvc.Razor;+@using Microsoft.AspNetCore.Mvc.Razor+@model ProductModel<script>$(document).ready(function() {@@ -34,7 +34,7 @@function toggleProductType() {var selectedProductTypeId = $("#@Html.IdFor(model => model.ProductTypeId)").val();- if (selectedProductTypeId == @(((int) ProductType.SimpleProduct).ToString())) {+ if (selectedProductTypeId == @(((int)ProductType.SimpleProduct).ToString())) {$('#group-required-other-products').show();$('#group-giftvoucher').show();$('#group-recurring').show();@@ -49,7 +49,7 @@$('#tab-calendar').hide();$('#tab-bundle-products').hide();$('#tab-bids').hide();- } else if (selectedProductTypeId == @(((int) ProductType.GroupedProduct).ToString())) {+ } else if (selectedProductTypeId == @(((int)ProductType.GroupedProduct).ToString())) {$('#group-required-other-products').hide();$('#group-giftvoucher').hide();$('#group-recurring').hide();@@ -64,7 +64,7 @@$('#tab-calendar').hide();$('#tab-bundle-products').hide();$('#tab-bids').hide();- } else if (selectedProductTypeId == @(((int) ProductType.Reservation).ToString())){+ } else if (selectedProductTypeId == @(((int)ProductType.Reservation).ToString())){$('#group-required-other-products').show();$('#group-giftvoucher').show();$('#group-shipping').show();@@ -86,7 +86,7 @@$("#@Html.IdFor(model => model.IsRecurring)").prop("checked", false);toggleShipping();$('#tab-inventory-product').hide();- } else if (selectedProductTypeId == @(((int) ProductType.BundledProduct).ToString())){+ } else if (selectedProductTypeId == @(((int)ProductType.BundledProduct).ToString())){$('#group-required-other-products').hide();$('#group-giftvoucher').hide();$('#group-recurring').hide();@@ -102,7 +102,7 @@$('#tab-bundle-products').show();$('#tab-bids').hide();$("#@Html.IdFor(model => model.IsRecurring)").prop("checked", false);- } else if (selectedProductTypeId == @(((int) ProductType.Auction).ToString())){+ } else if (selectedProductTypeId == @(((int)ProductType.Auction).ToString())){$('#tab-bids').show();$('#tab-calendar').hide();$('#tab-bundle-products').hide();@@ -212,7 +212,7 @@function toggleManageStock() {var selectedManageInventoryMethodId = $("#@Html.IdFor(model => model.ManageInventoryMethodId)").val();- if (selectedManageInventoryMethodId == @(((int) ManageInventoryMethod.DontManageStock).ToString())) {+ if (selectedManageInventoryMethodId == @(((int)ManageInventoryMethod.DontManageStock).ToString())) {$('#pnlUseMultipleWarehouses').hide();$('#pnlWarehouse').show();$('#pnlMultipleWarehouses').hide();@@ -225,7 +225,7 @@$('#pnlNotifyForQuantityBelow').hide();$('#pnlAllowOutOfStockSubscriptions').hide();$('#pnlBackorders').hide();- } else if (selectedManageInventoryMethodId == @(((int) ManageInventoryMethod.ManageStockByBundleProducts).ToString())) {+ } else if (selectedManageInventoryMethodId == @(((int)ManageInventoryMethod.ManageStockByBundleProducts).ToString())) {$('#pnlWarehouse').hide();$('#pnlUseMultipleWarehouses').hide();$('#pnlMultipleWarehouses').hide();@@ -238,7 +238,7 @@$('#pnlNotifyForQuantityBelow').hide();$('#pnlAllowOutOfStockSubscriptions').hide();$('#pnlBackorders').hide();- }else if (selectedManageInventoryMethodId == @(((int) ManageInventoryMethod.ManageStock).ToString())) {+ }else if (selectedManageInventoryMethodId == @(((int)ManageInventoryMethod.ManageStock).ToString())) {$('#pnlUseMultipleWarehouses').show();if ($('#@Html.IdFor(model => model.UseMultipleWarehouses)').is(':checked')) {@@ -266,14 +266,14 @@$('#pnlNotifyForQuantityBelow').show();$('#pnlBackorders').show();var selectedBackorderModeId = $("#@Html.IdFor(model => model.BackorderModeId)").val();- if (selectedBackorderModeId == @(((int) BackorderMode.NoBackorders).ToString())) {+ if (selectedBackorderModeId == @(((int)BackorderMode.NoBackorders).ToString())) {//no backorders$('#pnlAllowOutOfStockSubscriptions').show();} else {//backorders are enabled$('#pnlAllowOutOfStockSubscriptions').hide();}- } else if (selectedManageInventoryMethodId == @(((int) ManageInventoryMethod.ManageStockByAttributes).ToString())) {+ } else if (selectedManageInventoryMethodId == @(((int)ManageInventoryMethod.ManageStockByAttributes).ToString())) {$('#pnlUseMultipleWarehouses').show();$('#pnlMultipleWarehouses').hide();$('#pnlStockQuantity').hide();@@ -294,7 +294,7 @@$('#pnlDisplayStockQuantity').hide();}var selectedBackorderModeId = $("#@Html.IdFor(model => model.BackorderModeId)").val();- if (selectedBackorderModeId == @(((int) BackorderMode.NoBackorders).ToString())) {+ if (selectedBackorderModeId == @(((int)BackorderMode.NoBackorders).ToString())) {//no backorders$('#pnlAllowOutOfStockSubscriptions').show();} else {@@ -380,21 +380,21 @@}</script>-<vc:vendor-widget widget-zone="vendor_product_details_info_column_left_top" additional-data="Model" />+<vc:vendor-widget widget-zone="vendor_product_details_info_column_left_top" additional-data="Model"/><div class="form-horizontal"><div class="form-body"><div class="form-group">- <admin-label asp-for="ProductTypeId" />+ <admin-label asp-for="ProductTypeId"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="ProductTypeId" asp-items="((ProductType)Model.ProductTypeId).ToSelectList(Context)" />+ <admin-select asp-for="ProductTypeId" asp-items="((ProductType)Model.ProductTypeId).ToSelectList(Context)"/><span asp-validation-for="ProductTypeId"></span></div></div><div class="form-group">- <admin-label asp-for="VisibleIndividually" />+ <admin-label asp-for="VisibleIndividually"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="VisibleIndividually" />+ <admin-input asp-for="VisibleIndividually"/><div class="control__indicator"></div></label><span asp-validation-for="VisibleIndividually"></span>@@ -403,7 +403,7 @@@if (!string.IsNullOrEmpty(Model.Id) && !string.IsNullOrEmpty(Model.AssociatedToProductId) && !string.IsNullOrEmpty(Model.AssociatedToProductName)){<div class="form-group">- <admin-label asp-for="AssociatedToProductId" />+ <admin-label asp-for="AssociatedToProductId"/><div class="col-md-9 col-sm-9"><label class="control-label">@Html.ActionLink(Model.AssociatedToProductName, "Edit", "Product", new { id = Model.AssociatedToProductId }, new { })@@ -412,61 +412,62 @@</div>}<div class="form-group">- <admin-label asp-for="ProductLayoutId" />+ <admin-label asp-for="ProductLayoutId"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="ProductLayoutId" asp-items="Model.AvailableProductLayouts" />+ <admin-select asp-for="ProductLayoutId" asp-items="Model.AvailableProductLayouts"/><span asp-validation-for="ProductLayoutId"></span></div></div></div>- @{ Func<int, HelperResult>- template = @<div class="form-body">- <div class="form-group">- <admin-label asp-for="@Model.Locales[item].Name" />- <div class="col-md-9 col-sm-9">- <admin-input asp-for="@Model.Locales[item].Name" />- <span asp-validation-for="@Model.Locales[item].Name"></span>+ @{+ Func<int, HelperResult>+ template = @<div class="form-body">+ <div class="form-group">+ <admin-label asp-for="@Model.Locales[item].Name"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="@Model.Locales[item].Name"/>+ <span asp-validation-for="@Model.Locales[item].Name"></span>+ </div></div>- </div>- <div class="form-group">- <admin-label asp-for="@Model.Locales[item].ShortDescription" />- <div class="col-md-9 col-sm-9">- <admin-textarea asp-for="@Model.Locales[item].ShortDescription"></admin-textarea>- <span asp-validation-for="@Model.Locales[item].ShortDescription"></span>+ <div class="form-group">+ <admin-label asp-for="@Model.Locales[item].ShortDescription"/>+ <div class="col-md-9 col-sm-9">+ <admin-textarea asp-for="@Model.Locales[item].ShortDescription"></admin-textarea>+ <span asp-validation-for="@Model.Locales[item].ShortDescription"></span>+ </div></div>- </div>- <div class="form-group">- <admin-label asp-for="@Model.Locales[item].FullDescription" />- <div class="col-md-9 col-sm-9">- <admin-input asp-for="@Model.Locales[item].FullDescription" asp-template="Editor" />- <span asp-validation-for="@Model.Locales[item].FullDescription"></span>+ <div class="form-group">+ <admin-label asp-for="@Model.Locales[item].FullDescription"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="@Model.Locales[item].FullDescription" asp-template="Editor"/>+ <span asp-validation-for="@Model.Locales[item].FullDescription"></span>+ </div></div>- </div>- <input asp-for="@Model.Locales[item].LanguageId" type="hidden" />- </div>;+ <input asp-for="@Model.Locales[item].LanguageId" type="hidden"/>+ </div>;}- <localized-editor localized-template=@template name="product-info-localized" [email protected](c=>c.LanguageId).ToList()>+ <localized-editor localized-template="@template" name="product-info-localized" language-ids="@Model.Locales.Select(c => c.LanguageId).ToList()"><div class="form-body"><div class="form-group">- <admin-label asp-for="Name" />+ <admin-label asp-for="Name"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Name" />+ <admin-input asp-for="Name"/><span asp-validation-for="Name"></span></div></div><div class="form-group">- <admin-label asp-for="ShortDescription" />+ <admin-label asp-for="ShortDescription"/><div class="col-md-9 col-sm-9"><admin-textarea asp-for="ShortDescription"></admin-textarea><span asp-validation-for="ShortDescription"></span></div></div><div class="form-group">- <admin-label asp-for="FullDescription" />+ <admin-label asp-for="FullDescription"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="FullDescription" asp-template="Editor" />+ <admin-input asp-for="FullDescription" asp-template="Editor"/><span asp-validation-for="FullDescription"></span></div></div>@@ -475,54 +476,54 @@<div class="form-body"><div class="form-group">- <admin-label asp-for="Flag" />+ <admin-label asp-for="Flag"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Flag" />+ <admin-input asp-for="Flag"/><span asp-validation-for="Flag"></span></div></div><div class="form-group">- <admin-label asp-for="AdminComment" />+ <admin-label asp-for="AdminComment"/><div class="col-md-9 col-sm-9"><admin-textarea asp-for="AdminComment"></admin-textarea><span asp-validation-for="AdminComment"></span></div></div><div class="form-group">- <admin-label asp-for="BrandId" />+ <admin-label asp-for="BrandId"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="BrandId" />+ <admin-input asp-for="BrandId"/><span asp-validation-for="BrandId"></span></div></div><div class="form-group">- <admin-label asp-for="AllowCustomerReviews" />+ <admin-label asp-for="AllowCustomerReviews"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="AllowCustomerReviews" />+ <admin-input asp-for="AllowCustomerReviews"/><div class="control__indicator"></div></label><span asp-validation-for="AllowCustomerReviews"></span></div></div><div class="form-group">- <admin-label asp-for="Sku" />+ <admin-label asp-for="Sku"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Sku" />+ <admin-input asp-for="Sku"/><span asp-validation-for="Sku"></span></div></div><div class="form-group">- <admin-label asp-for="Mpn" />+ <admin-label asp-for="Mpn"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Mpn" />+ <admin-input asp-for="Mpn"/><span asp-validation-for="Mpn"></span></div></div><div class="form-group">- <admin-label asp-for="Gtin" />+ <admin-label asp-for="Gtin"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Gtin" />+ <admin-input asp-for="Gtin"/><span asp-validation-for="Gtin"></span></div></div>@@ -531,48 +532,48 @@<div class="form-horizontal"><div class="form-body"><div class="form-group">- <admin-label asp-for="AvailableStartDateTime" />+ <admin-label asp-for="AvailableStartDateTime"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="AvailableStartDateTime" />+ <admin-input asp-for="AvailableStartDateTime"/><span asp-validation-for="AvailableStartDateTime"></span></div></div><div class="form-group">- <admin-label asp-for="AvailableEndDateTime" />+ <admin-label asp-for="AvailableEndDateTime"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="AvailableEndDateTime" />+ <admin-input asp-for="AvailableEndDateTime"/><span asp-validation-for="AvailableEndDateTime"></span></div></div><div class="form-group">- <admin-label asp-for="MarkAsNew" />+ <admin-label asp-for="MarkAsNew"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="MarkAsNew" />+ <admin-input asp-for="MarkAsNew"/><div class="control__indicator"></div></label><span asp-validation-for="MarkAsNew"></span></div></div><div class="form-group" id="pnlMarkAsNewStartDateTime">- <admin-label asp-for="MarkAsNewStartDateTime" />+ <admin-label asp-for="MarkAsNewStartDateTime"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="MarkAsNewStartDateTime" />+ <admin-input asp-for="MarkAsNewStartDateTime"/><span asp-validation-for="MarkAsNewStartDateTime"></span></div></div><div class="form-group" id="pnlMarkAsNewEndDateTime">- <admin-label asp-for="MarkAsNewEndDateTime" />+ <admin-label asp-for="MarkAsNewEndDateTime"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="MarkAsNewEndDateTime" />+ <admin-input asp-for="MarkAsNewEndDateTime"/><span asp-validation-for="MarkAsNewEndDateTime"></span></div></div><div class="form-group">- <admin-label asp-for="Published" />+ <admin-label asp-for="Published"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="Published" />+ <admin-input asp-for="Published"/><div class="control__indicator"></div></label><span asp-validation-for="Published"></span>@@ -581,7 +582,7 @@@if (Model.CreatedOn.HasValue){<div class="form-group">- <admin-label asp-for="CreatedOn" />+ <admin-label asp-for="CreatedOn"/><div class="col-md-9 col-sm-9"><label class="control-label">@Model.CreatedOn.Value.ToString("F")</label></div>@@ -590,7 +591,7 @@@if (Model.UpdatedOn.HasValue){<div class="form-group">- <admin-label asp-for="UpdatedOn" />+ <admin-label asp-for="UpdatedOn"/><div class="col-md-9 col-sm-9"><label class="control-label">@Model.UpdatedOn.Value.ToString("F")</label></div>@@ -598,4 +599,4 @@}</div></div>-<vc:vendor-widget widget-zone="vendor_product_details_info_column_left_bottom" additional-data="Model" />\ No newline at end of file+<vc:vendor-widget widget-zone="vendor_product_details_info_column_left_bottom" additional-data="Model"/>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Inventory.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Inventory.cshtmlindex a08c10e56..a94d7dff6 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Inventory.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Inventory.cshtml@@ -1,78 +1,78 @@@model ProductModel-<vc:vendor-widget widget-zone="vendor_product_details_inventory_top" additional-data="Model" />+<vc:vendor-widget widget-zone="vendor_product_details_inventory_top" additional-data="Model"/><div class="form-horizontal portlet bg-inverse form-fit" id="group-inventory"><div class="form-body"><div class="form-group">- <admin-label asp-for="ManageInventoryMethodId" />+ <admin-label asp-for="ManageInventoryMethodId"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="ManageInventoryMethodId" asp-items="((ManageInventoryMethod)Model.ManageInventoryMethodId).ToSelectList(Context)" />+ <admin-select asp-for="ManageInventoryMethodId" asp-items="((ManageInventoryMethod)Model.ManageInventoryMethodId).ToSelectList(Context)"/><span asp-validation-for="ManageInventoryMethodId"></span></div></div><div class="form-group" id="pnlUseMultipleWarehouses">- <admin-label asp-for="UseMultipleWarehouses" />+ <admin-label asp-for="UseMultipleWarehouses"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="UseMultipleWarehouses" />+ <admin-input asp-for="UseMultipleWarehouses"/><div class="control__indicator"></div></label><span asp-validation-for="UseMultipleWarehouses"></span></div></div><div class="form-group" id="pnlWarehouse">- <admin-label asp-for="WarehouseId" />+ <admin-label asp-for="WarehouseId"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="WarehouseId" asp-items="Model.AvailableWarehouses" />+ <admin-select asp-for="WarehouseId" asp-items="Model.AvailableWarehouses"/><span asp-validation-for="WarehouseId"></span></div></div><div class="form-group" id="pnlMultipleWarehouses">- <admin-label asp-for="ProductWarehouseInventoryModels" />+ <admin-label asp-for="ProductWarehouseInventoryModels"/><div class="col-md-9 col-sm-9">@if (Model.ProductWarehouseInventoryModels.Count > 0){<table style="width: 600px; border-collapse: collapse;"><thead>- <tr>- <th>- @Loc["Vendor.Catalog.Products.ProductWarehouseInventory.Fields.Warehouse"]- </th>- <th align="center">- @Loc["Vendor.Catalog.Products.ProductWarehouseInventory.Fields.WarehouseUsed"]- </th>- <th align="center">- @Loc["Vendor.Catalog.Products.ProductWarehouseInventory.Fields.StockQuantity"]- </th>- <th align="center">- @Loc["Vendor.Catalog.Products.ProductWarehouseInventory.Fields.ReservedQuantity"]- </th>- </tr>+ <tr>+ <th>+ @Loc["Vendor.Catalog.Products.ProductWarehouseInventory.Fields.Warehouse"]+ </th>+ <th align="center">+ @Loc["Vendor.Catalog.Products.ProductWarehouseInventory.Fields.WarehouseUsed"]+ </th>+ <th align="center">+ @Loc["Vendor.Catalog.Products.ProductWarehouseInventory.Fields.StockQuantity"]+ </th>+ <th align="center">+ @Loc["Vendor.Catalog.Products.ProductWarehouseInventory.Fields.ReservedQuantity"]+ </th>+ </tr></thead><tbody>- @for (var i = 0; i < Model.ProductWarehouseInventoryModels.Count; i++)- {- var item = Model.ProductWarehouseInventoryModels[i];- <tr>- <td style="width: 40%;">- <div style="padding-left: 10px; padding-right: 10px;">- @item.WarehouseName (@item.WarehouseCode)- <input asp-for="@Model.ProductWarehouseInventoryModels[i].WarehouseId" type="hidden" />- </div>- </td>- <td align="center" style="width: 10%;">- <label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="@Model.ProductWarehouseInventoryModels[i].WarehouseUsed" />- <div class="control__indicator"></div>- </label>- <td align="center" style="width: 20%;">- <admin-input asp-for="@Model.ProductWarehouseInventoryModels[i].StockQuantity" />- </td>- <td align="center" style="width: 20%;">- <admin-input asp-for="@Model.ProductWarehouseInventoryModels[i].ReservedQuantity" />- </td>-- </tr>- }+ @for (var i = 0; i < Model.ProductWarehouseInventoryModels.Count; i++)+ {+ var item = Model.ProductWarehouseInventoryModels[i];+ <tr>+ <td style="width: 40%;">+ <div style="padding-left: 10px; padding-right: 10px;">+ @item.WarehouseName (@item.WarehouseCode)+ <input asp-for="@Model.ProductWarehouseInventoryModels[i].WarehouseId" type="hidden"/>+ </div>+ </td>+ <td align="center" style="width: 10%;">+ <label class="mt-checkbox mt-checkbox-outline control control-checkbox">+ <admin-input asp-for="@Model.ProductWarehouseInventoryModels[i].WarehouseUsed"/>+ <div class="control__indicator"></div>+ </label>+ <td align="center" style="width: 20%;">+ <admin-input asp-for="@Model.ProductWarehouseInventoryModels[i].StockQuantity"/>+ </td>+ <td align="center" style="width: 20%;">+ <admin-input asp-for="@Model.ProductWarehouseInventoryModels[i].ReservedQuantity"/>+ </td>++ </tr>+ }</tbody></table><p>@@ -92,106 +92,106 @@</div></div><div class="form-group" id="pnlStockQuantity">- <admin-label asp-for="StockQuantity" />+ <admin-label asp-for="StockQuantity"/><div class="col-md-9 col-sm-9 form-inline">- <admin-input asp-for="StockQuantity" />+ <admin-input asp-for="StockQuantity"/><span asp-validation-for="StockQuantity"></span><span>- <admin-select asp-for="UnitId" asp-items="Model.AvailableUnits" class="form-control input-xsmall" />+ <admin-select asp-for="UnitId" asp-items="Model.AvailableUnits" class="form-control input-xsmall"/></span></div></div><div class="form-group" id="pnlReservedQuantity">- <admin-label asp-for="ReservedQuantity" />+ <admin-label asp-for="ReservedQuantity"/><div class="col-md-9 col-sm-9 form-inline">- <admin-input asp-for="ReservedQuantity" />+ <admin-input asp-for="ReservedQuantity"/><span asp-validation-for="ReservedQuantity"></span></div></div><div class="form-group" id="pnlDisplayStockAvailability">- <admin-label asp-for="StockAvailability" />+ <admin-label asp-for="StockAvailability"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="StockAvailability" />+ <admin-input asp-for="StockAvailability"/><div class="control__indicator"></div></label><span asp-validation-for="StockAvailability"></span></div></div><div class="form-group" id="pnlDisplayStockQuantity">- <admin-label asp-for="DisplayStockQuantity" />+ <admin-label asp-for="DisplayStockQuantity"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="DisplayStockQuantity" />+ <admin-input asp-for="DisplayStockQuantity"/><div class="control__indicator"></div></label><span asp-validation-for="DisplayStockQuantity"></span></div></div><div class="form-group" id="pnlMinStockQuantity">- <admin-label asp-for="MinStockQuantity" />+ <admin-label asp-for="MinStockQuantity"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="MinStockQuantity" />+ <admin-input asp-for="MinStockQuantity"/><span asp-validation-for="MinStockQuantity"></span></div></div><div class="form-group" id="pnlLowStockActivity">- <admin-label asp-for="LowStockActivityId" />+ <admin-label asp-for="LowStockActivityId"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="LowStockActivityId" asp-items="((LowStockActivity)Model.LowStockActivityId).ToSelectList(Context)" />+ <admin-select asp-for="LowStockActivityId" asp-items="((LowStockActivity)Model.LowStockActivityId).ToSelectList(Context)"/><span asp-validation-for="LowStockActivityId"></span></div></div><div class="form-group" id="pnlNotifyForQuantityBelow">- <admin-label asp-for="NotifyAdminForQuantityBelow" />+ <admin-label asp-for="NotifyAdminForQuantityBelow"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="NotifyAdminForQuantityBelow" />+ <admin-input asp-for="NotifyAdminForQuantityBelow"/><span asp-validation-for="NotifyAdminForQuantityBelow"></span></div></div><div class="form-group" id="pnlBackorders">- <admin-label asp-for="BackorderModeId" />+ <admin-label asp-for="BackorderModeId"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="BackorderModeId" asp-items="((BackorderMode)Model.BackorderModeId).ToSelectList(Context)" />+ <admin-select asp-for="BackorderModeId" asp-items="((BackorderMode)Model.BackorderModeId).ToSelectList(Context)"/><span asp-validation-for="BackorderModeId"></span></div></div><div class="form-group" id="pnlAllowOutOfStockSubscriptions">- <admin-label asp-for="AllowOutOfStockSubscriptions" />+ <admin-label asp-for="AllowOutOfStockSubscriptions"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="AllowOutOfStockSubscriptions" />+ <admin-input asp-for="AllowOutOfStockSubscriptions"/><div class="control__indicator"></div></label><span asp-validation-for="AllowOutOfStockSubscriptions"></span></div></div><div class="form-group">- <admin-label asp-for="OrderMinimumQuantity" />+ <admin-label asp-for="OrderMinimumQuantity"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="OrderMinimumQuantity" />+ <admin-input asp-for="OrderMinimumQuantity"/><span asp-validation-for="OrderMinimumQuantity"></span></div></div><div class="form-group">- <admin-label asp-for="OrderMaximumQuantity" />+ <admin-label asp-for="OrderMaximumQuantity"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="OrderMaximumQuantity" />+ <admin-input asp-for="OrderMaximumQuantity"/><span asp-validation-for="OrderMaximumQuantity"></span></div></div><div class="form-group">- <admin-label asp-for="AllowedQuantities" />+ <admin-label asp-for="AllowedQuantities"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="AllowedQuantities" />+ <admin-input asp-for="AllowedQuantities"/><span asp-validation-for="AllowedQuantities"></span></div></div><div class="form-group">- <admin-label asp-for="NotReturnable" />+ <admin-label asp-for="NotReturnable"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="NotReturnable" />+ <admin-input asp-for="NotReturnable"/><div class="control__indicator"></div></label><span asp-validation-for="NotReturnable"></span>@@ -202,77 +202,77 @@<div class="form-horizontal portlet bg-inverse form-fit" id="group-shipping"><div class="form-body"><div class="form-group">- <admin-label asp-for="IsShipEnabled" />+ <admin-label asp-for="IsShipEnabled"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="IsShipEnabled" />- <div class="control__indicator"></div>+ <admin-input asp-for="IsShipEnabled"/>+ <div class="control__indicator"></div></label><span asp-validation-for="IsShipEnabled"></span></div></div><div class="form-group" id="pnlFreeShipping">- <admin-label asp-for="IsFreeShipping" />+ <admin-label asp-for="IsFreeShipping"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="IsFreeShipping" />- <div class="control__indicator"></div>+ <admin-input asp-for="IsFreeShipping"/>+ <div class="control__indicator"></div></label><span asp-validation-for="IsFreeShipping"></span></div></div><div class="form-group" id="pnlShipSeparately">- <admin-label asp-for="ShipSeparately" />+ <admin-label asp-for="ShipSeparately"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="ShipSeparately" />- <div class="control__indicator"></div>+ <admin-input asp-for="ShipSeparately"/>+ <div class="control__indicator"></div></label><span asp-validation-for="ShipSeparately"></span></div></div><div class="form-group" id="pnlAdditionalShippingCharge">- <admin-label asp-for="AdditionalShippingCharge" />+ <admin-label asp-for="AdditionalShippingCharge"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="AdditionalShippingCharge" /> [@Model.PrimaryStoreCurrencyCode]+ <admin-input asp-for="AdditionalShippingCharge"/> [@Model.PrimaryStoreCurrencyCode]<span asp-validation-for="AdditionalShippingCharge"></span></div></div><div class="form-group" id="pnlWeight">- <admin-label asp-for="Weight" />+ <admin-label asp-for="Weight"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Weight" /> [@Model.BaseWeightIn]+ <admin-input asp-for="Weight"/> [@Model.BaseWeightIn]<span asp-validation-for="Weight"></span></div></div><div class="form-group" id="pnlLength">- <admin-label asp-for="Length" />+ <admin-label asp-for="Length"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Length" /> [@Model.BaseDimensionIn]+ <admin-input asp-for="Length"/> [@Model.BaseDimensionIn]<span asp-validation-for="Length"></span></div></div><div class="form-group" id="pnlWidth">- <admin-label asp-for="Width" />+ <admin-label asp-for="Width"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Width" /> [@Model.BaseDimensionIn]+ <admin-input asp-for="Width"/> [@Model.BaseDimensionIn]<span asp-validation-for="Width"></span></div></div><div class="form-group" id="pnlHeight">- <admin-label asp-for="Height" />+ <admin-label asp-for="Height"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Height" /> [@Model.BaseDimensionIn]+ <admin-input asp-for="Height"/> [@Model.BaseDimensionIn]<span asp-validation-for="Height"></span></div></div><div class="form-group" id="pnlDeliveryDate">- <admin-label asp-for="DeliveryDateId" />+ <admin-label asp-for="DeliveryDateId"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="DeliveryDateId" asp-items="Model.AvailableDeliveryDates" />+ <admin-select asp-for="DeliveryDateId" asp-items="Model.AvailableDeliveryDates"/><span asp-validation-for="DeliveryDateId"></span></div></div></div></div>-<vc:vendor-widget widget-zone="vendor_product_details_inventory_bottom" additional-data="Model" />\ No newline at end of file+<vc:vendor-widget widget-zone="vendor_product_details_inventory_bottom" additional-data="Model"/>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Pictures.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Pictures.cshtmlindex 67603ff0c..8f4f1f0b7 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Pictures.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Pictures.cshtml@@ -2,14 +2,14 @@@if (!string.IsNullOrEmpty(Model.Id)){-<div class="panel panel-default">- <vc:vendor-widget widget-zone="vendor_product_details_pictures_top" additional-data="Model" />- <div class="panel-body">- <div id="productpictures-grid"></div>+ <div class="panel panel-default">+ <vc:vendor-widget widget-zone="vendor_product_details_pictures_top" additional-data="Model"/>+ <div class="panel-body">+ <div id="productpictures-grid"></div>+ </div>+ <vc:vendor-widget widget-zone="vendor_product_details_pictures_bottom" additional-data="Model"/></div>- <vc:vendor-widget widget-zone="vendor_product_details_pictures_bottom" additional-data="Model" />-</div>-<script>+ <script>$(document).ready(function () {$("#productpictures-grid").kendoGrid({dataBound: function () {@@ -127,10 +127,10 @@ViewData["Click"] = "btnRefreshProductPictures";}<div class="col-md-9 col-sm-9">- <admin-input asp-for="AddPictureModel.PictureId" />+ <admin-input asp-for="AddPictureModel.PictureId"/><span asp-validation-for="AddPictureModel.PictureId"></span></div>- <input type="submit" id="btnRefreshProductPictures" style="display: none" />+ <input type="submit" id="btnRefreshProductPictures" style="display: none"/><script>$(document).ready(function () {$('#btnRefreshProductPictures').click(function () {diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Prices.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Prices.cshtmlindex dcecd6391..45c980070 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Prices.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Prices.cshtml@@ -1,176 +1,176 @@@model ProductModel-<vc:vendor-widget widget-zone="vendor_product_details_prices_top" additional-data="Model" />+<vc:vendor-widget widget-zone="vendor_product_details_prices_top" additional-data="Model"/><div class="form-horizontal portlet bg-inverse form-fit" id="group-prices"><div class="form-body"><div class="form-group">- <admin-label asp-for="Price" />+ <admin-label asp-for="Price"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Price" /> [@Model.PrimaryStoreCurrencyCode]+ <admin-input asp-for="Price"/> [@Model.PrimaryStoreCurrencyCode]<span asp-validation-for="Price"></span></div></div><div class="form-group">- <partial name="Partials/CreateOrUpdate.ProductPrices" model="Model" />+ <partial name="Partials/CreateOrUpdate.ProductPrices" model="Model"/></div><div class="form-group">- <admin-label asp-for="OldPrice" />+ <admin-label asp-for="OldPrice"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="OldPrice" /> [@Model.PrimaryStoreCurrencyCode]+ <admin-input asp-for="OldPrice"/> [@Model.PrimaryStoreCurrencyCode]<span asp-validation-for="OldPrice"></span></div></div><div class="form-group">- <admin-label asp-for="CatalogPrice" />+ <admin-label asp-for="CatalogPrice"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="CatalogPrice" /> [@Model.PrimaryStoreCurrencyCode]+ <admin-input asp-for="CatalogPrice"/> [@Model.PrimaryStoreCurrencyCode]<span asp-validation-for="CatalogPrice"></span></div></div><div class="form-group" id="pnlStartPrice">- <admin-label asp-for="StartPrice" />+ <admin-label asp-for="StartPrice"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="StartPrice" /> [@Model.PrimaryStoreCurrencyCode]+ <admin-input asp-for="StartPrice"/> [@Model.PrimaryStoreCurrencyCode]<span asp-validation-for="StartPrice"></span></div></div><div class="form-group">- <admin-label asp-for="ProductCost" />+ <admin-label asp-for="ProductCost"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="ProductCost" /> [@Model.PrimaryStoreCurrencyCode]+ <admin-input asp-for="ProductCost"/> [@Model.PrimaryStoreCurrencyCode]<span asp-validation-for="ProductCost"></span></div></div><div class="form-group">- <admin-label asp-for="DisableBuyButton" />+ <admin-label asp-for="DisableBuyButton"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="DisableBuyButton" />+ <admin-input asp-for="DisableBuyButton"/><div class="control__indicator"></div></label><span asp-validation-for="DisableBuyButton"></span></div></div><div class="form-group">- <admin-label asp-for="DisableWishlistButton" />+ <admin-label asp-for="DisableWishlistButton"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="DisableWishlistButton" />+ <admin-input asp-for="DisableWishlistButton"/><div class="control__indicator"></div></label><span asp-validation-for="DisableWishlistButton"></span></div></div><div class="form-group">- <admin-label asp-for="AvailableForPreOrder" />+ <admin-label asp-for="AvailableForPreOrder"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="AvailableForPreOrder" />+ <admin-input asp-for="AvailableForPreOrder"/><div class="control__indicator"></div></label><span asp-validation-for="AvailableForPreOrder"></span></div></div><div class="form-group" id="pnlPreOrderDateTime">- <admin-label asp-for="PreOrderDateTime" />+ <admin-label asp-for="PreOrderDateTime"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="PreOrderDateTime" />+ <admin-input asp-for="PreOrderDateTime"/><span asp-validation-for="PreOrderDateTime"></span></div></div><div class="form-group">- <admin-label asp-for="CallForPrice" />+ <admin-label asp-for="CallForPrice"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="CallForPrice" />+ <admin-input asp-for="CallForPrice"/><div class="control__indicator"></div></label><span asp-validation-for="CallForPrice"></span></div></div><div class="form-group">- <admin-label asp-for="EnteredPrice" />+ <admin-label asp-for="EnteredPrice"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="EnteredPrice" />+ <admin-input asp-for="EnteredPrice"/><div class="control__indicator"></div></label><span asp-validation-for="EnteredPrice"></span></div></div><div class="form-group" id="pnlMinEnteredPrice">- <admin-label asp-for="MinEnteredPrice" />+ <admin-label asp-for="MinEnteredPrice"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="MinEnteredPrice" /> [@Model.PrimaryStoreCurrencyCode]+ <admin-input asp-for="MinEnteredPrice"/> [@Model.PrimaryStoreCurrencyCode]<span asp-validation-for="MinEnteredPrice"></span></div></div><div class="form-group" id="pnlMaxEnteredPrice">- <admin-label asp-for="MaxEnteredPrice" />+ <admin-label asp-for="MaxEnteredPrice"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="MaxEnteredPrice" /> [@Model.PrimaryStoreCurrencyCode]+ <admin-input asp-for="MaxEnteredPrice"/> [@Model.PrimaryStoreCurrencyCode]<span asp-validation-for="MaxEnteredPrice"></span></div></div><div class="form-group">- <admin-label asp-for="BasepriceEnabled" />+ <admin-label asp-for="BasepriceEnabled"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="BasepriceEnabled" />+ <admin-input asp-for="BasepriceEnabled"/><div class="control__indicator"></div></label><span asp-validation-for="BasepriceEnabled"></span></div></div><div class="form-group" id="pnlBasepriceAmount">- <admin-label asp-for="BasepriceAmount" />+ <admin-label asp-for="BasepriceAmount"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="BasepriceAmount" />+ <admin-input asp-for="BasepriceAmount"/><span asp-validation-for="BasepriceAmount"></span></div></div><div class="form-group" id="pnlBasepriceUnit">- <admin-label asp-for="BasepriceUnitId" />+ <admin-label asp-for="BasepriceUnitId"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="BasepriceUnitId" asp-items="Model.AvailableBasepriceUnits" />+ <admin-select asp-for="BasepriceUnitId" asp-items="Model.AvailableBasepriceUnits"/><span asp-validation-for="BasepriceUnitId"></span></div></div><div class="form-group" id="pnlBasepriceBaseAmount">- <admin-label asp-for="BasepriceBaseAmount" />+ <admin-label asp-for="BasepriceBaseAmount"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="BasepriceBaseAmount" />+ <admin-input asp-for="BasepriceBaseAmount"/><span asp-validation-for="BasepriceBaseAmount"></span></div></div><div class="form-group" id="pnlBasepriceBaseUnit">- <admin-label asp-for="BasepriceBaseUnitId" />+ <admin-label asp-for="BasepriceBaseUnitId"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="BasepriceBaseUnitId" asp-items="Model.AvailableBasepriceBaseUnits" />+ <admin-select asp-for="BasepriceBaseUnitId" asp-items="Model.AvailableBasepriceBaseUnits"/><span asp-validation-for="BasepriceBaseUnitId"></span></div></div><div class="form-group">- <admin-label asp-for="IsTaxExempt" />+ <admin-label asp-for="IsTaxExempt"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="IsTaxExempt" />+ <admin-input asp-for="IsTaxExempt"/><div class="control__indicator"></div></label><span asp-validation-for="IsTaxExempt"></span></div></div><div class="form-group" id="pnlTaxCategory">- <admin-label asp-for="TaxCategoryId" />+ <admin-label asp-for="TaxCategoryId"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="TaxCategoryId" asp-items="Model.AvailableTaxCategories" />+ <admin-select asp-for="TaxCategoryId" asp-items="Model.AvailableTaxCategories"/><span asp-validation-for="TaxCategoryId"></span></div></div><div class="form-group" id="pnlIsTelecommunicationsOrBroadcastingOrElectronicServices">- <admin-label asp-for="IsTele" />+ <admin-label asp-for="IsTele"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox white-bg">- <admin-input asp-for="IsTele" />+ <admin-input asp-for="IsTele"/><div class="control__indicator"></div></label><span asp-validation-for="IsTele"></span>@@ -191,7 +191,7 @@</div><div class="panel-footer"><a id="btnAddNewTierPrice" href="@(Url.Action("TierPriceCreatePopup", "Product", new { productId = Model.Id, btnId = "btnRefreshTierPrices", formId = "product-form", area = Constants.AreaVendor }))" class="k-button"><i class="fa fa-plus"></i> @Loc["Vendor.Catalog.Products.TierPrices.AddNew"]</a>- <input type="submit" id="btnRefreshTierPrices" style="display: none" />+ <input type="submit" id="btnRefreshTierPrices" style="display: none"/></div></div>@@ -333,4 +333,4 @@ else</div>}-<vc:vendor-widget widget-zone="vendor_product_details_prices_bottom" additional-data="Model" />\ No newline at end of file+<vc:vendor-widget widget-zone="vendor_product_details_prices_bottom" additional-data="Model"/>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributeCombinations.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributeCombinations.cshtmlindex 0c2d69539..0725feba0 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributeCombinations.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributeCombinations.cshtml@@ -9,7 +9,7 @@</p></div><div class="panel panel-default">- <vc:vendor-widget widget-zone="vendor_product_details_product_attributes_combinations_top" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_product_attributes_combinations_top" additional-data="Model"/><div class="panel-body"><div id="attributecombinations-grid"></div></div>@@ -17,9 +17,9 @@<a id="btnAddNewCombination" href="@(Url.Action("AttributeCombinationPopup", "Product", new { productId = Model.Id, btnId = "btnRefreshCombinations", formId = "product-form", area = Constants.AreaVendor }))" class="k-button"><i class="fa fa-plus"></i> @Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.AddNew"]</a><button type="submit" id="btnGenerateAllCombinations" class="k-button"><span class="k-icon k-i-style-builder"></span> @Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.GenerateAll"]</button><button type="submit" id="btnClearAllCombinations" class="k-button"><span class="k-icon k-i-cut"></span> @Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.ClearAll"]</button>- <input type="submit" id="btnRefreshCombinations" style="display: none" />+ <input type="submit" id="btnRefreshCombinations" style="display: none"/></div>- <vc:vendor-widget widget-zone="vendor_product_details_product_attributes_combinations_bottom" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_product_attributes_combinations_bottom" additional-data="Model"/></div><script>@@ -228,4 +228,4 @@});});-</script>+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributes.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributes.cshtmlindex 9984f1150..0422baa12 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributes.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributes.cshtml@@ -1,11 +1,11 @@@model ProductModel<div class="panel panel-default">- <vc:vendor-widget widget-zone="vendor_product_details_product_attributes_top" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_product_attributes_top" additional-data="Model"/><div class="panel-body"><div id="productattributemappings-grid"></div></div>- <vc:vendor-widget widget-zone="vendor_product_details_product_attributes_bottom" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_product_attributes_bottom" additional-data="Model"/><div class="panel-footer"><a id="btnAddNewAttributes" href="@(Url.Action("ProductAttributeMappingPopup", "Product", new { productId = Model.Id, area = Constants.AreaVendor }))" class="k-button"><i class="fa fa-plus"></i> @Loc["Vendor.Catalog.Products.ProductAttributes.AddNew"]</a></div>@@ -167,7 +167,7 @@data: addAntiForgeryToken},destroy: {- url: "@Html.Raw(Url.Action("ProductAttributeValueDelete", "Product", new {area = Constants.AreaVendor }))?pam=" + e.data.Id + "&[email protected]",+ url: "@Html.Raw(Url.Action("ProductAttributeValueDelete", "Product", new { area = Constants.AreaVendor }))?pam=" + e.data.Id + "&[email protected]",type: "POST",dataType: "json",data: addAntiForgeryToken@@ -250,8 +250,8 @@});}</script>-<input type="submit" id="btnRefreshProductAttributes" style="display: none" />-<input type="button" id="btnRefreshProductAttributesValues" style="display: none" />+<input type="submit" id="btnRefreshProductAttributes" style="display: none"/>+<input type="button" id="btnRefreshProductAttributesValues" style="display: none"/><script>$(document).ready(function () {$('#btnRefreshProductAttributes').click(function () {diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductAttributes.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductAttributes.cshtmlindex c174a0fa7..bd2295764 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductAttributes.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductAttributes.cshtml@@ -8,18 +8,18 @@<tabstrip-item text="@Loc["Vendor.Catalog.Products.ProductAttributes.Attributes"]" tab-index="100" class="k-state-active"><content><div>- <partial name="Partials/CreateOrUpdate.ProductAttributes.TabAttributes" model="Model" />+ <partial name="Partials/CreateOrUpdate.ProductAttributes.TabAttributes" model="Model"/></div></content></tabstrip-item><tabstrip-item text="@Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations"]" tab-index="101"><content><div>- <partial name="Partials/CreateOrUpdate.ProductAttributes.TabAttributeCombinations" model="Model" />+ <partial name="Partials/CreateOrUpdate.ProductAttributes.TabAttributeCombinations" model="Model"/></div></content></tabstrip-item>- <vc:vendor-widget widget-zone="vendor_product_details_attribute_details_tabs" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_attribute_details_tabs" additional-data="Model"/></items></admin-tabstrip>}diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtmlindex 90cc70647..b22e91491 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtml@@ -1,12 +1,13 @@-@model ProductModel-@inject Grand.Business.Core.Interfaces.Common.Directory.ICurrencyService currencyService-@{+@using Grand.Business.Core.Interfaces.Common.Directory+@model ProductModel+@inject ICurrencyService currencyService+@{var currencies = await currencyService.GetAllCurrencies();var defaultCurrency = await currencyService.GetPrimaryStoreCurrency();currencies = currencies.Where(x => x.Id != defaultCurrency.Id).ToList();}@if (!string.IsNullOrEmpty(Model.Id) && currencies.Any())-{+{<div class="panel panel-default"><div class="panel-body"><div id="productprices-grid"></div>@@ -123,7 +124,7 @@Id: '@currencyItem.CurrencyCode',Name: "@currencyItem.CurrencyCode"}</text>-+if (i != currencies.Count - 1){@:,@@ -140,4 +141,4 @@});}</script>-}+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.PurchasedWithOrders.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.PurchasedWithOrders.cshtmlindex 86888b67d..7c67f4e38 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.PurchasedWithOrders.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.PurchasedWithOrders.cshtml@@ -2,11 +2,11 @@@inject AdminAreaSettings adminAreaSettings<div class="panel panel-default">- <vc:vendor-widget widget-zone="vendor_product_details_purchased_with_orders_top" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_purchased_with_orders_top" additional-data="Model"/><div class="panel-body"><div id="purchased-with-orders-grid"></div></div>- <vc:vendor-widget widget-zone="vendor_product_details_purchased_with_orders_bottom" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_purchased_with_orders_bottom" additional-data="Model"/></div><script>$(document).ready(function () {@@ -65,4 +65,4 @@}]});});-</script>+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Recommended.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Recommended.cshtmlindex 6b39203e2..1cc94c671 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Recommended.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Recommended.cshtml@@ -2,9 +2,8 @@@if (!string.IsNullOrEmpty(Model.Id)){-<div class="panel panel-default">- <vc:vendor-widget widget-zone="vendor_product_details_recommended_top" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_recommended_top" additional-data="Model"/><div class="panel-heading">@Loc["Vendor.Catalog.Products.Recommended"]</div>@@ -13,9 +12,9 @@</div><div class="panel-footer"><a id="btnAddNewRecommendedProduct" href="@(Url.Action("RecommendedProductAddPopup", "Product", new { productId = Model.Id, btnId = "btnRefreshRecommendedProducts", formId = "product-form", area = Constants.AreaVendor }))" class="k-button"><i class="fa fa-plus"></i> @Loc["Vendor.Catalog.Products.Recommended.AddNew"]</a>- <input type="submit" id="btnRefreshRecommendedProducts" style="display: none" />+ <input type="submit" id="btnRefreshRecommendedProducts" style="display: none"/></div>- <vc:vendor-widget widget-zone="vendor_product_details_recommended_bottom" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_recommended_bottom" additional-data="Model"/></div><script>@@ -95,7 +94,7 @@});});</script>-+<script>$(document).ready(function () {$('#btnRefreshRecommendedProducts').click(function () {@@ -108,7 +107,6 @@});});</script>-}else{diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.RelatedProducts.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.RelatedProducts.cshtmlindex 6eecbcf14..d53a659b2 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.RelatedProducts.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.RelatedProducts.cshtml@@ -12,7 +12,7 @@</div><div class="panel-footer"><a id="btnAddNewRelatedProduct" href="@(Url.Action("RelatedProductAddPopup", "Product", new { productId = Model.Id, btnId = "btnRefreshRelatedProducts", formId = "product-form", area = Constants.AreaVendor }))" class="k-button"><i class="fa fa-plus"></i> @Loc["Vendor.Catalog.Products.RelatedProducts.AddNew"]</a>- <input type="submit" id="btnRefreshRelatedProducts" style="display: none" />+ <input type="submit" id="btnRefreshRelatedProducts" style="display: none"/></div></div>@@ -120,7 +120,7 @@});});</script>-+<script>$(document).ready(function () {$('#btnRefreshRelatedProducts').click(function () {@@ -133,7 +133,6 @@});});</script>-}else{diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Reviews.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Reviews.cshtmlindex 4253a1ef3..8fce92cf4 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Reviews.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Reviews.cshtml@@ -1,12 +1,12 @@@model ProductModel@inject AdminAreaSettings adminAreaSettings-+<div class="panel panel-default">- <vc:vendor-widget widget-zone="vendor_product_details_reviews_top" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_reviews_top" additional-data="Model"/><div class="panel-body"><div id="reviews-grid"></div></div>- <vc:vendor-widget widget-zone="vendor_product_details_reviews_bottom" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_reviews_bottom" additional-data="Model"/></div><script>$(document).ready(function () {@@ -83,4 +83,4 @@}]});});-</script>+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.SEO.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.SEO.cshtmlindex 85a6c4f30..213f234ee 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.SEO.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.SEO.cshtml@@ -1,73 +1,74 @@-@model ProductModel-@using Microsoft.AspNetCore.Mvc.Razor;-<vc:vendor-widget widget-zone="vendor_product_details_seo_top" additional-data="Model" />+@using Microsoft.AspNetCore.Mvc.Razor+@model ProductModel+<vc:vendor-widget widget-zone="vendor_product_details_seo_top" additional-data="Model"/>-@{ Func<int, HelperResult>- template = @<div class="form-body">- <div class="form-group">- <admin-label asp-for="@Model.Locales[item].MetaKeywords" />- <div class="col-md-9 col-sm-9">- <admin-input asp-for="@Model.Locales[item].MetaKeywords" />- <span asp-validation-for="@Model.Locales[item].MetaKeywords"></span>- </div>- </div>- <div class="form-group">- <admin-label asp-for="@Model.Locales[item].MetaDescription" />- <div class="col-md-9 col-sm-9">- <admin-textarea asp-for="@Model.Locales[item].MetaDescription"></admin-textarea>- <span asp-validation-for="@Model.Locales[item].MetaDescription"></span>- </div>- </div>- <div class="form-group">- <admin-label asp-for="@Model.Locales[item].MetaTitle" />- <div class="col-md-9 col-sm-9">- <admin-input asp-for="@Model.Locales[item].MetaTitle" />- <span asp-validation-for="@Model.Locales[item].MetaTitle"></span>- </div>- </div>- <div class="form-group">- <admin-label asp-for="@Model.Locales[item].SeName" />- <div class="col-md-9 col-sm-9">- <admin-input asp-for="@Model.Locales[item].SeName" />- <span asp-validation-for="@Model.Locales[item].SeName"></span>- </div>- </div>- <input asp-for="@Model.Locales[item].LanguageId" type="hidden" />- </div>;+@{+ Func<int, HelperResult>+ template = @<div class="form-body">+ <div class="form-group">+ <admin-label asp-for="@Model.Locales[item].MetaKeywords"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="@Model.Locales[item].MetaKeywords"/>+ <span asp-validation-for="@Model.Locales[item].MetaKeywords"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="@Model.Locales[item].MetaDescription"/>+ <div class="col-md-9 col-sm-9">+ <admin-textarea asp-for="@Model.Locales[item].MetaDescription"></admin-textarea>+ <span asp-validation-for="@Model.Locales[item].MetaDescription"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="@Model.Locales[item].MetaTitle"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="@Model.Locales[item].MetaTitle"/>+ <span asp-validation-for="@Model.Locales[item].MetaTitle"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="@Model.Locales[item].SeName"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="@Model.Locales[item].SeName"/>+ <span asp-validation-for="@Model.Locales[item].SeName"></span>+ </div>+ </div>+ <input asp-for="@Model.Locales[item].LanguageId" type="hidden"/>+ </div>;}<div class="form-horizontal">- <localized-editor localized-template=@template name="product-seo-localized" [email protected](c=>c.LanguageId).ToList()>+ <localized-editor localized-template="@template" name="product-seo-localized" language-ids="@Model.Locales.Select(c => c.LanguageId).ToList()"><div class="form-body"><div class="form-group">- <admin-label asp-for="MetaKeywords" />+ <admin-label asp-for="MetaKeywords"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="MetaKeywords" />+ <admin-input asp-for="MetaKeywords"/><span asp-validation-for="MetaKeywords"></span></div></div><div class="form-group">- <admin-label asp-for="MetaDescription" />+ <admin-label asp-for="MetaDescription"/><div class="col-md-9 col-sm-9"><admin-textarea asp-for="MetaDescription"></admin-textarea><span asp-validation-for="MetaDescription"></span></div></div><div class="form-group">- <admin-label asp-for="MetaTitle" />+ <admin-label asp-for="MetaTitle"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="MetaTitle" />+ <admin-input asp-for="MetaTitle"/><span asp-validation-for="MetaTitle"></span></div></div><div class="form-group">- <admin-label asp-for="SeName" />+ <admin-label asp-for="SeName"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SeName" />+ <admin-input asp-for="SeName"/><span asp-validation-for="SeName"></span></div></div></div></localized-editor></div>-<vc:vendor-widget widget-zone="vendor_product_details_seo_bottom" additional-data="Model" />\ No newline at end of file+<vc:vendor-widget widget-zone="vendor_product_details_seo_bottom" additional-data="Model"/>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.SimilarProducts.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.SimilarProducts.cshtmlindex 73a434f77..c6f1c40a6 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.SimilarProducts.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.SimilarProducts.cshtml@@ -12,7 +12,7 @@</div><div class="panel-footer"><a id="btnAddNewSimilarProduct" href="@(Url.Action("SimilarProductAddPopup", "Product", new { productId = Model.Id, btnId = "btnRefreshSimilarProducts", formId = "product-form", area = Constants.AreaVendor })) " class="k-button"><i class="fa fa-plus"></i> @Loc["Vendor.Catalog.Products.SimilarProducts.AddNew"]</a>- <input type="submit" id="btnRefreshSimilarProducts" style="display: none" />+ <input type="submit" id="btnRefreshSimilarProducts" style="display: none"/></div></div>@@ -120,7 +120,7 @@});});</script>-+<script>$(document).ready(function () {$('#btnRefreshSimilarProducts').click(function () {@@ -133,7 +133,6 @@});});</script>-}else{diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.SpecificationAttributes.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.SpecificationAttributes.cshtmlindex cbe37c59c..e4a587b9e 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.SpecificationAttributes.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.SpecificationAttributes.cshtml@@ -3,11 +3,11 @@@if (!string.IsNullOrEmpty(Model.Id)){<div class="panel panel-default">- <vc:vendor-widget widget-zone="vendor_product_details_specification_attribute_details_top" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_specification_attribute_details_top" additional-data="Model"/><div class="panel-body"><div id="specificationattributes-grid"></div></div>- <vc:vendor-widget widget-zone="vendor_product_details_specification_attribute_details_bottom" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_specification_attribute_details_bottom" additional-data="Model"/><div class="panel-footer"><a id="btnAddNewSpecification" href="@(Url.Action("ProductSpecAttrPopup", "Product", new { productId = Model.Id, area = Constants.AreaVendor }))" class="k-button"><i class="fa fa-plus"></i> @Loc["Vendor.Catalog.Products.SpecificationAttributes.AddButton"]</a></div>@@ -138,7 +138,7 @@});});</script>- <input type="submit" id="btnRefreshProductSpec" style="display: none" />+ <input type="submit" id="btnRefreshProductSpec" style="display: none"/><script>$(document).ready(function () {$('#btnRefreshProductSpec').click(function () {diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.cshtmlindex cfa73f01d..642c1c1a7 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.cshtml@@ -1,109 +1,109 @@@model ProductModel<div asp-validation-summary="All"></div>-<input asp-for="Id" type="hidden" />-<input asp-for="Ticks" type="hidden" />+<input asp-for="Id" type="hidden"/>+<input asp-for="Ticks" type="hidden"/><admin-tabstrip name="product-edit" SetTabPos="true" BindGrid="true"><items><tabstrip-item text="@Loc["Vendor.Catalog.Products.Info"]" tab-index="0"><content><div>- <partial name="Partials/CreateOrUpdate.Info" model="Model" />+ <partial name="Partials/CreateOrUpdate.Info" model="Model"/></div></content></tabstrip-item><tabstrip-item text="@Loc["Vendor.Catalog.Products.Prices"]" tab-index="1" id="tab-price-product"><content><div>- <partial name="Partials/CreateOrUpdate.Prices" model="Model" />+ <partial name="Partials/CreateOrUpdate.Prices" model="Model"/></div></content></tabstrip-item><tabstrip-item text="@Loc["Vendor.Catalog.Products.Additional"]" tab-index="2"><content><div>- <partial name="Partials/CreateOrUpdate.Additional" model="Model" />+ <partial name="Partials/CreateOrUpdate.Additional" model="Model"/></div></content></tabstrip-item><tabstrip-item text="@Loc["Vendor.Common.SEO"]" tab-index="3"><content><div>- <partial name="Partials/CreateOrUpdate.SEO" model="Model" />+ <partial name="Partials/CreateOrUpdate.SEO" model="Model"/></div></content></tabstrip-item><tabstrip-item text="@Loc["Vendor.Catalog.Products.Pictures"]" tab-index="4"><content><div>- <partial name="Partials/CreateOrUpdate.Pictures" model="Model" />+ <partial name="Partials/CreateOrUpdate.Pictures" model="Model"/></div></content></tabstrip-item><tabstrip-item text="@Loc["Vendor.Catalog.Products.Mappings"]" tab-index="5"><content><div>- <partial name="Partials/CreateOrUpdate.Categories" model="Model" />- <partial name="Partials/CreateOrUpdate.Collections" model="Model" />+ <partial name="Partials/CreateOrUpdate.Categories" model="Model"/>+ <partial name="Partials/CreateOrUpdate.Collections" model="Model"/></div></content></tabstrip-item><tabstrip-item text="@Loc["Vendor.Catalog.Products.Inventory"]" tab-index="6" id="tab-inventory-product"><content><div>- <partial name="Partials/CreateOrUpdate.Inventory" model="Model" />+ <partial name="Partials/CreateOrUpdate.Inventory" model="Model"/></div></content></tabstrip-item><tabstrip-item text="@Loc["Vendor.Catalog.Products.SpecificationAttributes"]" tab-index="7"><content><div>- <partial name="Partials/CreateOrUpdate.SpecificationAttributes" model="Model" />+ <partial name="Partials/CreateOrUpdate.SpecificationAttributes" model="Model"/></div></content></tabstrip-item><tabstrip-item text="@Loc["Vendor.Catalog.Products.ProductAttributes"]" tab-index="8" id="tab-attributes-product"><content><div>- <partial name="Partials/CreateOrUpdate.ProductAttributes" model="Model" />+ <partial name="Partials/CreateOrUpdate.ProductAttributes" model="Model"/></div></content></tabstrip-item><tabstrip-item text="@Loc["Vendor.Catalog.Products.BundleProducts"]" tab-index="9" id="tab-bundle-products"><content><div>- <partial name="Partials/CreateOrUpdate.BundleProducts" model="Model" />+ <partial name="Partials/CreateOrUpdate.BundleProducts" model="Model"/></div></content></tabstrip-item><tabstrip-item text="@Loc["Vendor.Catalog.Products.Calendar"]" tab-index="10" id="tab-calendar"><content><div>- <partial name="Partials/CreateOrUpdate.Calendar" model="Model" />+ <partial name="Partials/CreateOrUpdate.Calendar" model="Model"/></div></content></tabstrip-item><tabstrip-item text="@Loc["Vendor.Catalog.Products.Bids"]" tab-index="11" id="tab-bids"><content><div>- <partial name="Partials/CreateOrUpdate.Bids" model="Model" />+ <partial name="Partials/CreateOrUpdate.Bids" model="Model"/></div></content></tabstrip-item><tabstrip-item text="@Loc["Vendor.Catalog.Products.LinkedProducts"]" tab-index="12"><content><div>- <partial name="Partials/CreateOrUpdate.RelatedProducts" model="Model" />- <partial name="Partials/CreateOrUpdate.CrossSells" model="Model" />- <partial name="Partials/CreateOrUpdate.SimilarProducts" model="Model" />- <partial name="Partials/CreateOrUpdate.Recommended" model="Model" />+ <partial name="Partials/CreateOrUpdate.RelatedProducts" model="Model"/>+ <partial name="Partials/CreateOrUpdate.CrossSells" model="Model"/>+ <partial name="Partials/CreateOrUpdate.SimilarProducts" model="Model"/>+ <partial name="Partials/CreateOrUpdate.Recommended" model="Model"/></div></content></tabstrip-item><tabstrip-item text="@Loc["Vendor.Catalog.Products.AssociatedProducts"]" tab-index="13" id="tab-associated-products"><content><div>- <partial name="Partials/CreateOrUpdate.AssociatedProducts" model="Model" />+ <partial name="Partials/CreateOrUpdate.AssociatedProducts" model="Model"/></div></content></tabstrip-item>@@ -112,18 +112,18 @@<tabstrip-item text="@Loc["Vendor.Catalog.Products.PurchasedWithOrders"]" tab-index="14" id="tab-purchased-product"><content><div>- <partial name="Partials/CreateOrUpdate.PurchasedWithOrders" model="Model" />+ <partial name="Partials/CreateOrUpdate.PurchasedWithOrders" model="Model"/></div></content></tabstrip-item><tabstrip-item text="@Loc["Vendor.Catalog.Products.Reviews"]" tab-index="15"><content><div>- <partial name="Partials/CreateOrUpdate.Reviews" model="Model" />+ <partial name="Partials/CreateOrUpdate.Reviews" model="Model"/></div></content></tabstrip-item>}- <vc:vendor-widget widget-zone="vendor_product_details_tabs" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_tabs" additional-data="Model"/></items>-</admin-tabstrip>+</admin-tabstrip>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdateProductAttributeValue.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdateProductAttributeValue.cshtmlindex b65357c60..85eea658f 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdateProductAttributeValue.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdateProductAttributeValue.cshtml@@ -1,11 +1,11 @@-@using Microsoft.AspNetCore.Mvc.Razor;+@using Microsoft.AspNetCore.Mvc.Razor@model ProductModel.ProductAttributeValueModel<div asp-validation-summary="All"></div>-<input asp-for="Id" type="hidden" />-<input asp-for="ProductAttributeMappingId" type="hidden" />-<input asp-for="DisplayColorSquaresRgb" type="hidden" />-<input asp-for="DisplayImageSquaresPicture" type="hidden" />+<input asp-for="Id" type="hidden"/>+<input asp-for="ProductAttributeMappingId" type="hidden"/>+<input asp-for="DisplayColorSquaresRgb" type="hidden"/>+<input asp-for="DisplayImageSquaresPicture" type="hidden"/><script>@@ -46,33 +46,34 @@}</script><!-- #region languages template -->-@{ Func<int, HelperResult>- template = @<div class="form-body">- <div class="form-group">- <admin-label asp-for="@Model.Locales[item].Name" class="col-sm-3 control-label" />- <div class="col-md-9 col-sm-9">- <admin-input asp-for="@Model.Locales[item].Name" />- <span asp-validation-for="@Model.Locales[item].Name"></span>- </div>- </div>- <input asp-for="@Model.Locales[item].LanguageId" type="hidden" />- </div>;+@{+ Func<int, HelperResult>+ template = @<div class="form-body">+ <div class="form-group">+ <admin-label asp-for="@Model.Locales[item].Name" class="col-sm-3 control-label"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="@Model.Locales[item].Name"/>+ <span asp-validation-for="@Model.Locales[item].Name"></span>+ </div>+ </div>+ <input asp-for="@Model.Locales[item].LanguageId" type="hidden"/>+ </div>;}<!-- #endregion --><div class="form-horizontal"><div class="form-body"><div class="form-group">- <admin-label asp-for="AttributeValueTypeId" class="col-sm-3 control-label" />+ <admin-label asp-for="AttributeValueTypeId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="AttributeValueTypeId" asp-items="Model.AttributeValueTypeId.ToSelectList(Context)" />+ <admin-select asp-for="AttributeValueTypeId" asp-items="Model.AttributeValueTypeId.ToSelectList(Context)"/><span asp-validation-for="AttributeValueTypeId"></span></div></div><div class="form-group" id="group-associated-product">- <admin-label asp-for="AssociatedProductId" class="col-sm-3 control-label" />+ <admin-label asp-for="AssociatedProductId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <input asp-for="AssociatedProductId" type="hidden" />+ <input asp-for="AssociatedProductId" type="hidden"/><span id="associate-product-name">@Model.AssociatedProductName</span><span asp-validation-for="AssociatedProductId"></span><a id="btnAssociateProductToAttributeValuePopup" href="@(Url.Action("AssociateProductToAttributeValuePopup", "Product", new { productIdInput = Html.IdFor(model => model.AssociatedProductId), productNameInput = "associate-product-name", area = Constants.AreaVendor }))" class="k-button">@@ -81,20 +82,20 @@</div></div><div class="form-group" id="group-quantity">- <admin-label asp-for="Quantity" class="col-sm-3 control-label" />+ <admin-label asp-for="Quantity" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Quantity" />+ <admin-input asp-for="Quantity"/><span asp-validation-for="Quantity"></span></div></div></div>- <localized-editor localized-template=@template name="productattributevalue-localized" [email protected](c=>c.LanguageId).ToList()>+ <localized-editor localized-template="@template" name="productattributevalue-localized" language-ids="@Model.Locales.Select(c => c.LanguageId).ToList()"><div class="form-body"><div class="form-group">- <admin-label asp-for="Name" class="col-sm-3 control-label" />+ <admin-label asp-for="Name" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Name" />+ <admin-input asp-for="Name"/><span asp-validation-for="Name"></span></div></div>@@ -105,9 +106,9 @@@if (Model.DisplayColorSquaresRgb){<div class="form-group">- <admin-label asp-for="ColorSquaresRgb" class="col-sm-3 control-label" />+ <admin-label asp-for="ColorSquaresRgb" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="ColorSquaresRgb" />+ <admin-input asp-for="ColorSquaresRgb"/><div id="color-picker"></div><script>$(document).ready(function(){@@ -125,59 +126,62 @@ViewData["Reference"] = "Product";ViewData["ObjectId"] = Model.ProductId;}- <admin-label asp-for="ImageSquaresPictureId" class="col-sm-3 control-label" />+ <admin-label asp-for="ImageSquaresPictureId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="ImageSquaresPictureId" />+ <admin-input asp-for="ImageSquaresPictureId"/><span asp-validation-for="ImageSquaresPictureId"></span></div></div>}<div class="form-group" id="group-price-adjustment">- <admin-label asp-for="PriceAdjustment" class="col-sm-3 control-label" />+ <admin-label asp-for="PriceAdjustment" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="PriceAdjustment" /> [@Model.PrimaryStoreCurrencyCode]+ <admin-input asp-for="PriceAdjustment"/> [@Model.PrimaryStoreCurrencyCode]<span asp-validation-for="PriceAdjustment"></span></div></div><div class="form-group" id="group-weight-adjustment">- <admin-label asp-for="WeightAdjustment" class="col-sm-3 control-label" />+ <admin-label asp-for="WeightAdjustment" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="WeightAdjustment" />+ <admin-input asp-for="WeightAdjustment"/><span asp-validation-for="WeightAdjustment"></span></div></div><div class="form-group" id="group-cost">- <admin-label asp-for="Cost" class="col-sm-3 control-label" />+ <admin-label asp-for="Cost" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Cost" /> [@Model.PrimaryStoreCurrencyCode]+ <admin-input asp-for="Cost"/> [@Model.PrimaryStoreCurrencyCode]<span asp-validation-for="Cost"></span></div></div><div class="form-group">- <admin-label asp-for="IsPreSelected" class="col-sm-3 control-label" />+ <admin-label asp-for="IsPreSelected" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="IsPreSelected" />+ <admin-input asp-for="IsPreSelected"/><div class="control__indicator"></div></label><span asp-validation-for="IsPreSelected"></span></div></div><div class="form-group">- <admin-label asp-for="DisplayOrder" class="col-sm-3 control-label" />+ <admin-label asp-for="DisplayOrder" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="DisplayOrder" />+ <admin-input asp-for="DisplayOrder"/><span asp-validation-for="DisplayOrder"></span></div></div><div class="form-group">- <admin-label asp-for="PictureId" class="col-sm-3 control-label" />+ <admin-label asp-for="PictureId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9"><ul style="list-style: none;"><li style="float: left; width: 110px;"><p style="float: left; padding-top: 20px;"><input type="radio" name="@Html.NameFor(x => x.PictureId)" value="0" id="id_image_0"- @if (!string.IsNullOrEmpty(Model.PictureId)) { <text> checked="checked" </text> }>+ @if (!string.IsNullOrEmpty(Model.PictureId))+ {+ <text> checked="checked" </text>+ }></p><p style="float: left; padding-top: 20px;"><label for="id_image_0">@@ -190,7 +194,10 @@<li style="float: left; width: 110px;"><p style="float: left; padding-top: 20px;"><input type="radio" name="@Html.NameFor(x => x.PictureId)" value="@picture.PictureId" id="[email protected]"- @if (picture.PictureId == Model.PictureId) { <text> checked="checked" </text> }>+ @if (picture.PictureId == Model.PictureId)+ {+ <text> checked="checked" </text>+ }></p><p style="float: left;"><label for="[email protected]">@@ -205,10 +212,12 @@</div><div class="form-group"><div class="offset-sm-3 offset-md-3 col-md-9 col-sm-9">- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Vendor.Common.Save"] </button>- <vc:vendor-widget widget-zone="vendor_product_details_attribute_value_buttons" additional-data="null" />+ <button class="btn btn-success" type="submit" name="save">+ <i class="fa fa-check"></i> @Loc["Vendor.Common.Save"]+ </button>+ <vc:vendor-widget widget-zone="vendor_product_details_attribute_value_buttons" additional-data="null"/></div></div></div>-</div>+</div>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdateTierPrice.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdateTierPrice.cshtmlindex 7a26bffdb..3503bb67f 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdateTierPrice.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdateTierPrice.cshtml@@ -1,55 +1,55 @@@model ProductModel.TierPriceModel<div asp-validation-summary="All"></div>-<input asp-for="Id" type="hidden" />-<input asp-for="ProductId" type="hidden" />+<input asp-for="Id" type="hidden"/>+<input asp-for="ProductId" type="hidden"/><div class="form-horizontal">- <vc:vendor-widget widget-zone="vendor_product_details_tier_price_top" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_product_details_tier_price_top" additional-data="Model"/><div class="form-body"><div class="form-group">- <admin-label asp-for="Quantity" class="col-sm-3 control-label" />+ <admin-label asp-for="Quantity" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Quantity" />+ <admin-input asp-for="Quantity"/><span asp-validation-for="Quantity"></span></div></div><div class="form-group">- <admin-label asp-for="Price" class="col-sm-3 control-label" />+ <admin-label asp-for="Price" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Price" />+ <admin-input asp-for="Price"/><span asp-validation-for="Price"></span></div></div><div class="form-group">- <admin-label asp-for="CurrencyCode" class="col-sm-3 control-label" />+ <admin-label asp-for="CurrencyCode" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="CurrencyCode" asp-items="Model.AvailableCurrencies" />+ <admin-select asp-for="CurrencyCode" asp-items="Model.AvailableCurrencies"/><span asp-validation-for="CurrencyCode"></span></div></div><div class="form-group">- <admin-label asp-for="StartDateTime" class="col-sm-3 control-label" />+ <admin-label asp-for="StartDateTime" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="StartDateTime" />+ <admin-input asp-for="StartDateTime"/><span asp-validation-for="StartDateTime"></span></div></div><div class="form-group">- <admin-label asp-for="EndDateTime" class="col-sm-3 control-label" />+ <admin-label asp-for="EndDateTime" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="EndDateTime" />+ <admin-input asp-for="EndDateTime"/><span asp-validation-for="EndDateTime"></span></div></div><div class="form-group"><div class="offset-sm-3 offset-md-3 col-md-9 col-sm-9">- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Vendor.Common.Save"] </button>- <vc:vendor-widget widget-zone="vendor_product_details_tier_price_buttons" additional-data="null" />+ <button class="btn btn-success" type="submit" name="save">+ <i class="fa fa-check"></i> @Loc["Vendor.Common.Save"]+ </button>+ <vc:vendor-widget widget-zone="vendor_product_details_tier_price_buttons" additional-data="null"/></div></div></div>- <vc:vendor-widget widget-zone="vendor_product_details_tier_price_bottom" additional-data="Model" />-</div>--+ <vc:vendor-widget widget-zone="vendor_product_details_tier_price_bottom" additional-data="Model"/>+</div>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/ProductAttributes.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/ProductAttributes.cshtmlindex 4deb538f0..09b543f61 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/ProductAttributes.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/ProductAttributes.cshtml@@ -2,11 +2,11 @@@if (Model.Count > 0){<div class="form-group">- @foreach (var attribute in Model)- {- var controlId = $"attributes[{attribute.Id}]";- var textPrompt = !string.IsNullOrEmpty(attribute.TextPrompt) ? attribute.TextPrompt : attribute.Name;- <div class="form-group">+ @foreach (var attribute in Model)+ {+ var controlId = $"attributes[{attribute.Id}]";+ var textPrompt = !string.IsNullOrEmpty(attribute.TextPrompt) ? attribute.TextPrompt : attribute.Name;+ <div class="form-group"><div class="col-md-3 col-sm-3">@if (attribute.IsRequired){@@ -18,80 +18,79 @@@switch (attribute.AttributeControlType){case AttributeControlType.DropdownList:- {- <select name="@(controlId)" id="@(controlId)" class="form-control">- @if (!attribute.IsRequired)- {- <option value="">---</option>- }- @foreach (var attributeValue in attribute.Values)- {- <option selected="@attributeValue.IsPreSelected" value="@attributeValue.Id">- @attributeValue.Name+ {+ <select name="@(controlId)" id="@(controlId)" class="form-control">+ @if (!attribute.IsRequired)+ {+ <option value="">---</option>+ }+ @foreach (var attributeValue in attribute.Values)+ {+ <option selected="@attributeValue.IsPreSelected" value="@attributeValue.Id">+ @attributeValue.Name</option>- }- </select>- }+ }+ </select>+ }break;case AttributeControlType.RadioList:case AttributeControlType.ColorSquares:case AttributeControlType.ImageSquares:+ {+ foreach (var attributeValue in attribute.Values){- foreach (var attributeValue in attribute.Values)- {- <div>- <label>- <input id="@(controlId)" type="radio" name="@(controlId)" value="@attributeValue.Id" checked="@attributeValue.IsPreSelected" />- @attributeValue.Name- </label>- </div>- }-+ <div>+ <label>+ <input id="@(controlId)" type="radio" name="@(controlId)" value="@attributeValue.Id" checked="@attributeValue.IsPreSelected"/>+ @attributeValue.Name+ </label>+ </div>}+ }break;case AttributeControlType.Checkboxes:case AttributeControlType.ReadonlyCheckboxes:+ {+ foreach (var attributeValue in attribute.Values){- foreach (var attributeValue in attribute.Values)- {- <div>- <label>- <input id="@(controlId)" type="checkbox" name="@(controlId)" value="@attributeValue.Id" checked="@attributeValue.IsPreSelected" @(attribute.AttributeControlType == AttributeControlType.ReadonlyCheckboxes ? Html.Raw(" disabled=\"disabled\"") : null) />- @attributeValue.Name- </label>- </div>- }+ <div>+ <label>+ <input id="@(controlId)" type="checkbox" name="@(controlId)" value="@attributeValue.Id" checked="@attributeValue.IsPreSelected" @(attribute.AttributeControlType == AttributeControlType.ReadonlyCheckboxes ? Html.Raw(" disabled=\"disabled\"") : null)/>+ @attributeValue.Name+ </label>+ </div>}+ }break;case AttributeControlType.TextBox:- {- <input name="@(controlId)" type="text" id="@(controlId)" class="form-control" />- }+ {+ <input name="@(controlId)" type="text" id="@(controlId)" class="form-control"/>+ }break;case AttributeControlType.MultilineTextbox:- {- <textarea cols="20" id="@(controlId)" name="@(controlId)" rows="2" class="form-control"></textarea>- }+ {+ <textarea cols="20" id="@(controlId)" name="@(controlId)" rows="2" class="form-control"></textarea>+ }break;case AttributeControlType.Datepicker:- {- <date-picker-dropdown control-day="@(controlId + "_day")"- control-month="@(controlId + "_month")"- control-year="@(controlId + "_year")"- begin-year="@(DateTime.Now.Year)"- end-year="@(DateTime.Now.Year+1)"- PartialViewName="Partials/DateDropDowns"- class="col-12 input-group" />- }+ {+ <date-picker-dropdown control-day="@(controlId + "_day")"+ control-month="@(controlId + "_month")"+ control-year="@(controlId + "_year")"+ begin-year="@(DateTime.Now.Year)"+ end-year="@(DateTime.Now.Year + 1)"+ PartialViewName="Partials/DateDropDowns"+ class="col-12 input-group"/>+ }break;case AttributeControlType.FileUpload:- {- <input type="file" id="@(controlId)" name="@(controlId)" class="form-control"/>- }+ {+ <input type="file" id="@(controlId)" name="@(controlId)" class="form-control"/>+ }break;}</div>- </div>- }+ </div>+ }</div>}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeConditionPopup.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeConditionPopup.cshtmlindex 50ab9ac91..98ffd2cf8 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeConditionPopup.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeConditionPopup.cshtml@@ -9,9 +9,9 @@asp-route-btnId="@Context.Request.Query["btnId"]"asp-route-formId="@Context.Request.Query["formId"]">-+<div asp-validation-summary="All"></div>- <input asp-for="ProductId" type="hidden" />+ <input asp-for="ProductId" type="hidden"/><div class="row"><div class="col-md-12">@@ -29,14 +29,14 @@<div class="form-horizontal"><div class="form-body"><div class="form-group">- <admin-label asp-for="EnableCondition" class="col-sm-3 control-label"/>- <div class="col-md-9 col-sm-9">- <label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="EnableCondition" />- <div class="control__indicator"></div>- </label>- <span asp-validation-for="EnableCondition"></span>- </div>+ <admin-label asp-for="EnableCondition" class="col-sm-3 control-label"/>+ <div class="col-md-9 col-sm-9">+ <label class="mt-checkbox mt-checkbox-outline control control-checkbox">+ <admin-input asp-for="EnableCondition"/>+ <div class="control__indicator"></div>+ </label>+ <span asp-validation-for="EnableCondition"></span>+ </div></div><div class="form-group" id="pnlAttributes">@if (Model.ProductAttributes.Count > 0)@@ -47,7 +47,7 @@<div class="form-group" id="pnlBasepriceUnit"><admin-label asp-for="SelectedProductAttributeId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="SelectedProductAttributeId" asp-items="@(attributesList)" />+ <admin-select asp-for="SelectedProductAttributeId" asp-items="@(attributesList)"/><script>$("#@Html.IdFor(model => model.SelectedProductAttributeId)").change(toggleProductAttributes);@@ -73,48 +73,48 @@@switch (attribute.AttributeControlType){case AttributeControlType.DropdownList:- {- <select class="form-control" name="@(controlId)" id="@(controlId)">- @if (!attribute.IsRequired)- {- <option value="">---</option>- }- @foreach (var attributeValue in attribute.Values)- {- <option selected="@attributeValue.IsPreSelected" value="@attributeValue.Id">- @attributeValue.Name- </option>- }- </select>- }+ {+ <select class="form-control" name="@(controlId)" id="@(controlId)">+ @if (!attribute.IsRequired)+ {+ <option value="">---</option>+ }+ @foreach (var attributeValue in attribute.Values)+ {+ <option selected="@attributeValue.IsPreSelected" value="@attributeValue.Id">+ @attributeValue.Name+ </option>+ }+ </select>+ }break;case AttributeControlType.RadioList:case AttributeControlType.ColorSquares:case AttributeControlType.ImageSquares:- {- <ul style="list-style-type: none;">- @foreach (var attributeValue in attribute.Values)- {- <li>- <input id="@(controlId)" type="radio" name="@(controlId)" value="@attributeValue.Id" checked="@attributeValue.IsPreSelected" />- <label for="@(controlId)">@attributeValue.Name</label>- </li>- }- </ul>- }+ {+ <ul style="list-style-type: none;">+ @foreach (var attributeValue in attribute.Values)+ {+ <li>+ <input id="@(controlId)" type="radio" name="@(controlId)" value="@attributeValue.Id" checked="@attributeValue.IsPreSelected"/>+ <label for="@(controlId)">@attributeValue.Name</label>+ </li>+ }+ </ul>+ }break;case AttributeControlType.Checkboxes:- {- <ul style="list-style-type: none;">- @foreach (var attributeValue in attribute.Values)- {- <li>- <input id="@(controlId)" type="checkbox" name="@(controlId)" value="@attributeValue.Id" checked="@attributeValue.IsPreSelected" @(attribute.AttributeControlType == AttributeControlType.ReadonlyCheckboxes ? Html.Raw(" disabled=\"disabled\"") : null) />- <label for="@(controlId)">@attributeValue.Name</label>- </li>- }- </ul>- }+ {+ <ul style="list-style-type: none;">+ @foreach (var attributeValue in attribute.Values)+ {+ <li>+ <input id="@(controlId)" type="checkbox" name="@(controlId)" value="@attributeValue.Id" checked="@attributeValue.IsPreSelected" @(attribute.AttributeControlType == AttributeControlType.ReadonlyCheckboxes ? Html.Raw(" disabled=\"disabled\"") : null)/>+ <label for="@(controlId)">@attributeValue.Name</label>+ </li>+ }+ </ul>+ }break;case AttributeControlType.ReadonlyCheckboxes:case AttributeControlType.TextBox:@@ -139,17 +139,19 @@<div class="form-actions"><div class="row"><div class="offset-md-3 offset-sm-3 col-md-9 col-sm-9">- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Vendor.Common.Save"] </button>+ <button class="btn btn-success" type="submit" name="save">+ <i class="fa fa-check"></i> @Loc["Vendor.Common.Save"]+ </button></div></div></div>- </div>- </div>+ </div></div></div></div></div>+ </div><script>var mfp = $.magnificPopup.instance;diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeMappingPopup.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeMappingPopup.cshtmlindex 48b11c6b3..a759a5af3 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeMappingPopup.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeMappingPopup.cshtml@@ -12,8 +12,8 @@<div asp-validation-summary="All"></div>- <input asp-for="ProductId" type="hidden" />- <input asp-for="Id" type="hidden" />+ <input asp-for="ProductId" type="hidden"/>+ <input asp-for="Id" type="hidden"/><div class="row"><div class="col-md-12">@@ -35,66 +35,68 @@<div class="form-horizontal"><div class="form-body"><div class="form-group">- <admin-label asp-for="ProductAttribute" />+ <admin-label asp-for="ProductAttribute"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="ProductAttributeId" asp-items="Model.AvailableProductAttribute" />+ <admin-select asp-for="ProductAttributeId" asp-items="Model.AvailableProductAttribute"/><span asp-validation-for="ProductAttributeId"></span></div></div><div class="form-group">- <admin-label asp-for="TextPrompt" />+ <admin-label asp-for="TextPrompt"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="TextPrompt" />+ <admin-input asp-for="TextPrompt"/><span asp-validation-for="TextPrompt"></span></div></div><div class="form-group">- <admin-label asp-for="IsRequired" class="col-sm-3 control-label" />+ <admin-label asp-for="IsRequired" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="IsRequired" />+ <admin-input asp-for="IsRequired"/><div class="control__indicator"></div></label><span asp-validation-for="IsRequired"></span></div></div><div class="form-group">- <admin-label asp-for="ShowOnCatalogPage" class="col-sm-3 control-label" />+ <admin-label asp-for="ShowOnCatalogPage" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="ShowOnCatalogPage" />+ <admin-input asp-for="ShowOnCatalogPage"/><div class="control__indicator"></div></label><span asp-validation-for="ShowOnCatalogPage"></span></div></div><div class="form-group">- <admin-label asp-for="AttributeControlType" />+ <admin-label asp-for="AttributeControlType"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="AttributeControlTypeId" asp-items="Model.AttributeControlTypeId.ToSelectList(Context, valuesToExclude: [(int)AttributeControlType.Hidden])" />+ <admin-select asp-for="AttributeControlTypeId" asp-items="Model.AttributeControlTypeId.ToSelectList(Context, valuesToExclude: [(int)AttributeControlType.Hidden])"/><span asp-validation-for="AttributeControlTypeId"></span></div></div><div class="form-group">- <admin-label asp-for="Combination" class="col-sm-3 control-label" />+ <admin-label asp-for="Combination" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="Combination" />+ <admin-input asp-for="Combination"/><div class="control__indicator"></div></label><span asp-validation-for="Combination"></span></div></div><div class="form-group">- <admin-label asp-for="DisplayOrder" />+ <admin-label asp-for="DisplayOrder"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="DisplayOrder" />+ <admin-input asp-for="DisplayOrder"/><span asp-validation-for="DisplayOrder"></span></div></div><div class="form-group"><div class="offset-sm-3 offset-md-3 col-md-9 col-sm-9">- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Vendor.Common.Save"] </button>+ <button class="btn btn-success" type="submit" name="save">+ <i class="fa fa-check"></i> @Loc["Vendor.Common.Save"]+ </button></div></div></div>diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeValidationRulesPopup.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeValidationRulesPopup.cshtmlindex 946b33b87..fecb211d5 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeValidationRulesPopup.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeValidationRulesPopup.cshtml@@ -24,44 +24,46 @@<div class="form-horizontal"><div class="form-body"><div class="form-group" @(attributeControlType != AttributeControlType.TextBox && attributeControlType != AttributeControlType.MultilineTextbox ? Html.Raw("style='display: none;'") : null)>- <admin-label asp-for="ValidationMinLength" class="col-sm-3 control-label" />+ <admin-label asp-for="ValidationMinLength" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="ValidationMinLength" />+ <admin-input asp-for="ValidationMinLength"/><span asp-validation-for="ValidationMinLength"></span></div></div><div class="form-group" @(attributeControlType != AttributeControlType.TextBox && attributeControlType != AttributeControlType.MultilineTextbox ? Html.Raw("style='display: none;'") : null)>- <admin-label asp-for="ValidationMaxLength" class="col-sm-3 control-label" />+ <admin-label asp-for="ValidationMaxLength" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="ValidationMaxLength" />+ <admin-input asp-for="ValidationMaxLength"/><span asp-validation-for="ValidationMaxLength"></span></div></div><div class="form-group" @(attributeControlType != AttributeControlType.FileUpload ? Html.Raw("style='display: none;'") : null)>- <admin-label asp-for="ValidationFileAllowedExtensions" class="col-sm-3 control-label" />+ <admin-label asp-for="ValidationFileAllowedExtensions" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="ValidationFileAllowedExtensions" />+ <admin-input asp-for="ValidationFileAllowedExtensions"/><span asp-validation-for="ValidationFileAllowedExtensions"></span></div></div><div class="form-group" @(attributeControlType != AttributeControlType.FileUpload ? Html.Raw("style='display: none;'") : null)>- <admin-label asp-for="ValidationFileMaximumSize" class="col-sm-3 control-label" />+ <admin-label asp-for="ValidationFileMaximumSize" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="ValidationFileMaximumSize" />+ <admin-input asp-for="ValidationFileMaximumSize"/><span asp-validation-for="ValidationFileMaximumSize"></span></div></div><div class="form-group" @(attributeControlType != AttributeControlType.TextBox && attributeControlType != AttributeControlType.MultilineTextbox ? Html.Raw("style='display: none;'") : null)>- <admin-label asp-for="DefaultValue" class="col-sm-3 control-label" />+ <admin-label asp-for="DefaultValue" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="DefaultValue" />+ <admin-input asp-for="DefaultValue"/><span asp-validation-for="DefaultValue"></span></div></div><div class="form-actions"><div class="row"><div class="offset-sm-3 offset-md-3 col-md-9 col-sm-9">- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Vendor.Common.Save"] </button>+ <button class="btn btn-success" type="submit" name="save">+ <i class="fa fa-check"></i> @Loc["Vendor.Common.Save"]+ </button></div></div></div>@@ -106,4 +108,4 @@});});</script>-</form>+</form>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeValueCreatePopup.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeValueCreatePopup.cshtmlindex ad5b5be88..496604be2 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeValueCreatePopup.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeValueCreatePopup.cshtml@@ -20,7 +20,7 @@</div></div><div class="x_content form">- <partial name="Partials/CreateOrUpdateProductAttributeValue" model="Model" />+ <partial name="Partials/CreateOrUpdateProductAttributeValue" model="Model"/></div></div></div>diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeValueEditPopup.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeValueEditPopup.cshtmlindex a5c14c3a0..edca9d647 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeValueEditPopup.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeValueEditPopup.cshtml@@ -20,7 +20,7 @@</div></div><div class="x_content form">- <partial name="Partials/CreateOrUpdateProductAttributeValue" model="Model" />+ <partial name="Partials/CreateOrUpdateProductAttributeValue" model="Model"/></div></div></div>diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductPicturePopup.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductPicturePopup.cshtmlindex cba8bd0fd..706274973 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductPicturePopup.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductPicturePopup.cshtml@@ -1,5 +1,4 @@-@using Microsoft.AspNetCore.Mvc.Razor;-+@using Microsoft.AspNetCore.Mvc.Razor@model ProductModel.ProductPictureModel@{Layout = "";@@ -12,29 +11,30 @@<!-- #region languages template -->- @{ Func<int, HelperResult> template = @<div class="form-body">+ @{+ Func<int, HelperResult> template = @<div class="form-body"><div class="form-group">- <admin-label asp-for="@Model.Locales[item].AltAttribute" class="col-sm-3 control-label" />+ <admin-label asp-for="@Model.Locales[item].AltAttribute" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="@Model.Locales[item].AltAttribute" />+ <admin-input asp-for="@Model.Locales[item].AltAttribute"/><span asp-validation-for="@Model.Locales[item].AltAttribute"></span></div></div><div class="form-group">- <admin-label asp-for="@Model.Locales[item].TitleAttribute" class="col-sm-3 control-label" />+ <admin-label asp-for="@Model.Locales[item].TitleAttribute" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="@Model.Locales[item].TitleAttribute" />+ <admin-input asp-for="@Model.Locales[item].TitleAttribute"/><span asp-validation-for="@Model.Locales[item].TitleAttribute"></span></div></div>- <input asp-for="@Model.Locales[item].LanguageId" type="hidden" />+ <input asp-for="@Model.Locales[item].LanguageId" type="hidden"/></div>;}<div asp-validation-summary="All"></div>- <input asp-for="ProductId" type="hidden" />- <input asp-for="Id" type="hidden" />- <input asp-for="PictureUrl" type="hidden" />+ <input asp-for="ProductId" type="hidden"/>+ <input asp-for="Id" type="hidden"/>+ <input asp-for="PictureUrl" type="hidden"/><div class="row"><div class="col-md-12">@@ -49,53 +49,57 @@<div class="form-horizontal"><div class="form-body"><div class="form-group">- <admin-label asp-for="PictureUrl" />+ <admin-label asp-for="PictureUrl"/><div class="col-md-9 col-sm-9">- <a href="@Model.PictureUrl" target="_blank"><img src="@Model.PictureUrl" width="150" /></a>+ <a href="@Model.PictureUrl" target="_blank">+ <img src="@Model.PictureUrl" width="150"/>+ </a></div></div>- <localized-editor localized-template=template name="productpicturevalue-localized" [email protected](c=>c.LanguageId).ToList()>+ <localized-editor localized-template="template" name="productpicturevalue-localized" language-ids="@Model.Locales.Select(c => c.LanguageId).ToList()"><div class="form-body"><div class="form-group">- <admin-label asp-for="AltAttribute" class="col-sm-3 control-label" />+ <admin-label asp-for="AltAttribute" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="AltAttribute" />+ <admin-input asp-for="AltAttribute"/><span asp-validation-for="AltAttribute"></span></div></div><div class="form-group">- <admin-label asp-for="TitleAttribute" class="col-sm-3 control-label" />+ <admin-label asp-for="TitleAttribute" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="TitleAttribute" />+ <admin-input asp-for="TitleAttribute"/><span asp-validation-for="TitleAttribute"></span></div></div></div></localized-editor><div class="form-group">- <admin-label asp-for="DisplayOrder" />+ <admin-label asp-for="DisplayOrder"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="DisplayOrder" />+ <admin-input asp-for="DisplayOrder"/><span asp-validation-for="DisplayOrder"></span></div></div><div class="form-group">- <admin-label asp-for="Style" />+ <admin-label asp-for="Style"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Style" />+ <admin-input asp-for="Style"/><span asp-validation-for="Style"></span></div></div><div class="form-group">- <admin-label asp-for="ExtraField" />+ <admin-label asp-for="ExtraField"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="ExtraField" />+ <admin-input asp-for="ExtraField"/><span asp-validation-for="ExtraField"></span></div></div><div class="form-group"><div class="offset-sm-3 offset-md-3 col-md-9 col-sm-9">- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Vendor.Common.Save"] </button>+ <button class="btn btn-success" type="submit" name="save">+ <i class="fa fa-check"></i> @Loc["Vendor.Common.Save"]+ </button></div></div></div>diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductSpecAttrPopup.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductSpecAttrPopup.cshtmlindex 50ce23a19..8991d1e74 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductSpecAttrPopup.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductSpecAttrPopup.cshtml@@ -2,15 +2,15 @@@{Layout = "";}-<form id="ProductSpecificationPopup" asp-area="@Constants.AreaVendor"- asp-controller="Product" asp-action="ProductSpecAttrPopup"+<form id="ProductSpecificationPopup" asp-area="@Constants.AreaVendor"+ asp-controller="Product" asp-action="ProductSpecAttrPopup"enctype="multipart/form-data" method="post"asp-route-ProductId="@Context.Request.Query["ProductId"]"asp-route-Id="@Context.Request.Query["Id"]"><div asp-validation-summary="All"></div>- <input asp-for="ProductId" type="hidden" />- <input asp-for="Id" type="hidden" />+ <input asp-for="ProductId" type="hidden"/>+ <input asp-for="Id" type="hidden"/><div class="row"><div class="col-md-12">@@ -32,70 +32,72 @@<div class="form-horizontal"><div class="form-body"><div class="form-group">- <admin-label asp-for="AttributeTypeId" />+ <admin-label asp-for="AttributeTypeId"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="AttributeTypeId" asp-items="Model.AttributeTypeId.ToSelectList(Context)" />+ <admin-select asp-for="AttributeTypeId" asp-items="Model.AttributeTypeId.ToSelectList(Context)"/><span asp-validation-for="AttributeTypeId"></span></div></div><div class="form-group" id="disableOnCustom">- <admin-label asp-for="SpecificationAttributeId" />+ <admin-label asp-for="SpecificationAttributeId"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="SpecificationAttributeId" asp-items="Model.AvailableAttributes" />+ <admin-select asp-for="SpecificationAttributeId" asp-items="Model.AvailableAttributes"/><span asp-validation-for="SpecificationAttributeId"></span></div></div><div class="form-group" id="pnlSpecificationAttributeOptionId">- <admin-label asp-for="SpecificationAttributeOptionId" />+ <admin-label asp-for="SpecificationAttributeOptionId"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="SpecificationAttributeOptionId" asp-items="Model.AvailableOptions" />+ <admin-select asp-for="SpecificationAttributeOptionId" asp-items="Model.AvailableOptions"/><span asp-validation-for="SpecificationAttributeOptionId"></span></div></div><div class="form-group" id="pnlCustomName">- <admin-label asp-for="CustomName" />+ <admin-label asp-for="CustomName"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="CustomName" />+ <admin-input asp-for="CustomName"/><span asp-validation-for="CustomName"></span></div></div><div class="form-group" id="pnlCustomValue">- <admin-label asp-for="CustomValue" />+ <admin-label asp-for="CustomValue"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="CustomValue" />+ <admin-input asp-for="CustomValue"/><span asp-validation-for="CustomValue"></span></div></div><div class="form-group" id="pnlAllowFiltering">- <admin-label asp-for="AllowFiltering" />+ <admin-label asp-for="AllowFiltering"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="AllowFiltering" />+ <admin-input asp-for="AllowFiltering"/><div class="control__indicator"></div></label><span asp-validation-for="AllowFiltering"></span></div></div><div class="form-group">- <admin-label asp-for="ShowOnProductPage" />+ <admin-label asp-for="ShowOnProductPage"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="ShowOnProductPage" />+ <admin-input asp-for="ShowOnProductPage"/><div class="control__indicator"></div></label><span asp-validation-for="ShowOnProductPage"></span></div></div><div class="form-group">- <admin-label asp-for="DisplayOrder" />+ <admin-label asp-for="DisplayOrder"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="DisplayOrder" />+ <admin-input asp-for="DisplayOrder"/><span asp-validation-for="DisplayOrder"></span></div></div><div class="form-group"><div class="offset-sm-3 offset-md-3 col-md-9 col-sm-9">- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Vendor.Common.Save"] </button>+ <button class="btn btn-success" type="submit" name="save">+ <i class="fa fa-check"></i> @Loc["Vendor.Common.Save"]+ </button></div></div></div>diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/RecommendedProductAddPopup.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/RecommendedProductAddPopup.cshtmlindex 2d6e1dffb..2dd8f866d 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/RecommendedProductAddPopup.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/RecommendedProductAddPopup.cshtml@@ -25,8 +25,8 @@<div class="row align-items-end"><div class="col-md col-ms-12 col-12"><div class="form-group mb-0">- <admin-label asp-for="SearchProductName" class="control-label" />- <admin-input asp-for="SearchProductName" />+ <admin-label asp-for="SearchProductName" class="control-label"/>+ <admin-input asp-for="SearchProductName"/></div></div><div class="col-md-auto col-sm-12 col-12">@@ -47,31 +47,31 @@<div class="collapse" id="filterCollapse"><div class="drop-filters-container"><div class="form-group">- <admin-label asp-for="SearchCategoryId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchCategoryId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchCategoryId" />+ <admin-input asp-for="SearchCategoryId"/></div></div><div class="form-group">- <admin-label asp-for="SearchBrandId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchBrandId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchBrandId" />+ <admin-input asp-for="SearchBrandId"/></div></div><div class="form-group">- <admin-label asp-for="SearchCollectionId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchCollectionId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchCollectionId" />+ <admin-input asp-for="SearchCollectionId"/></div></div><div class="form-group">- <admin-label asp-for="SearchProductTypeId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchProductTypeId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="SearchProductTypeId" asp-items="Model.AvailableProductTypes" />+ <admin-select asp-for="SearchProductTypeId" asp-items="Model.AvailableProductTypes"/></div></div></div>- </div>+ </div><div id="products-grid"></div></div></div>@@ -79,7 +79,7 @@</div></div></div>-<script>+ <script>var mfp = $.magnificPopup.instance;$("#RecommendedProductAddPopup").submit(function (e) {e.preventDefault();diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/RelatedProductAddPopup.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/RelatedProductAddPopup.cshtmlindex 54ad19ac0..1638229ad 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/RelatedProductAddPopup.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/RelatedProductAddPopup.cshtml@@ -9,7 +9,7 @@asp-route-productId="@Context.Request.Query["productId"]"asp-route-btnId="@Context.Request.Query["btnId"]"asp-route-formId="@Context.Request.Query["formId"]">-+<div class="row"><div class="col-md-12">@@ -27,8 +27,8 @@<div class="row align-items-end"><div class="col-md col-ms-12 col-12"><div class="form-group mb-0">- <admin-label asp-for="SearchProductName" class="control-label" />- <admin-input asp-for="SearchProductName" />+ <admin-label asp-for="SearchProductName" class="control-label"/>+ <admin-input asp-for="SearchProductName"/></div></div><div class="col-md-auto col-sm-12 col-12">@@ -49,27 +49,27 @@<div class="collapse" id="filterCollapse"><div class="drop-filters-container"><div class="form-group">- <admin-label asp-for="SearchCategoryId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchCategoryId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchCategoryId" />+ <admin-input asp-for="SearchCategoryId"/></div></div><div class="form-group">- <admin-label asp-for="SearchBrandId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchBrandId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchBrandId" />+ <admin-input asp-for="SearchBrandId"/></div></div><div class="form-group">- <admin-label asp-for="SearchCollectionId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchCollectionId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchCollectionId" />+ <admin-input asp-for="SearchCollectionId"/></div></div><div class="form-group">- <admin-label asp-for="SearchProductTypeId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchProductTypeId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="SearchProductTypeId" asp-items="Model.AvailableProductTypes" />+ <admin-select asp-for="SearchProductTypeId" asp-items="Model.AvailableProductTypes"/></div></div></div>diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/RequiredProductAddPopup.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/RequiredProductAddPopup.cshtmlindex e80c12e64..0dc56e055 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/RequiredProductAddPopup.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/RequiredProductAddPopup.cshtml@@ -5,7 +5,7 @@//page titleViewBag.Title = Loc["Vendor.Catalog.Products.Fields.RequiredProductIds.Choose"];}-+<div class="row"><div class="col-md-12"><div class="x_panel light form-fit popup-window">@@ -22,8 +22,8 @@<div class="row align-items-end"><div class="col-md col-ms-12 col-12"><div class="form-group mb-0">- <admin-label asp-for="SearchProductName" class="control-label" />- <admin-input asp-for="SearchProductName" />+ <admin-label asp-for="SearchProductName" class="control-label"/>+ <admin-input asp-for="SearchProductName"/></div></div><div class="col-md-auto col-sm-12 col-12">@@ -44,27 +44,27 @@<div class="collapse" id="filterCollapse"><div class="drop-filters-container"><div class="form-group">- <admin-label asp-for="SearchCategoryId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchCategoryId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchCategoryId" />+ <admin-input asp-for="SearchCategoryId"/></div></div><div class="form-group">- <admin-label asp-for="SearchBrandId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchBrandId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchBrandId" />+ <admin-input asp-for="SearchBrandId"/></div></div><div class="form-group">- <admin-label asp-for="SearchCollectionId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchCollectionId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchCollectionId" />+ <admin-input asp-for="SearchCollectionId"/></div></div><div class="form-group">- <admin-label asp-for="SearchProductTypeId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchProductTypeId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="SearchProductTypeId" asp-items="Model.AvailableProductTypes" />+ <admin-select asp-for="SearchProductTypeId" asp-items="Model.AvailableProductTypes"/></div></div></div>@@ -169,5 +169,4 @@});</script>-</div>-+</div>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/SimilarProductAddPopup.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/SimilarProductAddPopup.cshtmlindex c8b0f21e9..0bfe60121 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/SimilarProductAddPopup.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/SimilarProductAddPopup.cshtml@@ -25,8 +25,8 @@<div class="row align-items-end"><div class="col-md col-ms-12 col-12"><div class="form-group mb-0">- <admin-label asp-for="SearchProductName" class="control-label" />- <admin-input asp-for="SearchProductName" />+ <admin-label asp-for="SearchProductName" class="control-label"/>+ <admin-input asp-for="SearchProductName"/></div></div><div class="col-md-auto col-sm-12 col-12">@@ -47,27 +47,27 @@<div class="collapse" id="filterCollapse"><div class="drop-filters-container"><div class="form-group">- <admin-label asp-for="SearchCategoryId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchCategoryId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchCategoryId" />+ <admin-input asp-for="SearchCategoryId"/></div></div><div class="form-group">- <admin-label asp-for="SearchBrandId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchBrandId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchBrandId" />+ <admin-input asp-for="SearchBrandId"/></div></div><div class="form-group">- <admin-label asp-for="SearchCollectionId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchCollectionId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SearchCollectionId" />+ <admin-input asp-for="SearchCollectionId"/></div></div><div class="form-group">- <admin-label asp-for="SearchProductTypeId" class="col-sm-3 control-label" />+ <admin-label asp-for="SearchProductTypeId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="SearchProductTypeId" asp-items="Model.AvailableProductTypes" />+ <admin-select asp-for="SearchProductTypeId" asp-items="Model.AvailableProductTypes"/></div></div></div>diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/TierPriceCreatePopup.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/TierPriceCreatePopup.cshtmlindex a28617b03..3b445e4fe 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/TierPriceCreatePopup.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/TierPriceCreatePopup.cshtml@@ -22,7 +22,7 @@</div></div><div class="x_content form">- <partial name="Partials/CreateOrUpdateTierPrice" model="Model" />+ <partial name="Partials/CreateOrUpdateTierPrice" model="Model"/></div></div></div>diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/TierPriceEditPopup.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/TierPriceEditPopup.cshtmlindex 62030bd69..6c24e0dfc 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/TierPriceEditPopup.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/TierPriceEditPopup.cshtml@@ -22,7 +22,7 @@</div></div><div class="x_content form">- <partial name="Partials/CreateOrUpdateTierPrice" model="Model" />+ <partial name="Partials/CreateOrUpdateTierPrice" model="Model"/></div></div></div>diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/BestsellersReport.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/BestsellersReport.cshtmlindex fc553895d..73ffe6450 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/BestsellersReport.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/BestsellersReport.cshtml@@ -16,7 +16,7 @@</div><div class="x_content form">- <vc:vendor-widget widget-zone="vendor_bestsellers_report" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_bestsellers_report" additional-data="Model"/><div class="form-horizontal"><div class="form-body"><div class="x_content">@@ -41,33 +41,33 @@<div class="collapse" id="filterCollapse"><div class="drop-filters-container w-100"><div class="form-group">- <admin-label asp-for="StartDate" class="col-sm-3 control-label" />+ <admin-label asp-for="StartDate" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="StartDate" />+ <admin-input asp-for="StartDate"/></div></div><div class="form-group">- <admin-label asp-for="EndDate" class="col-sm-3 control-label" />+ <admin-label asp-for="EndDate" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="EndDate" />+ <admin-input asp-for="EndDate"/></div></div><div class="form-group">- <admin-label asp-for="PaymentStatusId" class="col-sm-3 control-label" />+ <admin-label asp-for="PaymentStatusId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="PaymentStatusId" asp-items="Model.AvailablePaymentStatuses" />+ <admin-select asp-for="PaymentStatusId" asp-items="Model.AvailablePaymentStatuses"/></div></div><div class="form-group">- <admin-label asp-for="BillingCountryId" class="col-sm-3 control-label" />+ <admin-label asp-for="BillingCountryId" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="BillingCountryId" asp-items="Model.AvailableCountries" />+ <admin-select asp-for="BillingCountryId" asp-items="Model.AvailableCountries"/></div></div></div></div></div>-+<div class="x_content"><div id="salesreport-grid"></div></div>@@ -156,4 +156,4 @@return data;}-</script>+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/CountryReport.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/CountryReport.cshtmlindex 26c67ec1d..85f143b8e 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/CountryReport.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/CountryReport.cshtml@@ -5,7 +5,6 @@}-<div class="row"><div class="col-md-12"><div class="x_panel light form-fit popup-window">@@ -17,7 +16,7 @@</div><div class="x_content form">- <vc:vendor-widget widget-zone="vendor_country_report" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_country_report" additional-data="Model"/><div class="form-horizontal"><div class="form-body"><div class="x_content">@@ -27,14 +26,14 @@<div class="row align-items-end"><div class="col-md-4 col-ms-12 col-12"><div class="form-group mb-0">- <admin-label asp-for="StartDate" class="control-label" />- <admin-input asp-for="StartDate" />+ <admin-label asp-for="StartDate" class="control-label"/>+ <admin-input asp-for="StartDate"/></div></div><div class="col-md-4 col-ms-12 col-12"><div class="form-group mb-0">- <admin-label asp-for="EndDate" class="control-label" />- <admin-input asp-for="EndDate" />+ <admin-label asp-for="EndDate" class="control-label"/>+ <admin-input asp-for="EndDate"/></div></div><div class="col-md-4 col-sm-12 col-12">@@ -54,9 +53,9 @@<div class="collapse" id="filterCollapse"><div class="drop-filters-container w-100"><div class="form-group">- <admin-label asp-for="PaymentStatusId" class="control-label col-md-3 col-sm-3" />+ <admin-label asp-for="PaymentStatusId" class="control-label col-md-3 col-sm-3"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="PaymentStatusId" asp-items="Model.AvailablePaymentStatuses" />+ <admin-select asp-for="PaymentStatusId" asp-items="Model.AvailablePaymentStatuses"/></div></div></div>@@ -75,7 +74,7 @@</div>- <script>+<script>$(document).ready(function () {$("#countryreport-grid").kendoGrid({dataSource: {@@ -122,7 +121,7 @@});</script>- <script>+<script>$(document).ready(function () {@@ -145,4 +144,4 @@return data;}- </script>+ </script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/Customer.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/Customer.cshtmlindex a328da70b..e6703b655 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/Customer.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/Customer.cshtml@@ -7,7 +7,6 @@}-<div class="row"><div class="col-md-12"><div class="x_panel light form-fit popup-window">@@ -19,7 +18,7 @@</div><div class="x_content form">- <vc:vendor-widget widget-zone="vendor_customer_report" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_customer_report" additional-data="Model"/><div class="form-horizontal"><div class="form-body"><div class="x_content">@@ -29,14 +28,14 @@<div class="row align-items-end"><div class="col-md-4 col-ms-12 col-12"><div class="form-group mb-0">- <admin-label asp-for="StartDate" class="control-label" />- <admin-input asp-for="StartDate" />+ <admin-label asp-for="StartDate" class="control-label"/>+ <admin-input asp-for="StartDate"/></div></div><div class="col-md-4 col-ms-12 col-12"><div class="form-group mb-0">- <admin-label asp-for="EndDate" class="control-label" />- <admin-input asp-for="EndDate" />+ <admin-label asp-for="EndDate" class="control-label"/>+ <admin-input asp-for="EndDate"/></div></div><div class="col-md-4 col-sm-12 col-12">@@ -56,9 +55,9 @@<div class="collapse" id="filterCollapse"><div class="drop-filters-container w-100"><div class="form-group">- <admin-label asp-for="PaymentStatusId" class="control-label col-md-3 col-sm-3" />+ <admin-label asp-for="PaymentStatusId" class="control-label col-md-3 col-sm-3"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="PaymentStatusId" asp-items="Model.AvailablePaymentStatuses" />+ <admin-select asp-for="PaymentStatusId" asp-items="Model.AvailablePaymentStatuses"/></div></div></div>@@ -125,7 +124,7 @@});});</script>- <script>+<script>$(document).ready(function () {@@ -147,4 +146,4 @@return data;}- </script>+ </script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/LowStockReport.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/LowStockReport.cshtmlindex 721e542f4..269507b99 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/LowStockReport.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/LowStockReport.cshtml@@ -85,4 +85,4 @@]});});-</script>+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/NeverSoldReport.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/NeverSoldReport.cshtmlindex 48b58a90a..47cf05771 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/NeverSoldReport.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/NeverSoldReport.cshtml@@ -15,7 +15,7 @@</div></div><div class="x_content form">- <vc:vendor-widget widget-zone="vendor_never_sold_report" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_never_sold_report" additional-data="Model"/><div class="form-horizontal"><div class="form-body"><div class="x_content">@@ -24,14 +24,14 @@<div class="row align-items-end mb-3"><div class="col-md-3 col-sm-12 col-12"><div class="form-group mb-0">- <admin-label asp-for="StartDate" class="d-flex flex-column align-items-start mw-100 px-0 text-left" />- <admin-input asp-for="StartDate" class="w-100" />+ <admin-label asp-for="StartDate" class="d-flex flex-column align-items-start mw-100 px-0 text-left"/>+ <admin-input asp-for="StartDate" class="w-100"/></div></div><div class="col-md-3 col-sm-12 col-12"><div class="form-group mb-0">- <admin-label asp-for="EndDate" class="d-flex flex-column align-items-start mw-100 px-0 text-left" />- <admin-input asp-for="EndDate" class="w-100" />+ <admin-label asp-for="EndDate" class="d-flex flex-column align-items-start mw-100 px-0 text-left"/>+ <admin-input asp-for="EndDate" class="w-100"/></div></div><div class="col-md-5 col-sm-12 col-12 mt-md-0 mt-3">@@ -122,4 +122,4 @@return data;}-</script>+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Components/LatestVendorOrder/Default.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Components/LatestVendorOrder/Default.cshtmlindex e6162f97a..e61611982 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Components/LatestVendorOrder/Default.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Components/LatestVendorOrder/Default.cshtml@@ -87,4 +87,4 @@}});-</script>+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Components/VendorBestsellersBriefReportByAmount/Default.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Components/VendorBestsellersBriefReportByAmount/Default.cshtmlindex 68db6f188..45548b010 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Components/VendorBestsellersBriefReportByAmount/Default.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Components/VendorBestsellersBriefReportByAmount/Default.cshtml@@ -50,4 +50,4 @@}]});});-</script>+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Components/VendorPage/Default.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Components/VendorPage/Default.cshtmlindex 407ccce40..e26f366f8 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Components/VendorPage/Default.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Components/VendorPage/Default.cshtml@@ -1,4 +1,4 @@-@model Grand.Web.Vendor.Models.Common.VendorPortalModel+@model VendorPortalModel<div class="card"><div class="card-title">diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Address.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Address.cshtmlindex 7677b4459..c2972bdf6 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Address.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Address.cshtml@@ -25,41 +25,41 @@});</script>}-<input asp-for="Id" type="hidden" />-<input asp-for="FirstNameEnabled" type="hidden" />-<input asp-for="FirstNameRequired" type="hidden" />-<input asp-for="LastNameEnabled" type="hidden" />-<input asp-for="LastNameRequired" type="hidden" />-<input asp-for="EmailEnabled" type="hidden" />-<input asp-for="EmailRequired" type="hidden" />-<input asp-for="CompanyEnabled" type="hidden" />-<input asp-for="CompanyRequired" type="hidden" />-<input asp-for="VatNumberEnabled" type="hidden" />-<input asp-for="VatNumberRequired" type="hidden" />-<input asp-for="CountryEnabled" type="hidden" />-<input asp-for="StateProvinceEnabled" type="hidden" />-<input asp-for="CityEnabled" type="hidden" />-<input asp-for="CityRequired" type="hidden" />-<input asp-for="StreetAddressEnabled" type="hidden" />-<input asp-for="StreetAddressRequired" type="hidden" />-<input asp-for="StreetAddress2Enabled" type="hidden" />-<input asp-for="StreetAddress2Required" type="hidden" />-<input asp-for="ZipPostalCodeEnabled" type="hidden" />-<input asp-for="ZipPostalCodeRequired" type="hidden" />-<input asp-for="PhoneEnabled" type="hidden" />-<input asp-for="PhoneRequired" type="hidden" />-<input asp-for="FaxEnabled" type="hidden" />-<input asp-for="FaxRequired" type="hidden" />-<input asp-for="NoteEnabled" type="hidden" />+<input asp-for="Id" type="hidden"/>+<input asp-for="FirstNameEnabled" type="hidden"/>+<input asp-for="FirstNameRequired" type="hidden"/>+<input asp-for="LastNameEnabled" type="hidden"/>+<input asp-for="LastNameRequired" type="hidden"/>+<input asp-for="EmailEnabled" type="hidden"/>+<input asp-for="EmailRequired" type="hidden"/>+<input asp-for="CompanyEnabled" type="hidden"/>+<input asp-for="CompanyRequired" type="hidden"/>+<input asp-for="VatNumberEnabled" type="hidden"/>+<input asp-for="VatNumberRequired" type="hidden"/>+<input asp-for="CountryEnabled" type="hidden"/>+<input asp-for="StateProvinceEnabled" type="hidden"/>+<input asp-for="CityEnabled" type="hidden"/>+<input asp-for="CityRequired" type="hidden"/>+<input asp-for="StreetAddressEnabled" type="hidden"/>+<input asp-for="StreetAddressRequired" type="hidden"/>+<input asp-for="StreetAddress2Enabled" type="hidden"/>+<input asp-for="StreetAddress2Required" type="hidden"/>+<input asp-for="ZipPostalCodeEnabled" type="hidden"/>+<input asp-for="ZipPostalCodeRequired" type="hidden"/>+<input asp-for="PhoneEnabled" type="hidden"/>+<input asp-for="PhoneRequired" type="hidden"/>+<input asp-for="FaxEnabled" type="hidden"/>+<input asp-for="FaxRequired" type="hidden"/>+<input asp-for="NoteEnabled" type="hidden"/><div class="form-horizontal"><div class="form-body">@if (Model.NameEnabled){<div class="form-group">- <admin-label asp-for="Name" />+ <admin-label asp-for="Name"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Name" />+ <admin-input asp-for="Name"/><span asp-validation-for="Name"></span></div></div>@@ -67,9 +67,9 @@@if (Model.FirstNameEnabled){<div class="form-group">- <admin-label asp-for="FirstName" />+ <admin-label asp-for="FirstName"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="FirstName" />+ <admin-input asp-for="FirstName"/><span asp-validation-for="FirstName"></span></div></div>@@ -77,9 +77,9 @@@if (Model.LastNameEnabled){<div class="form-group">- <admin-label asp-for="LastName" />+ <admin-label asp-for="LastName"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="LastName" />+ <admin-input asp-for="LastName"/><span asp-validation-for="LastName"></span></div></div>@@ -87,9 +87,9 @@@if (Model.EmailEnabled){<div class="form-group">- <admin-label asp-for="Email" />+ <admin-label asp-for="Email"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Email" />+ <admin-input asp-for="Email"/><span asp-validation-for="Email"></span></div></div>@@ -97,9 +97,9 @@@if (Model.CompanyEnabled){<div class="form-group">- <admin-label asp-for="Company" />+ <admin-label asp-for="Company"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Company" />+ <admin-input asp-for="Company"/><span asp-validation-for="Company"></span></div></div>@@ -107,9 +107,9 @@@if (Model.VatNumberEnabled){<div class="form-group">- <admin-label asp-for="VatNumber" />+ <admin-label asp-for="VatNumber"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="VatNumber" />+ <admin-input asp-for="VatNumber"/><span asp-validation-for="VatNumber"></span></div></div>@@ -117,9 +117,9 @@@if (Model.CountryEnabled){<div class="form-group">- <admin-label asp-for="CountryId" />+ <admin-label asp-for="CountryId"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="CountryId" asp-items="Model.AvailableCountries" />+ <admin-select asp-for="CountryId" asp-items="Model.AvailableCountries"/><span asp-validation-for="CountryId"></span></div></div>@@ -127,9 +127,9 @@@if (Model.CountryEnabled && Model.StateProvinceEnabled){<div class="form-group">- <admin-label asp-for="StateProvinceId" />+ <admin-label asp-for="StateProvinceId"/><div class="col-md-9 col-sm-9">- <admin-select asp-for="StateProvinceId" asp-items="Model.AvailableStates" />+ <admin-select asp-for="StateProvinceId" asp-items="Model.AvailableStates"/><span asp-validation-for="StateProvinceId"></span></div></div>@@ -137,9 +137,9 @@@if (Model.CityEnabled){<div class="form-group">- <admin-label asp-for="City" />+ <admin-label asp-for="City"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="City" />+ <admin-input asp-for="City"/><span asp-validation-for="City"></span></div></div>@@ -147,9 +147,9 @@@if (Model.StreetAddressEnabled){<div class="form-group">- <admin-label asp-for="Address1" />+ <admin-label asp-for="Address1"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Address1" />+ <admin-input asp-for="Address1"/><span asp-validation-for="Address1"></span></div></div>@@ -157,9 +157,9 @@@if (Model.StreetAddress2Enabled){<div class="form-group">- <admin-label asp-for="Address2" />+ <admin-label asp-for="Address2"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Address2" />+ <admin-input asp-for="Address2"/><span asp-validation-for="Address2"></span></div></div>@@ -167,9 +167,9 @@@if (Model.ZipPostalCodeEnabled){<div class="form-group">- <admin-label asp-for="ZipPostalCode" />+ <admin-label asp-for="ZipPostalCode"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="ZipPostalCode" />+ <admin-input asp-for="ZipPostalCode"/><span asp-validation-for="ZipPostalCode"></span></div></div>@@ -177,9 +177,9 @@@if (Model.PhoneEnabled){<div class="form-group">- <admin-label asp-for="PhoneNumber" />+ <admin-label asp-for="PhoneNumber"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="PhoneNumber" />+ <admin-input asp-for="PhoneNumber"/><span asp-validation-for="PhoneNumber"></span></div></div>@@ -187,9 +187,9 @@@if (Model.FaxEnabled){<div class="form-group">- <admin-label asp-for="FaxNumber" />+ <admin-label asp-for="FaxNumber"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="FaxNumber" />+ <admin-input asp-for="FaxNumber"/><span asp-validation-for="FaxNumber"></span></div></div>@@ -197,9 +197,9 @@@if (Model.NoteEnabled){<div class="form-group">- <admin-label asp-for="Note" />+ <admin-label asp-for="Note"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Note" />+ <admin-input asp-for="Note"/><span asp-validation-for="Note"></span></div></div>@@ -207,7 +207,7 @@@if (Model.AddressTypeEnabled){<div class="form-group">- <admin-label asp-for="AddressType" />+ <admin-label asp-for="AddressType"/><div class="col-md-9 col-sm-9"><select asp-for="AddressType" asp-items="@AddressType.Any.ToSelectList(Context, false).ToList()" class="form-control custom-select"></select><span asp-validation-for="AddressType"></span>@@ -216,7 +216,7 @@}@if (Model.CustomAddressAttributes.Count > 0){- <partial name="Partials/AddressAttributes" model="Model.CustomAddressAttributes" />+ <partial name="Partials/AddressAttributes" model="Model.CustomAddressAttributes"/>}</div></div>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Brand.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Brand.cshtmlindex 9a994812d..c14bb165c 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Brand.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Brand.cshtml@@ -23,4 +23,4 @@dataValueField: "Id",});});-</script>+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Category.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Category.cshtmlindex 51029f3b6..8a8aa02a9 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Category.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Category.cshtml@@ -1,6 +1,6 @@@model string[email protected](model => model, new {@class = "col-md-8", style="width: 100%;" })[email protected](model => model, new { @class = "col-md-8", style = "width: 100%;" })<script>$(document).ready(function () {@@ -23,4 +23,4 @@dataValueField: "Id",});});-</script>+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Collection.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Collection.cshtmlindex d7e9e9ad6..c25197528 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Collection.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Collection.cshtml@@ -1,6 +1,6 @@@model string[email protected](model => model, new {@class = "col-md-8", style="width: 100%;" })[email protected](model => model, new { @class = "col-md-8", style = "width: 100%;" })<script>$(document).ready(function () {@@ -23,4 +23,4 @@dataValueField: "Id",});});-</script>+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/DateTime.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/DateTime.cshtmlindex 7a71fea21..912ddec53 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/DateTime.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/DateTime.cshtml@@ -1,5 +1,5 @@@model DateTime-<input id="@Html.IdForModel()" name="@Html.NameForModel()" value="@(Model)" />+<input id="@Html.IdForModel()" name="@Html.NameForModel()" value="@(Model)"/><script>$(document).ready(function () {diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/DateTimeNullable.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/DateTimeNullable.cshtmlindex a65bd8e8f..dd875ebf1 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/DateTimeNullable.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/DateTimeNullable.cshtml@@ -1,9 +1,9 @@@model DateTime?-<input id="@Html.IdForModel()" name="@Html.NameForModel()" value="@(Model.HasValue ? Model.Value : "")" />+<input id="@Html.IdForModel()" name="@Html.NameForModel()" value="@(Model.HasValue ? Model.Value : "")"/><script>$(document).ready(function () {$("#@Html.IdForModel()").kendoDateTimePicker({culture: "@CultureInfo.CurrentCulture.Name"});});-</script>+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Decimal.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Decimal.cshtmlindex 0080118bc..18ee418b4 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Decimal.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Decimal.cshtml@@ -12,4 +12,4 @@decimals: 2});});-</script>+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/DecimalN4.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/DecimalN4.cshtmlindex cbf04194e..0c6a3ecf1 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/DecimalN4.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/DecimalN4.cshtml@@ -12,4 +12,4 @@decimals: 4});});-</script>+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Double.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Double.cshtmlindex 81c10a938..df4670e48 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Double.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Double.cshtml@@ -12,4 +12,4 @@decimals: 2});});-</script>+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/DoubleN4.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/DoubleN4.cshtmlindex 409b3f0de..403a0f09b 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/DoubleN4.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/DoubleN4.cshtml@@ -8,4 +8,4 @@decimals: 4});});-</script>+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Editor.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Editor.cshtmlindex 5c43b50be..18243469d 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Editor.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Editor.cshtml@@ -1,6 +1,6 @@@model string@{- var random = CommonHelper.GenerateRandomInteger();+ var random = CommonHelper.GenerateRandomInteger();}<div id="s-@(random)-summernote" class="summernote" data-name="null" data-file="null" data-format="null">@Html.Raw(ViewData.TemplateInfo.FormattedModelValue)@@ -29,5 +29,4 @@},});});-</script>-+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/MultiPicture.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/MultiPicture.cshtmlindex d9e79dc79..df9b46e8b 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/MultiPicture.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/MultiPicture.cshtml@@ -1,3 +1,4 @@+@using Constants = Grand.SharedUIResources.Constants@model string@{var random = CommonHelper.GenerateRandomInteger();@@ -8,8 +9,8 @@var endpoint = ViewData["Endpoint"];var click = ViewData["Click"];}-<link rel="stylesheet" type="text/css" asp-src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/fineuploader/fineuploader-4.2.2.min.css" />-<script asp-location="Footer" asp-src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/fineuploader/jquery.fineuploader-4.2.2.min.js"></script>+<link rel="stylesheet" type="text/css" asp-src="@(Constants.WwwRoot)/administration/fineuploader/fineuploader-4.2.2.min.css"/>+<script asp-location="Footer" asp-src="@(Constants.WwwRoot)/administration/fineuploader/jquery.fineuploader-4.2.2.min.js"></script><div id="@clientId"></div>@@ -74,4 +75,4 @@});});-</script>+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Picture.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Picture.cshtmlindex a761c3834..54707f0fc 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Picture.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Picture.cshtml@@ -1,19 +1,20 @@+@using Grand.Business.Core.Interfaces.Storage+@using Constants = Grand.SharedUIResources.Constants@model string-@inject Grand.Business.Core.Interfaces.Storage.IPictureService pictureService+@inject IPictureService pictureService@{var random = CommonHelper.GenerateRandomInteger();var clientId = "picture" + random;var picture = await pictureService.GetPictureById(Model);var targetPictureSize = 100;-}-<link rel="stylesheet" type="text/css" asp-src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/fineuploader/fineuploader-4.2.2.min.css" />-<script asp-location="Footer" asp-src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/fineuploader/jquery.fineuploader-4.2.2.min.js"></script>+<link rel="stylesheet" type="text/css" asp-src="@(Constants.WwwRoot)/administration/fineuploader/fineuploader-4.2.2.min.css"/>+<script asp-location="Footer" asp-src="@(Constants.WwwRoot)/administration/fineuploader/jquery.fineuploader-4.2.2.min.js"></script><div id="@(clientId + "value")">- <input asp-for="@Model" type="hidden" />+ <input asp-for="@Model" type="hidden"/></div><div id="@(clientId + "image")">- <img src="@(await pictureService.GetPictureUrl(Model, targetSize: targetPictureSize, showDefaultPicture: true))" />+ <img src="@(await pictureService.GetPictureUrl(Model, targetPictureSize))"/></div>@if (picture != null){@@ -23,7 +24,7 @@ else{<span id="@(clientId + "remove")" class="btn red btn-outline" style="display:none;">@Loc["Vendor.Picture.RemovePicture"]</span>}-<br />+<br/><div id="@clientId"></div><script type="text/template" id="@(clientId)-qq-template"><div class="qq-uploader-selector qq-uploader">@@ -62,7 +63,7 @@ else$("#@(clientId)").fineUploader({request: {- endpoint: '@(Url.Action("AsyncUpload", "Picture", new { area = Constants.AreaVendor }))',+ endpoint: '@(Url.Action("AsyncUpload", "Picture", new { area = Grand.Web.Vendor.Extensions.Constants.AreaVendor }))',params: {Reference: '@ViewData["Reference"]',ObjectId: '@ViewData["ObjectId"]'@@ -92,4 +93,4 @@ else$(this).hide();});});-</script>+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Time.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Time.cshtmlindex b56c823a7..d8c387f00 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Time.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Time.cshtml@@ -1,5 +1,5 @@@model DateTime-<input id="@Html.IdForModel()" name="@Html.NameForModel()" value="@((Model > DateTime.MinValue ? Model : DateTime.Today).ToString("HH:mm"))" />+<input id="@Html.IdForModel()" name="@Html.NameForModel()" value="@((Model > DateTime.MinValue ? Model : DateTime.Today).ToString("HH:mm"))"/><script>$(document).ready(function () {$("#@Html.IdForModel()").kendoTimePicker({ format: "HH:mm" });diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/AddressAttributes.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/AddressAttributes.cshtmlindex d709f37b7..9ccc77f97 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/AddressAttributes.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/AddressAttributes.cshtml@@ -10,65 +10,65 @@@switch (attribute.AttributeControlType){case AttributeControlType.DropdownList:- {- <select class="form-control" name="@(controlId)" id="@(controlId)">- @if (!attribute.IsRequired)- {- <option value="">---</option>- }- @foreach (var attributeValue in attribute.Values)- {- <option selected="@attributeValue.IsPreSelected" value="@attributeValue.Id">@attributeValue.Name</option>- }- </select>- }+ {+ <select class="form-control" name="@(controlId)" id="@(controlId)">+ @if (!attribute.IsRequired)+ {+ <option value="">---</option>+ }+ @foreach (var attributeValue in attribute.Values)+ {+ <option selected="@attributeValue.IsPreSelected" value="@attributeValue.Id">@attributeValue.Name</option>+ }+ </select>+ }break;case AttributeControlType.RadioList:- {- <div class="radio-list">- @foreach (var attributeValue in attribute.Values)- {- <div>- <input id="@(controlId)_@(attributeValue.Id)" type="radio" name="@(controlId)" value="@attributeValue.Id" checked="@attributeValue.IsPreSelected" />- <label for="@(controlId)_@(attributeValue.Id)">@attributeValue.Name</label>- </div>- }- </div>- }+ {+ <div class="radio-list">+ @foreach (var attributeValue in attribute.Values)+ {+ <div>+ <input id="@(controlId)_@(attributeValue.Id)" type="radio" name="@(controlId)" value="@attributeValue.Id" checked="@attributeValue.IsPreSelected"/>+ <label for="@(controlId)_@(attributeValue.Id)">@attributeValue.Name</label>+ </div>+ }+ </div>+ }break;case AttributeControlType.Checkboxes:case AttributeControlType.ReadonlyCheckboxes:- {- <div class="checkbox-list">- @foreach (var attributeValue in attribute.Values)- {- <div>- <input id="@(controlId)_@(attributeValue.Id)" type="checkbox" name="@(controlId)" value="@(attributeValue.Id)" checked="@(attributeValue.IsPreSelected)" @(attribute.AttributeControlType == AttributeControlType.ReadonlyCheckboxes ? Html.Raw(" disabled=\"disabled\"") : null) />- <label for="@(controlId)_@(attributeValue.Id)">@attributeValue.Name</label>- </div>- }- </div>- }+ {+ <div class="checkbox-list">+ @foreach (var attributeValue in attribute.Values)+ {+ <div>+ <input id="@(controlId)_@(attributeValue.Id)" type="checkbox" name="@(controlId)" value="@(attributeValue.Id)" checked="@(attributeValue.IsPreSelected)" @(attribute.AttributeControlType == AttributeControlType.ReadonlyCheckboxes ? Html.Raw(" disabled=\"disabled\"") : null)/>+ <label for="@(controlId)_@(attributeValue.Id)">@attributeValue.Name</label>+ </div>+ }+ </div>+ }break;case AttributeControlType.TextBox:- {- <input name="@(controlId)" type="text" class="form-control text-box single-line" id="@(controlId)" value="@(attribute.DefaultValue)" />- }+ {+ <input name="@(controlId)" type="text" class="form-control text-box single-line" id="@(controlId)" value="@(attribute.DefaultValue)"/>+ }break;case AttributeControlType.MultilineTextbox:- {- <textarea id="@(controlId)" style="Width: 250px; Height: 150px;" name="@(controlId)">@(attribute.DefaultValue)</textarea>- }+ {+ <textarea id="@(controlId)" style="Width: 250px; Height: 150px;" name="@(controlId)">@(attribute.DefaultValue)</textarea>+ }break;case AttributeControlType.Datepicker:case AttributeControlType.FileUpload:case AttributeControlType.ColorSquares:case AttributeControlType.ImageSquares:- {- //not support attribute type- }+ {+ //not support attribute type+ }break;}</div></div>-}+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/Delete.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/Delete.cshtmlindex 45dcc8d5c..c38439958 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/Delete.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/Delete.cshtml@@ -6,7 +6,7 @@</p><div class="form-actions"><span id="" class="k-button" onclick="$('#@Model.WindowId').data('kendoWindow').close();">@Loc["Vendor.Common.NoCancel"]</span>- <input type="submit" class="k-button" value="@Loc["Vendor.Common.Delete"]" />+ <input type="submit" class="k-button" value="@Loc["Vendor.Common.Delete"]"/></div></div></form>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/HeadVendor.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/HeadVendor.cshtmlindex c38bb42f9..1dcb462c5 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/HeadVendor.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/HeadVendor.cshtml@@ -1,59 +1,60 @@-@inject Grand.Domain.Localization.LanguageSettings languageSettings+@using Grand.Domain.Localization+@using Constants = Grand.SharedUIResources.Constants+@inject LanguageSettings languageSettings@inject IWorkContext workContext<script>- const wwwrootpath = '@(Grand.SharedUIResources.Constants.WwwRoot)';+ const wwwrootpath = '@(Constants.WwwRoot)';</script>@{var supportRtl = workContext.WorkingLanguage.Rtl &&- !languageSettings.IgnoreRtlPropertyForAdminArea;+ !languageSettings.IgnoreRtlPropertyForAdminArea;var kendoVersion = "2021.3.914";- <link rel="stylesheet" type="text/css" href="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/bootstrap/css/daterangepicker.min.css" />- <link rel="stylesheet" type="text/css" href="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/build/css/font-awesome.min.css" />- <link rel="stylesheet" type="text/css" href="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/simple-line-icons/simple-line-icons.min.css" />- <link rel="stylesheet" type="text/css" href="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/bootstrap/css/bootstrap.min.css" />- <link rel="stylesheet" type="text/css" href="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/magnific-popup/magnific-popup.min.css" />- <link rel="stylesheet" type="text/css" href="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/summernote/summernote.min.css" />- <link rel="stylesheet" type="text/css" href="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/jquery-ui-themes/smoothness/jquery-ui-1.10.3.custom.min.css" />+ <link rel="stylesheet" type="text/css" href="@(Constants.WwwRoot)/administration/bootstrap/css/daterangepicker.min.css"/>+ <link rel="stylesheet" type="text/css" href="@(Constants.WwwRoot)/administration/build/css/font-awesome.min.css"/>+ <link rel="stylesheet" type="text/css" href="@(Constants.WwwRoot)/administration/simple-line-icons/simple-line-icons.min.css"/>+ <link rel="stylesheet" type="text/css" href="@(Constants.WwwRoot)/administration/bootstrap/css/bootstrap.min.css"/>+ <link rel="stylesheet" type="text/css" href="@(Constants.WwwRoot)/administration/magnific-popup/magnific-popup.min.css"/>+ <link rel="stylesheet" type="text/css" href="@(Constants.WwwRoot)/administration/summernote/summernote.min.css"/>+ <link rel="stylesheet" type="text/css" href="@(Constants.WwwRoot)/administration/jquery-ui-themes/smoothness/jquery-ui-1.10.3.custom.min.css"/>- <link rel="stylesheet" type="text/css" href="@string.Format(Grand.SharedUIResources.Constants.WwwRoot+"/administration/kendo/styles/{0}/kendo.material.mobile.min.css", kendoVersion)" />- <link rel="stylesheet" type="text/css" href="@string.Format(Grand.SharedUIResources.Constants.WwwRoot+"/administration/kendo/styles/{0}/kendo.material.min.css", kendoVersion)" />- <link rel="stylesheet" type="text/css" href="@string.Format(Grand.SharedUIResources.Constants.WwwRoot+"/administration/kendo/styles/{0}/kendo.common-material.min.css", kendoVersion)" />+ <link rel="stylesheet" type="text/css" href="@string.Format(Constants.WwwRoot + "/administration/kendo/styles/{0}/kendo.material.mobile.min.css", kendoVersion)"/>+ <link rel="stylesheet" type="text/css" href="@string.Format(Constants.WwwRoot + "/administration/kendo/styles/{0}/kendo.material.min.css", kendoVersion)"/>+ <link rel="stylesheet" type="text/css" href="@string.Format(Constants.WwwRoot + "/administration/kendo/styles/{0}/kendo.common-material.min.css", kendoVersion)"/>- <link rel="stylesheet" type="text/css" asp-src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/farbtastic/farbtastic.css" />+ <link rel="stylesheet" type="text/css" asp-src="@(Constants.WwwRoot)/administration/farbtastic/farbtastic.css"/>//CSSif (supportRtl){- <link rel="stylesheet" type="text/css" href="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/bootstrap/css/bootstrap-rtl.min.css" />- <link rel="stylesheet" type="text/css" href="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/build/css/custom-rtl.css" />- <link rel="stylesheet" type="text/css" href="@string.Format(Grand.SharedUIResources.Constants.WwwRoot+"/administration/kendo/styles/{0}/kendo.rtl.min.css", kendoVersion)" />+ <link rel="stylesheet" type="text/css" href="@(Constants.WwwRoot)/administration/bootstrap/css/bootstrap-rtl.min.css"/>+ <link rel="stylesheet" type="text/css" href="@(Constants.WwwRoot)/administration/build/css/custom-rtl.css"/>+ <link rel="stylesheet" type="text/css" href="@string.Format(Constants.WwwRoot + "/administration/kendo/styles/{0}/kendo.rtl.min.css", kendoVersion)"/>}else{- <link rel="stylesheet" type="text/css" href="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/build/css/custom.css" />+ <link rel="stylesheet" type="text/css" href="@(Constants.WwwRoot)/administration/build/css/custom.css"/>}- <script asp-location="Head" asp-src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/build/js/jquery.min.js"></script>- <script asp-location="Head" asp-src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/jquery-ui/jquery-ui.min.js"></script>- <script asp-location="Head" asp-src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/build/js/moment.min.js"></script>- <script asp-location="Head" asp-src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/bootstrap/js/daterangepicker.min.js"></script>- <script asp-location="Head" asp-src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/typeahead.js"></script>- <script asp-location="Head" asp-src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/jquery.validate.min.js"></script>- <script asp-location="Head" asp-src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/jquery.validate.unobtrusive.min.js"></script>- <script asp-location="Head" asp-src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/admin.common.js"></script>- <script asp-location="Head" asp-src="@string.Format(Grand.SharedUIResources.Constants.WwwRoot+"/administration/kendo/scripts/{0}/kendo.ui.core.min.js", kendoVersion)"></script>- <script asp-location="Head" asp-src="@string.Format(Grand.SharedUIResources.Constants.WwwRoot+"/administration/kendo/scripts/{0}/kendo.grid.js", kendoVersion)"></script>- <script asp-location="Head" asp-src="@string.Format(Grand.SharedUIResources.Constants.WwwRoot+"/administration/kendo/scripts/{0}/cultures/kendo.culture.{1}.js", kendoVersion, CultureInfo.CurrentCulture.Name)"></script>--- <script asp-location="Footer" asp-src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/bootstrap/js/popper.min.js"></script>- <script asp-location="Footer" asp-src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/bootstrap/js/bootstrap.min.js"></script>- <script asp-location="Footer" asp-src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/build/js/smartresize.js"></script>- <script asp-location="Footer" asp-src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/build/js/custom.js"></script>- <script asp-location="Footer" asp-src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/summernote/summernote.min.js"></script>- <script asp-location="Footer" asp-src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/magnific-popup/jquery.magnific-popup.min.js"></script>- <script asp-location="Footer" asp-src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/jquery.tmpl.min.js"></script>- <script asp-location="Footer" asp-src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/farbtastic/farbtastic.js"></script>-+ <script asp-location="Head" asp-src="@(Constants.WwwRoot)/administration/build/js/jquery.min.js"></script>+ <script asp-location="Head" asp-src="@(Constants.WwwRoot)/administration/jquery-ui/jquery-ui.min.js"></script>+ <script asp-location="Head" asp-src="@(Constants.WwwRoot)/administration/build/js/moment.min.js"></script>+ <script asp-location="Head" asp-src="@(Constants.WwwRoot)/administration/bootstrap/js/daterangepicker.min.js"></script>+ <script asp-location="Head" asp-src="@(Constants.WwwRoot)/administration/typeahead.js"></script>+ <script asp-location="Head" asp-src="@(Constants.WwwRoot)/administration/jquery.validate.min.js"></script>+ <script asp-location="Head" asp-src="@(Constants.WwwRoot)/administration/jquery.validate.unobtrusive.min.js"></script>+ <script asp-location="Head" asp-src="@(Constants.WwwRoot)/administration/admin.common.js"></script>+ <script asp-location="Head" asp-src="@string.Format(Constants.WwwRoot + "/administration/kendo/scripts/{0}/kendo.ui.core.min.js", kendoVersion)"></script>+ <script asp-location="Head" asp-src="@string.Format(Constants.WwwRoot + "/administration/kendo/scripts/{0}/kendo.grid.js", kendoVersion)"></script>+ <script asp-location="Head" asp-src="@string.Format(Constants.WwwRoot + "/administration/kendo/scripts/{0}/cultures/kendo.culture.{1}.js", kendoVersion, CultureInfo.CurrentCulture.Name)"></script>+++ <script asp-location="Footer" asp-src="@(Constants.WwwRoot)/administration/bootstrap/js/popper.min.js"></script>+ <script asp-location="Footer" asp-src="@(Constants.WwwRoot)/administration/bootstrap/js/bootstrap.min.js"></script>+ <script asp-location="Footer" asp-src="@(Constants.WwwRoot)/administration/build/js/smartresize.js"></script>+ <script asp-location="Footer" asp-src="@(Constants.WwwRoot)/administration/build/js/custom.js"></script>+ <script asp-location="Footer" asp-src="@(Constants.WwwRoot)/administration/summernote/summernote.min.js"></script>+ <script asp-location="Footer" asp-src="@(Constants.WwwRoot)/administration/magnific-popup/jquery.magnific-popup.min.js"></script>+ <script asp-location="Footer" asp-src="@(Constants.WwwRoot)/administration/jquery.tmpl.min.js"></script>+ <script asp-location="Footer" asp-src="@(Constants.WwwRoot)/administration/farbtastic/farbtastic.js"></script>}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/Menu.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/Menu.cshtmlindex 7ce59aa9d..9910337fd 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/Menu.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/Menu.cshtml@@ -1,6 +1,8 @@@using Grand.Business.Core.Interfaces.Common.Security-@using Grand.Web.Common.Menu@using Grand.Business.Core.Interfaces.System.Admin+@using Grand.Business.Core.Utilities.Common.Security+@using Grand.Web.Common.Menu+@using Constants = Grand.SharedUIResources.Constants@inject IPermissionService permissionService@inject IAdminSiteMapService adminSiteMapService@inject IEnumerable<IAdminMenuProvider> _adminMenuProviders@@ -17,7 +19,9 @@<div class="col-md-3 left_col"><div class="left_col scroll-view"><div class="navbar nav_title">- <a href="~/Vendor" class="site_title"><img src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/build/images/grandLogo.png" width="35" height="35" /> <span>GrandNode</span></a>+ <a href="~/Vendor" class="site_title">+ <img src="@(Constants.WwwRoot)/administration/build/images/grandLogo.png" width="35" height="35"/> <span>GrandNode</span>+ </a></div><div class="clearfix"></div><div class="main_menu_side hidden-print main_menu" id="sidebar-menu">@@ -32,17 +36,18 @@{await adminMenuPlugin.ManageSiteMap(rootNode);}+//"Plugins" menu item should be visible when it has some child nodesvar pluginNode = rootNode.ChildNodes.FirstOrDefault(x => x.SystemName == "Third party plugins");- if (pluginNode is {Visible: true })+ if (pluginNode is { Visible: true }){- var hasManagePluginsPermission = await permissionService.Authorize(Grand.Business.Core.Utilities.Common.Security.StandardPermission.ManagePlugins);+ var hasManagePluginsPermission = await permissionService.Authorize(StandardPermission.ManagePlugins);pluginNode.Visible = hasManagePluginsPermission && pluginNode.ChildNodes.Any(x => x.Visible);}}@foreach (var item in rootNode.ChildNodes.Where(x => x.Visible)){- <partial name="Partials/MenuItem" model="item" />+ <partial name="Partials/MenuItem" model="item"/>}</ul></div>diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/MenuItem.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/MenuItem.cshtmlindex 4c439f6a0..8a0110ce6 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/MenuItem.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/MenuItem.cshtml@@ -1,5 +1,4 @@-@model SiteMapNode-@using Grand.Web.Common.Menu+@model Grand.Web.Common.Menu.SiteMapNode@{var url = "javascript:;";@@ -11,47 +10,47 @@{url = Model.Url.StartsWith("~/", StringComparison.Ordinal) ? Url.Content(Model.Url) : Model.Url;}+var childNodes = Model.ChildNodes.Where(x => x.Visible).ToList();- <li class="@if (childNodes.Any()) {<text>has-submenu</text>}">- @if (childNodes.Any())- {- <a class="nav-link">- @if (!string.IsNullOrEmpty(Model.IconClass))- {- <i class="@Model.IconClass"></i>- }- <span class="title">@Loc[Model.ResourceName]</span>- </a>- }- else- {- <a href="@url" class="nav-link" @(Model.OpenUrlInNewTab ? Html.Raw(" target=\"_blank\"") : null)>- @if (!string.IsNullOrEmpty(Model.IconClass))- {- <i class="@Model.IconClass"></i>- }- <span class="title">@Loc[Model.ResourceName]</span>- @if (childNodes.Any())- {- <span class="fa fa-chevron-right"></span>- }+<li class="@if (childNodes.Any()) { <text>has-submenu</text> }">+ @if (childNodes.Any())+ {+ <a class="nav-link">+ @if (!string.IsNullOrEmpty(Model.IconClass))+ {+ <i class="@Model.IconClass"></i>+ }+ <span class="title">@Loc[Model.ResourceName]</span>+ </a>+ }+ else+ {+ <a href="@url" class="nav-link" @(Model.OpenUrlInNewTab ? Html.Raw(" target=\"_blank\"") : null)>+ @if (!string.IsNullOrEmpty(Model.IconClass))+ {+ <i class="@Model.IconClass"></i>+ }+ <span class="title">@Loc[Model.ResourceName]</span>+ @if (childNodes.Any())+ {+ <span class="fa fa-chevron-right"></span>+ }- </a>- }+ </a>+ }- @if (childNodes.Any())- {- <ul class="nav child_menu">- <li class="menu-header">- <span class="title">@Loc[Model.ResourceName]</span>- <span class="close-menu" onclick="closeSubMenu(this)"></span>- </li>- @foreach (var childItem in childNodes)- {- <partial name="Partials/MenuItem" model="childItem" />- }- </ul>- }- </li>-}+ @if (childNodes.Any())+ {+ <ul class="nav child_menu">+ <li class="menu-header">+ <span class="title">@Loc[Model.ResourceName]</span>+ <span class="close-menu" onclick="closeSubMenu(this)"></span>+ </li>+ @foreach (var childItem in childNodes)+ {+ <partial name="Partials/MenuItem" model="childItem"/>+ }+ </ul>+ }+</li>}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/Notifications.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/Notifications.cshtmlindex 7eda32e28..657d4ce8c 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/Notifications.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/Notifications.cshtml@@ -5,6 +5,7 @@{successMessages.AddRange((TempData[$"Grand.notifications.{NotifyType.Success}"] as IList<string>)!);}+if (ViewData[$"Grand.notifications.{NotifyType.Success}"] != null){successMessages.AddRange((ViewData[$"Grand.notifications.{NotifyType.Success}"] as IList<string>)!);@@ -17,6 +18,7 @@{errorMessages.AddRange((TempData[$"Grand.notifications.{NotifyType.Error}"] as IList<string>)!);}+if (ViewData[$"Grand.notifications.{NotifyType.Error}"] != null){errorMessages.AddRange((ViewData[$"Grand.notifications.{NotifyType.Error}"] as IList<string>)!);@@ -28,11 +30,11 @@{warningMessages.AddRange((TempData[$"Grand.notifications.{NotifyType.Warning}"] as IList<string>)!);}+if (ViewData[$"Grand.notifications.{NotifyType.Warning}"] != null){warningMessages.AddRange((ViewData[$"Grand.notifications.{NotifyType.Warning}"] as IList<string>)!);}-}@foreach (var message in successMessages){diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/_VendorLayout.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/_VendorLayout.cshtmlindex c05472a9f..fe8892bd2 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/_VendorLayout.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/_VendorLayout.cshtml@@ -1,16 +1,17 @@-@inject IWorkContext workContext-@inject LanguageSettings languageSettings-@inject VendorSettings vendorSettings-@using Grand.Domain.Localization+@using Grand.Domain.Localization@using Grand.Domain.Vendors@using Grand.Web.Common.TagHelpers@using Grand.Web.Vendor.Components@using Microsoft.AspNetCore.Mvc.TagHelpers+@using Constants = Grand.SharedUIResources.Constants+@inject IWorkContext workContext+@inject LanguageSettings languageSettings+@inject VendorSettings vendorSettings@{var currentCustomer = workContext.CurrentCustomer;var currentVersion = GrandVersion.FullVersion;var supportRtl = workContext.WorkingLanguage.Rtl &&- !languageSettings.IgnoreRtlPropertyForAdminArea;+ !languageSettings.IgnoreRtlPropertyForAdminArea;//page titlevar pageTitle = "";@@ -18,23 +19,28 @@{pageTitle = ViewBag.Title + " / ";}- pageTitle += Loc["Vendor.PageTitle"];+ pageTitle += Loc["Vendor.PageTitle"];}<!DOCTYPE html>-<html @if (supportRtl) { <text> dir="rtl" </text> }>+<html+ @if (supportRtl)+ {+ <text> dir="rtl" </text>+ }+><head><title>@pageTitle</title>- <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />+ <meta http-equiv="Content-type" content="text/html;charset=UTF-8"/><meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"><head-custom/>- <partial name="Partials/HeadVendor" />- <resources asp-type="HeadLink" />- <resources asp-type="HeadScript" />+ <partial name="Partials/HeadVendor"/>+ <resources asp-type="HeadLink"/>+ <resources asp-type="HeadScript"/></head><body class="nav-sm @if (IsSectionDefined("popupwindow")) { @await RenderSectionAsync("popupwindow") <text>no-sidebar</text> }">- @Html.AntiForgeryToken()- <script>+<script>kendo.culture("@CultureInfo.CurrentCulture.Name");if (document.readyState == "loading") {$(".site_title").css("padding-left", "26px");@@ -45,104 +51,104 @@}</script>- <div class="container body">- <div class="main_container">- <vc:vendor-widget widget-zone="vendor_vendor_header_before" additional-data="null" />- @if (IsSectionDefined("headermenu"))- {- @await RenderSectionAsync("headermenu")- }- else- {- <partial name="Partials/Menu" />- }- <vc:vendor-widget widget-zone="vendor_vendor_header_after" additional-data="null" />- @if (IsSectionDefined("statusbar"))- {- @await RenderSectionAsync("statusbar")- }- @if (IsSectionDefined("header"))- {- @await RenderSectionAsync("header")- }- else- {- <vc:vendor-widget widget-zone="vendor_header_before" additional-data="null" />- <div class="top_nav">- <div class="nav_menu">- <nav>- <vc:vendor-widget widget-zone="vendor_header_toggle_after" additional-data="null" />- <ul class="nav navbar-nav navbar-right">+<div class="container body">+ <div class="main_container">+ <vc:vendor-widget widget-zone="vendor_vendor_header_before" additional-data="null"/>+ @if (IsSectionDefined("headermenu"))+ {+ @await RenderSectionAsync("headermenu")+ }+ else+ {+ <partial name="Partials/Menu"/>+ }+ <vc:vendor-widget widget-zone="vendor_vendor_header_after" additional-data="null"/>+ @if (IsSectionDefined("statusbar"))+ {+ @await RenderSectionAsync("statusbar")+ }+ @if (IsSectionDefined("header"))+ {+ @await RenderSectionAsync("header")+ }+ else+ {+ <vc:vendor-widget widget-zone="vendor_header_before" additional-data="null"/>+ <div class="top_nav">+ <div class="nav_menu">+ <nav>+ <vc:vendor-widget widget-zone="vendor_header_toggle_after" additional-data="null"/>+ <ul class="nav navbar-nav navbar-right">- <li class="dropdown" role="presentation">- <a href="@Url.Action("Index", "Home", new { area = "" })" class="dropdown-toggle">- <i class="icon-home"></i>- </a>- </li>- <li role="presentation" class="dropdown">- <a href="javascript:;" class="dropdown-toggle info-number" data-toggle="dropdown" aria-expanded="false">- <i class="icon-info"></i>- </a>- <ul id="menu1" class="dropdown-menu dropdown-menu-right list-unstyled msg_list overflow-h" role="menu">- <li>- <a href="http://docs.grandnode.com/" target="_blank">- <i class="icon-book-open"></i>- @Loc["Vendor.Header.Documentation"]- </a>- </li>- <li>- <a href="https://grandnode.com/boards" target="_blank">- <i class="icon-bubbles"></i>- @Loc["Vendor.Header.Community"]- </a>- </li>- <li>- <a href="https://grandnode.com/release-notes" target="_blank">- <i class="fa fa-dot-circle-o"></i>- grandnode @currentVersion- </a>- </li>- </ul>- </li>-- <li>- <a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false">- <img src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/build/images/avatar.png" alt="">- <div class="username-hide-on-mobile">- @(currentCustomer.Email)- </div>- <span class="fa fa-angle-down"></span>- </a>+ <li class="dropdown" role="presentation">+ <a href="@Url.Action("Index", "Home", new { area = "" })" class="dropdown-toggle">+ <i class="icon-home"></i>+ </a>+ </li>+ <li role="presentation" class="dropdown">+ <a href="javascript:;" class="dropdown-toggle info-number" data-toggle="dropdown" aria-expanded="false">+ <i class="icon-info"></i>+ </a>+ <ul id="menu1" class="dropdown-menu dropdown-menu-right list-unstyled msg_list overflow-h" role="menu">+ <li>+ <a href="http://docs.grandnode.com/" target="_blank">+ <i class="icon-book-open"></i>+ @Loc["Vendor.Header.Documentation"]+ </a>+ </li>+ <li>+ <a href="https://grandnode.com/boards" target="_blank">+ <i class="icon-bubbles"></i>+ @Loc["Vendor.Header.Community"]+ </a>+ </li>+ <li>+ <a href="https://grandnode.com/release-notes" target="_blank">+ <i class="fa fa-dot-circle-o"></i>+ grandnode @currentVersion+ </a>+ </li>+ </ul>+ </li>- <ul class="dropdown-menu dropdown-menu-right dropdown-menu-default">- @if (vendorSettings.AllowVendorsToEditInfo)- {- <li>- <a href="@Url.Action("Edit", "VendorInfo", new { area = Constants.AreaVendor })">- <i class="icon-user"></i> @Loc["Vendor.Header.Profile"]- </a>- </li>- }+ <li>+ <a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false">+ <img src="@(Constants.WwwRoot)/administration/build/images/avatar.png" alt="">+ <div class="username-hide-on-mobile">+ @(currentCustomer.Email)+ </div>+ <span class="fa fa-angle-down"></span>+ </a>++ <ul class="dropdown-menu dropdown-menu-right dropdown-menu-default">+ @if (vendorSettings.AllowVendorsToEditInfo)+ {<li>- <a href="@Url.Action("Logout", "Home", new { area = Constants.AreaVendor }, null)">- <i class="icon-logout"></i> @Loc["Vendor.Header.Logout"]+ <a href="@Url.Action("Edit", "VendorInfo", new { area = Grand.Web.Vendor.Extensions.Constants.AreaVendor })">+ <i class="icon-user"></i> @Loc["Vendor.Header.Profile"]</a></li>- </ul>- </li>- <li class="dropdown" role="presentation">- <span id="searchIcon" class="searchIcon dropdown-toggle">- <i class="icon-magnifier"></i>- </span>- </li>- <li role="presentation">- <a>- <div class="custom-control custom-switch light-dark-switch">- <input type="checkbox" class="custom-control-input" id="DarkLight">- <label class="custom-control-label" for="DarkLight">Enable Dark Mode</label>- </div>- </a>- <script>+ }+ <li>+ <a href="@Url.Action("Logout", "Home", new { area = Grand.Web.Vendor.Extensions.Constants.AreaVendor }, null)">+ <i class="icon-logout"></i> @Loc["Vendor.Header.Logout"]+ </a>+ </li>+ </ul>+ </li>+ <li class="dropdown" role="presentation">+ <span id="searchIcon" class="searchIcon dropdown-toggle">+ <i class="icon-magnifier"></i>+ </span>+ </li>+ <li role="presentation">+ <a>+ <div class="custom-control custom-switch light-dark-switch">+ <input type="checkbox" class="custom-control-input" id="DarkLight">+ <label class="custom-control-label" for="DarkLight">Enable Dark Mode</label>+ </div>+ </a>+ <script>const toggleSwitch = document.querySelector('.light-dark-switch input[type="checkbox"]');const currentTheme = localStorage.getItem('theme');@@ -171,35 +177,35 @@toggleSwitch.addEventListener('change', switchTheme, false);</script>- </li>- </ul>- </nav>- </div>- <div class="clear"></div>+ </li>+ </ul>+ </nav></div>- <vc:vendor-widget widget-zone="vendor_header_navbar_after" additional-data="null" />- }+ <div class="clear"></div>+ </div>+ <vc:vendor-widget widget-zone="vendor_header_navbar_after" additional-data="null"/>+ }- <div class="right_col" role="main">- <partial name="Partials/Notifications" />- @RenderBody()+ <div class="right_col" role="main">+ <partial name="Partials/Notifications"/>+ @RenderBody()+ </div>+ <div class="throbber">+ <div class="curtain"></div>- <div class="throbber">- <div class="curtain">- </div>- <div class="curtain-content">- <div>- <h1 class="throbber-header">Wait...</h1>- <div class="spinner active">- <svg style="width:100px; height:100px" viewBox="0 0 64 64">- <circle cx="32" cy="32" r="29" fill="none" stroke-width="3" stroke-miterlimit="10"></circle>- </svg>- </div>+ <div class="curtain-content">+ <div>+ <h1 class="throbber-header">Wait...</h1>+ <div class="spinner active">+ <svg style="width:100px; height:100px" viewBox="0 0 64 64">+ <circle cx="32" cy="32" r="29" fill="none" stroke-width="3" stroke-miterlimit="10"></circle>+ </svg></div></div></div></div></div>- <resources asp-type="ScriptFooter" />+</div>+<resources asp-type="ScriptFooter"/></body></html>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/_VendorLoginLayout.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/_VendorLoginLayout.cshtmlindex cb8d3640f..831719bdc 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/_VendorLoginLayout.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/_VendorLoginLayout.cshtml@@ -1,4 +1,5 @@-@model Grand.Web.Vendor.Models.Common.LoginModel+@using Constants = Grand.SharedUIResources.Constants+@model LoginModel@{//page titleLayout = "";@@ -10,36 +11,36 @@{pageTitle = ViewBag.Title + " / ";}- pageTitle += Loc["Vendor.Login.PageTitle"];+ pageTitle += Loc["Vendor.Login.PageTitle"];}<!DOCTYPE html><html><head><title>@pageTitle</title>- <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />+ <meta http-equiv="Content-type" content="text/html;charset=UTF-8"/><meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">- <link rel="stylesheet" type="text/css" href="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/build/css/font-awesome.min.css" />- <link rel="stylesheet" type="text/css" href="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/simple-line-icons/simple-line-icons.min.css" />- <link rel="stylesheet" type="text/css" href="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/bootstrap/css/bootstrap.min.css" />- <link rel="stylesheet" type="text/css" href="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/build/css/custom.css" />+ <link rel="stylesheet" type="text/css" href="@(Constants.WwwRoot)/administration/build/css/font-awesome.min.css"/>+ <link rel="stylesheet" type="text/css" href="@(Constants.WwwRoot)/administration/simple-line-icons/simple-line-icons.min.css"/>+ <link rel="stylesheet" type="text/css" href="@(Constants.WwwRoot)/administration/bootstrap/css/bootstrap.min.css"/>+ <link rel="stylesheet" type="text/css" href="@(Constants.WwwRoot)/administration/build/css/custom.css"/>- <script src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/build/js/jquery.min.js"></script>- <script src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/build/js/moment.min.js"></script>- <script src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/jquery.validate.min.js"></script>- <script src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/jquery.validate.unobtrusive.min.js"></script>- <script src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/jquery-ui/jquery-ui.min.js"></script>- <script src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/bootstrap/js/popper.min.js"></script>- <script src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/bootstrap/js/bootstrap.min.js"></script>+ <script src="@(Constants.WwwRoot)/administration/build/js/jquery.min.js"></script>+ <script src="@(Constants.WwwRoot)/administration/build/js/moment.min.js"></script>+ <script src="@(Constants.WwwRoot)/administration/jquery.validate.min.js"></script>+ <script src="@(Constants.WwwRoot)/administration/jquery.validate.unobtrusive.min.js"></script>+ <script src="@(Constants.WwwRoot)/administration/jquery-ui/jquery-ui.min.js"></script>+ <script src="@(Constants.WwwRoot)/administration/bootstrap/js/popper.min.js"></script>+ <script src="@(Constants.WwwRoot)/administration/bootstrap/js/bootstrap.min.js"></script></head><body>- @Html.AntiForgeryToken()- <div class="container body admin-login-layout">- <div class="main_container">- @RenderBody()- </div>+<div class="container body admin-login-layout">+ <div class="main_container">+ @RenderBody()</div>+</div></body></html>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shipment/AddShipment.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shipment/AddShipment.cshtmlindex 22d1f3fe1..a9784c10d 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shipment/AddShipment.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shipment/AddShipment.cshtml@@ -2,7 +2,6 @@@{//page titleViewBag.Title = string.Format(Loc["Vendor.Orders.Shipments.AddNew.Title"], Model.OrderId);-}<form asp-area="@Constants.AreaVendor" asp-controller="Shipment" asp-action="AddShipment" method="post"asp-route-orderId="@Context.Request.Query["orderId"]">diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shipment/List.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shipment/List.cshtmlindex a4a8300c5..1ab7a552d 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shipment/List.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shipment/List.cshtml@@ -5,7 +5,7 @@}<form asp-area="@Constants.AreaVendor" asp-controller="Shipment" asp-action="List" method="post">-+<div class="row"><div class="col-md-12"><div class="x_panel light form-fit popup-window">@@ -24,9 +24,13 @@<i class="fa fa-file-pdf-o"></i>@Loc["Vendor.Orders.Shipments.PrintPackagingSlip.Selected"]</button>- <button class="btn btn-success" type="submit" id="ship-selected"><i class="fa fa-check"></i> @Loc["Vendor.Orders.Shipments.ShipSelected"] </button>- <button class="btn btn-success" type="submit" id="deliver-selected"><i class="fa fa-check-circle"></i> @Loc["Vendor.Orders.Shipments.DeliverySelected"] </button>- <vc:vendor-widget widget-zone="vendor_order_shipment_list_buttons" additional-data="null" />+ <button class="btn btn-success" type="submit" id="ship-selected">+ <i class="fa fa-check"></i> @Loc["Vendor.Orders.Shipments.ShipSelected"]+ </button>+ <button class="btn btn-success" type="submit" id="deliver-selected">+ <i class="fa fa-check-circle"></i> @Loc["Vendor.Orders.Shipments.DeliverySelected"]+ </button>+ <vc:vendor-widget widget-zone="vendor_order_shipment_list_buttons" additional-data="null"/></div></div></div>@@ -37,8 +41,8 @@<div class="row align-items-end"><div class="col-md-8 col-ms-12 col-12"><div class="form-group mb-0">- <admin-label asp-for="TrackingNumber" class="control-label" />- <admin-input asp-for="TrackingNumber" />+ <admin-label asp-for="TrackingNumber" class="control-label"/>+ <admin-input asp-for="TrackingNumber"/></div></div><div class="col-md-4 col-sm-12 col-12">@@ -58,22 +62,22 @@<div class="collapse" id="filterCollapse"><div class="drop-filters-container w-100"><div class="form-group">- <admin-label asp-for="StartDate" class="col-sm-3 control-label" />+ <admin-label asp-for="StartDate" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="StartDate" />+ <admin-input asp-for="StartDate"/></div></div><div class="form-group">- <admin-label asp-for="EndDate" class="col-sm-3 control-label" />+ <admin-label asp-for="EndDate" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="EndDate" />+ <admin-input asp-for="EndDate"/></div></div><div class="form-group">- <admin-label asp-for="LoadNotShipped" class="col-sm-3 control-label" />+ <admin-label asp-for="LoadNotShipped" class="col-sm-3 control-label"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="LoadNotShipped" />+ <admin-input asp-for="LoadNotShipped"/><div class="control__indicator"></div></label></div>@@ -357,8 +361,8 @@</form><form asp-area="@Constants.AreaVendor" asp-controller="Shipment" asp-action="PdfPackagingSlipSelected" method="post" id="pdf-packaging-slip-selected-form">-- <input type="hidden" id="selectedIds" name="selectedIds" value="" />++ <input type="hidden" id="selectedIds" name="selectedIds" value=""/></form><script>@@ -373,4 +377,4 @@});});-</script>+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shipment/Partials/Info.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shipment/Partials/Info.cshtmlindex 2ab6e69ab..375bec3d9 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shipment/Partials/Info.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shipment/Partials/Info.cshtml@@ -3,22 +3,22 @@<div class="form-horizontal"><div class="form-body"><div class="form-group">- <admin-label asp-for="OrderId" />+ <admin-label asp-for="OrderId"/><div class="col-md-9 col-sm-9"><label class="control-label">- <a href="@Url.Action("Edit", "Order", new {Id = Model.OrderId, area = Constants.AreaVendor})">@Model.OrderNumber - @Loc["Vendor.Common.View"]</a>+ <a href="@Url.Action("Edit", "Order", new { Id = Model.OrderId, area = Constants.AreaVendor })">@Model.OrderNumber - @Loc["Vendor.Common.View"]</a></label></div></div><div class="form-group">- <admin-label asp-for="TrackingNumber" />+ <admin-label asp-for="TrackingNumber"/><div class="col-md-6"><div class="input-group"><div class="input-group-control">- <admin-input asp-for="TrackingNumber" />+ <admin-input asp-for="TrackingNumber"/></div><div class="input-group-append">- <input type="submit" name="settrackingnumber" asp-action="SetTrackingNumber" value="@Loc["Vendor.Orders.Shipments.TrackingNumber.Button"]" class="btn default" />+ <input type="submit" name="settrackingnumber" asp-action="SetTrackingNumber" value="@Loc["Vendor.Orders.Shipments.TrackingNumber.Button"]" class="btn default"/>@if (!string.IsNullOrEmpty(Model.TrackingNumberUrl)){<a href="@Model.TrackingNumberUrl" target="_blank" class="tracking-url">@Loc["Vendor.Orders.Shipments.TrackingNumber.ViewOnline"]</a>@@ -28,26 +28,26 @@</div></div><div class="form-group">- <admin-label asp-for="AdminComment" />+ <admin-label asp-for="AdminComment"/><div class="col-md-6"><div class="input-group"><div class="input-group-control">- <admin-input asp-for="AdminComment" />+ <admin-input asp-for="AdminComment"/></div><div class="input-group-append">- <input type="submit" name="setadmincomment" asp-action="SetShipmentAdminComment" value="@Loc["Vendor.Orders.Shipments.AdminComment.Button"]" class="btn default" />+ <input type="submit" name="setadmincomment" asp-action="SetShipmentAdminComment" value="@Loc["Vendor.Orders.Shipments.AdminComment.Button"]" class="btn default"/></div></div></div></div><div class="form-group">- <admin-label asp-for="TotalWeight" />+ <admin-label asp-for="TotalWeight"/><div class="col-md-9 col-sm-9"><label class="control-label">@Model.TotalWeight</label></div></div><div class="form-group">- <admin-label asp-for="ShippedDate" />+ <admin-label asp-for="ShippedDate"/><div class="col-md-9 col-sm-9"><span id="lblShippedDate">@if (Model.ShippedDate.HasValue)@@ -61,11 +61,11 @@</span>@if (Model.CanShip){- <input type="submit" name="setasshipped" asp-action="SetAsShipped" value="@Loc["Vendor.Orders.Shipments.ShippedDate.Button"]" id="setasshipped" class="btn default" />+ <input type="submit" name="setasshipped" asp-action="SetAsShipped" value="@Loc["Vendor.Orders.Shipments.ShippedDate.Button"]" id="setasshipped" class="btn default"/>}@if (Model.ShippedDateUtc.HasValue){- <div id="divShippedDate" style="display: inline-block;"><admin-input asp-for="ShippedDate" /> @Loc["Vendor.Orders.Shipments.ShippedDate.Enter"]</div>+ <div id="divShippedDate" style="display: inline-block;"><admin-input asp-for="ShippedDate"/> @Loc["Vendor.Orders.Shipments.ShippedDate.Enter"]</div><button type="submit" id="btnEditShippedDate" onclick=" toggleShippedDate(true);return false; " class="k-button"><span class="k-icon k-i-edit"></span> @Loc["Vendor.Common.Edit"]</button><button type="submit" id="btnSaveShippedDate" asp-action="EditShippedDate" name="saveshippeddate" onclick=" return confirm('@Loc["Vendor.Common.AreYouSure"]'); " class="k-button"><span class="k-icon k-i-save"></span> @Loc["Vendor.Common.Save"]</button><button type="submit" id="btnCancelShippedDate" onclick=" toggleShippedDate(false);return false; " class="k-button"><span class="k-icon k-i-cancel"></span> @Loc["Vendor.Common.Cancel"]</button>@@ -73,7 +73,7 @@</div></div><div class="form-group">- <admin-label asp-for="DeliveryDate" />+ <admin-label asp-for="DeliveryDate"/><div class="col-md-9 col-sm-9"><span id="lblDeliveryDate">@if (Model.DeliveryDate.HasValue)@@ -87,11 +87,11 @@</span>@if (Model.CanDeliver){- <input type="submit" name="setasdelivered" asp-action="SetAsDelivered" value="@Loc["Vendor.Orders.Shipments.DeliveryDate.Button"]" id="setasdelivered" class="btn default" />+ <input type="submit" name="setasdelivered" asp-action="SetAsDelivered" value="@Loc["Vendor.Orders.Shipments.DeliveryDate.Button"]" id="setasdelivered" class="btn default"/>}@if (Model.DeliveryDateUtc.HasValue){- <div id="divDeliveryDate" style="display: inline-block;"><admin-input asp-for="DeliveryDate" /> @Loc["Vendor.Orders.Shipments.DeliveryDate.Enter"]</div>+ <div id="divDeliveryDate" style="display: inline-block;"><admin-input asp-for="DeliveryDate"/> @Loc["Vendor.Orders.Shipments.DeliveryDate.Enter"]</div><button type="submit" id="btnEditDeliveryDate" onclick=" toggleDeliveryDate(true);return false; " class="k-button"><span class="k-icon k-i-edit"></span> @Loc["Vendor.Common.Edit"]</button><button type="submit" id="btnSaveDeliveryDate" asp-action="EditDeliveryDate" name="savedeliverydate" onclick=" return confirm('@Loc["Vendor.Common.AreYouSure"]'); " class="k-button"><span class="k-icon k-i-save"></span> @Loc["Vendor.Common.Save"]</button><button type="submit" id="btnCancelDeliveryDate" onclick=" toggleDeliveryDate(false);return false; " class="k-button"><span class="k-icon k-i-cancel"></span> @Loc["Vendor.Common.Cancel"]</button>@@ -112,69 +112,71 @@<td><table class="table table-bordered table-striped table-hover"><thead>- <tr>- <th>- @Loc["Vendor.Orders.Shipments.Products.ProductName"]- </th>- <th>- @Loc["Vendor.Orders.Shipments.Products.SKU"]- </th>- <th>- @Loc["Vendor.Orders.Shipments.Products.Warehouse"]- </th>- <th>- @Loc["Vendor.Orders.Shipments.Products.ItemWeight"]- </th>- <th>- @Loc["Vendor.Orders.Shipments.Products.ItemDimensions"]- </th>- <th>- @Loc["Vendor.Orders.Shipments.Products.QtyShipped"]- </th>- </tr>+ <tr>+ <th>+ @Loc["Vendor.Orders.Shipments.Products.ProductName"]+ </th>+ <th>+ @Loc["Vendor.Orders.Shipments.Products.SKU"]+ </th>+ <th>+ @Loc["Vendor.Orders.Shipments.Products.Warehouse"]+ </th>+ <th>+ @Loc["Vendor.Orders.Shipments.Products.ItemWeight"]+ </th>+ <th>+ @Loc["Vendor.Orders.Shipments.Products.ItemDimensions"]+ </th>+ <th>+ @Loc["Vendor.Orders.Shipments.Products.QtyShipped"]+ </th>+ </tr></thead><tbody>- @foreach (var item in Model.Items)- {- <tr>- <td>- <div style="padding-left: 10px; padding-right: 10px;">- <em><a href="@Url.Action("Edit", "Product", new { id = item.ProductId, area = Constants.AreaVendor })">@item.ProductName</a></em>- @if (!string.IsNullOrEmpty(item.AttributeInfo))- {- <p>- @Html.Raw(item.AttributeInfo)- </p>- }- @if (!string.IsNullOrEmpty(item.RentalInfo))- {- <p>- @Html.Raw(item.RentalInfo)- </p>- }- </div>- </td>- <td>- <div style="padding-left: 10px; padding-right: 10px;">- @item.Sku- </div>- </td>- <td>- <div style="padding-left: 10px; padding-right: 10px;">- @item.ShippedFromWarehouse- </div>- </td>- <td>- @item.ItemWeight- </td>- <td>- @item.ItemDimensions- </td>- <td>- @item.QuantityInThisShipment- </td>- </tr>- }+ @foreach (var item in Model.Items)+ {+ <tr>+ <td>+ <div style="padding-left: 10px; padding-right: 10px;">+ <em>+ <a href="@Url.Action("Edit", "Product", new { id = item.ProductId, area = Constants.AreaVendor })">@item.ProductName</a>+ </em>+ @if (!string.IsNullOrEmpty(item.AttributeInfo))+ {+ <p>+ @Html.Raw(item.AttributeInfo)+ </p>+ }+ @if (!string.IsNullOrEmpty(item.RentalInfo))+ {+ <p>+ @Html.Raw(item.RentalInfo)+ </p>+ }+ </div>+ </td>+ <td>+ <div style="padding-left: 10px; padding-right: 10px;">+ @item.Sku+ </div>+ </td>+ <td>+ <div style="padding-left: 10px; padding-right: 10px;">+ @item.ShippedFromWarehouse+ </div>+ </td>+ <td>+ @item.ItemWeight+ </td>+ <td>+ @item.ItemDimensions+ </td>+ <td>+ @item.QuantityInThisShipment+ </td>+ </tr>+ }</tbody></table></td>@@ -191,46 +193,45 @@<div class="form-group"><table class="table table-bordered table-striped table-hover"><thead>- <tr>- <th align="center">- @Loc["Vendor.Orders.Shipments.ShipmentStatusEvents.Event"]- </th>- <th align="center">- @Loc["Vendor.Orders.Shipments.ShipmentStatusEvents.Location"]- </th>- <th align="center">- @Loc["Vendor.Orders.Shipments.ShipmentStatusEvents.Date"]- </th>- </tr>+ <tr>+ <th align="center">+ @Loc["Vendor.Orders.Shipments.ShipmentStatusEvents.Event"]+ </th>+ <th align="center">+ @Loc["Vendor.Orders.Shipments.ShipmentStatusEvents.Location"]+ </th>+ <th align="center">+ @Loc["Vendor.Orders.Shipments.ShipmentStatusEvents.Date"]+ </th>+ </tr></thead><tbody>- @foreach (var item in Model.ShipmentStatusEvents)- {- <tr>- <td style="width:40%;">- <div style="padding-left: 10px; padding-right: 10px;">- @item.EventName- </div>- </td>- <td style="width:20%;">- <div style="padding-left: 10px; padding-right: 10px;">- @item.Location- </div>- </td>- <td style="width:20%;">- <div style="padding-left: 10px; padding-right: 10px;">- @if (item.Date.HasValue)- {- @item.Date.Value.ToString("D")- }- </div>- </td>- </tr>- }+ @foreach (var item in Model.ShipmentStatusEvents)+ {+ <tr>+ <td style="width:40%;">+ <div style="padding-left: 10px; padding-right: 10px;">+ @item.EventName+ </div>+ </td>+ <td style="width:20%;">+ <div style="padding-left: 10px; padding-right: 10px;">+ @item.Location+ </div>+ </td>+ <td style="width:20%;">+ <div style="padding-left: 10px; padding-right: 10px;">+ @if (item.Date.HasValue)+ {+ @item.Date.Value.ToString("D")+ }+ </div>+ </td>+ </tr>+ }</tbody></table></div></div></div>-}-+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shipment/Partials/ShipmentNotes.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shipment/Partials/ShipmentNotes.cshtmlindex 01a36aaf2..267595e1e 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shipment/Partials/ShipmentNotes.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shipment/Partials/ShipmentNotes.cshtml@@ -1,11 +1,11 @@@model ShipmentModel<div class="panel panel-default">- <vc:vendor-widget widget-zone="vendor_order_shipment_details_notes_top" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_order_shipment_details_notes_top" additional-data="Model"/><div class="panel-body"><div id="shipmentnotes-grid"></div></div>- <vc:vendor-widget widget-zone="vendor_order_shipment_details_notes_bottom" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_order_shipment_details_notes_bottom" additional-data="Model"/></div><script>$(document).ready(function () {@@ -102,17 +102,17 @@<div class="form-horizontal"><div class="form-body"><div class="form-group">- <admin-label asp-for="AddShipmentNoteMessage" />+ <admin-label asp-for="AddShipmentNoteMessage"/><div class="col-md-9 col-sm-9"><admin-textarea asp-for="AddShipmentNoteMessage"></admin-textarea><span asp-validation-for="AddShipmentNoteMessage"></span></div></div><div class="form-group">- <admin-label asp-for="AddShipmentNoteDisplayToCustomer" />+ <admin-label asp-for="AddShipmentNoteDisplayToCustomer"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="AddShipmentNoteDisplayToCustomer" />+ <admin-input asp-for="AddShipmentNoteDisplayToCustomer"/><div class="control__indicator"></div></label><span asp-validation-for="AddShipmentNoteDisplayToCustomer"></span>@@ -161,4 +161,4 @@});});});-</script>+</script>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shipment/ShipmentDetails.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shipment/ShipmentDetails.cshtmlindex 0c577804d..2ff0753d9 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shipment/ShipmentDetails.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shipment/ShipmentDetails.cshtml@@ -4,7 +4,7 @@ViewBag.Title = Loc["Vendor.Orders.Shipments.ViewDetails"];}<form asp-area="@Constants.AreaVendor" asp-controller="Shipment" asp-action="ShipmentDetails" method="post">- <input type="hidden" asp-for="Id" />+ <input type="hidden" asp-for="Id"/><script>$(document).ready(function () {toggleShippedDate(false);@@ -63,8 +63,10 @@<a href="@Url.Action("PdfPackagingSlip", new { shipmentId = Model.Id, area = Constants.AreaVendor })" class="btn purple"><i class="fa fa-file-pdf-o"></i> @Loc["Vendor.Orders.Shipments.PrintPackagingSlip"]</a>- <span id="shipment-delete" class="btn red"><i class="fa fa-trash-o"></i> @Loc["Vendor.Common.Delete"]</span>- <vc:vendor-widget widget-zone="vendor_order_shipment_details_buttons" additional-data="Model" />+ <span id="shipment-delete" class="btn red">+ <i class="fa fa-trash-o"></i> @Loc["Vendor.Common.Delete"]+ </span>+ <vc:vendor-widget widget-zone="vendor_order_shipment_details_buttons" additional-data="Model"/></div></div></div>@@ -74,18 +76,18 @@<tabstrip-item text="@Loc["Vendor.Orders.Shipments.ViewDetails.Info"]" tab-index="0"><content><div>- <partial name="Partials/Info" model="Model" />+ <partial name="Partials/Info" model="Model"/></div></content></tabstrip-item><tabstrip-item text="@Loc["Vendor.Orders.Shipments.ShipmentNotes"]" tab-index="1"><content><div>- <partial name="Partials/ShipmentNotes" model="Model" />+ <partial name="Partials/ShipmentNotes" model="Model"/></div></content></tabstrip-item>- <vc:vendor-widget widget-zone="vendor_order_shipment_details_tabs" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_order_shipment_details_tabs" additional-data="Model"/></items></admin-tabstrip></div>@@ -94,4 +96,4 @@</div></div></form>-<admin-delete-confirmation button-id="shipment-delete" action-name="DeleteShipment" />+<admin-delete-confirmation button-id="shipment-delete" action-name="DeleteShipment"/>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorInfo/Edit.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorInfo/Edit.cshtmlindex 43295ef63..90dc4a030 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorInfo/Edit.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorInfo/Edit.cshtml@@ -4,7 +4,7 @@ViewBag.Title = Loc["Vendor.EditVendorDetails"];}<form asp-area="@Constants.AreaVendor" asp-controller="VendorInfo" asp-action="Edit" method="post">-+<div class="row"><div class="col-md-12"><div class="x_panel light form-fit">@@ -15,15 +15,17 @@</div><div class="actions"><div class="btn-group btn-group-devided">- <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Vendor.Common.Save"] </button>- <vc:vendor-widget widget-zone="vendor_vendor_details_buttons" additional-data="Model" />+ <button class="btn btn-success" type="submit" name="save">+ <i class="fa fa-check"></i> @Loc["Vendor.Common.Save"]+ </button>+ <vc:vendor-widget widget-zone="vendor_vendor_details_buttons" additional-data="Model"/></div></div></div><div class="x_content form">- <partial name="Partials/CreateOrUpdate" model="Model" />+ <partial name="Partials/CreateOrUpdate" model="Model"/></div></div></div></div>-</form>+</form>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorInfo/Partials/CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorInfo/Partials/CreateOrUpdate.TabInfo.cshtmlindex 9f1ca168a..40643d4cd 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorInfo/Partials/CreateOrUpdate.TabInfo.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorInfo/Partials/CreateOrUpdate.TabInfo.cshtml@@ -1,5 +1,5 @@-@model VendorModel-@using Microsoft.AspNetCore.Mvc.Razor;+@using Microsoft.AspNetCore.Mvc.Razor+@model VendorModel<script>$(document).ready(function () {$("@Model.AllowCustomersToSelectPageSize").click(togglePageSize);@@ -16,39 +16,40 @@}}</script>-<vc:vendor-widget widget-zone="vendor_vendor_details_info_top" additional-data="Model" />+<vc:vendor-widget widget-zone="vendor_vendor_details_info_top" additional-data="Model"/>-@{ Func<int, HelperResult>- template = @<div class="form-body">- <div class="form-group">- <admin-label asp-for="@Model.Locales[item].Name" />- <div class="col-md-9 col-sm-9">- <admin-input asp-for="@Model.Locales[item].Name" />- <span asp-validation-for="@Model.Locales[item].Name"></span>- </div>- </div>- <div class="form-group">- <admin-label asp-for="@Model.Locales[item].Description" />- <div class="col-md-9 col-sm-9">- <admin-textarea asp-for="@Model.Locales[item].Description"></admin-textarea>- <span asp-validation-for="@Model.Locales[item].Description"></span>- </div>- </div>- <input asp-for="@Model.Locales[item].LanguageId" type="hidden" />-</div>;+@{+ Func<int, HelperResult>+ template = @<div class="form-body">+ <div class="form-group">+ <admin-label asp-for="@Model.Locales[item].Name"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="@Model.Locales[item].Name"/>+ <span asp-validation-for="@Model.Locales[item].Name"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="@Model.Locales[item].Description"/>+ <div class="col-md-9 col-sm-9">+ <admin-textarea asp-for="@Model.Locales[item].Description"></admin-textarea>+ <span asp-validation-for="@Model.Locales[item].Description"></span>+ </div>+ </div>+ <input asp-for="@Model.Locales[item].LanguageId" type="hidden"/>+ </div>;}<div class="form-horizontal">- <localized-editor localized-template=@template name="vendor-info-localized" [email protected](c=>c.LanguageId).ToList()>+ <localized-editor localized-template="@template" name="vendor-info-localized" language-ids="@Model.Locales.Select(c => c.LanguageId).ToList()"><div class="form-body"><div class="form-group">- <admin-label asp-for="Name" />+ <admin-label asp-for="Name"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Name" />+ <admin-input asp-for="Name"/><span asp-validation-for="Name"></span></div></div><div class="form-group">- <admin-label asp-for="Description" />+ <admin-label asp-for="Description"/><div class="col-md-9 col-sm-9"><admin-textarea asp-for="Description"></admin-textarea><span asp-validation-for="Description"></span>@@ -58,48 +59,48 @@</localized-editor><div class="form-body"><div class="form-group">- <admin-label asp-for="Email" />+ <admin-label asp-for="Email"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="Email" />+ <admin-input asp-for="Email"/><span asp-validation-for="Email"></span></div></div><div class="form-group">- <admin-label asp-for="AllowCustomersToSelectPageSize" />+ <admin-label asp-for="AllowCustomersToSelectPageSize"/><div class="col-md-9 col-sm-9"><label class="mt-checkbox mt-checkbox-outline control control-checkbox">- <admin-input asp-for="AllowCustomersToSelectPageSize" />+ <admin-input asp-for="AllowCustomersToSelectPageSize"/><div class="control__indicator"></div></label><span asp-validation-for="AllowCustomersToSelectPageSize"></span></div></div><div class="form-group" id="pnlPageSize">- <admin-label asp-for="PageSize" />+ <admin-label asp-for="PageSize"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="PageSize" />+ <admin-input asp-for="PageSize"/><span asp-validation-for="PageSize"></span></div></div><div class="form-group" id="pnlPageSizeOptions">- <admin-label asp-for="PageSizeOptions" />+ <admin-label asp-for="PageSizeOptions"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="PageSizeOptions" />+ <admin-input asp-for="PageSizeOptions"/><span asp-validation-for="PageSizeOptions"></span></div></div></div></div>@if (Model.Address.FaxEnabled || Model.Address.PhoneEnabled || Model.Address.StateProvinceEnabled || Model.Address.StreetAddressEnabled || Model.Address.ZipPostalCodeEnabled ||-Model.Address.CityEnabled || Model.Address.CompanyEnabled || Model.Address.CountryEnabled || Model.Address.StreetAddress2Enabled)+ Model.Address.CityEnabled || Model.Address.CompanyEnabled || Model.Address.CountryEnabled || Model.Address.StreetAddress2Enabled){<div class="panel panel-default"><div class="panel-heading">@Loc["Admin.Vendors.Fields.Address"]</div><div class="panel-body">- <admin-input asp-for="Address" asp-template="Address" />+ <admin-input asp-for="Address" asp-template="Address"/></div></div>}-<vc:admin-widget widget-zone="vendor_details_info_bottom" additional-data="Model" />\ No newline at end of file+<vc:admin-widget widget-zone="vendor_details_info_bottom" additional-data="Model"/>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorInfo/Partials/CreateOrUpdate.TabSeo.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorInfo/Partials/CreateOrUpdate.TabSeo.cshtmlindex f204a2859..48334538c 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorInfo/Partials/CreateOrUpdate.TabSeo.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorInfo/Partials/CreateOrUpdate.TabSeo.cshtml@@ -1,73 +1,74 @@-@model VendorModel-@using Microsoft.AspNetCore.Mvc.Razor;+@using Microsoft.AspNetCore.Mvc.Razor+@model VendorModel-<vc:admin-widget widget-zone="vendor_details_seo_top" additional-data="Model" />+<vc:admin-widget widget-zone="vendor_details_seo_top" additional-data="Model"/>-@{ Func<int, HelperResult>- template = @<div class="form-body">- <div class="form-group">- <admin-label asp-for="@Model.Locales[item].MetaKeywords" />- <div class="col-md-9 col-sm-9">- <admin-input asp-for="@Model.Locales[item].MetaKeywords" />- <span asp-validation-for="@Model.Locales[item].MetaKeywords"></span>- </div>- </div>- <div class="form-group">- <admin-label asp-for="@Model.Locales[item].MetaDescription" />- <div class="col-md-9 col-sm-9">- <admin-textarea asp-for="@Model.Locales[item].MetaDescription"></admin-textarea>- <span asp-validation-for="@Model.Locales[item].MetaDescription"></span>- </div>- </div>- <div class="form-group">- <admin-label asp-for="@Model.Locales[item].MetaTitle" />- <div class="col-md-9 col-sm-9">- <admin-input asp-for="@Model.Locales[item].MetaTitle" />- <span asp-validation-for="@Model.Locales[item].MetaTitle"></span>- </div>- </div>- <div class="form-group">- <admin-label asp-for="@Model.Locales[item].SeName" />- <div class="col-md-9 col-sm-9">- <admin-input asp-for="@Model.Locales[item].SeName" />- <span asp-validation-for="@Model.Locales[item].SeName"></span>- </div>- </div>- <input asp-for="@Model.Locales[item].LanguageId" type="hidden" />-</div>;+@{+ Func<int, HelperResult>+ template = @<div class="form-body">+ <div class="form-group">+ <admin-label asp-for="@Model.Locales[item].MetaKeywords"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="@Model.Locales[item].MetaKeywords"/>+ <span asp-validation-for="@Model.Locales[item].MetaKeywords"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="@Model.Locales[item].MetaDescription"/>+ <div class="col-md-9 col-sm-9">+ <admin-textarea asp-for="@Model.Locales[item].MetaDescription"></admin-textarea>+ <span asp-validation-for="@Model.Locales[item].MetaDescription"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="@Model.Locales[item].MetaTitle"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="@Model.Locales[item].MetaTitle"/>+ <span asp-validation-for="@Model.Locales[item].MetaTitle"></span>+ </div>+ </div>+ <div class="form-group">+ <admin-label asp-for="@Model.Locales[item].SeName"/>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="@Model.Locales[item].SeName"/>+ <span asp-validation-for="@Model.Locales[item].SeName"></span>+ </div>+ </div>+ <input asp-for="@Model.Locales[item].LanguageId" type="hidden"/>+ </div>;}<div class="form-horizontal">- <localized-editor localized-template=@template name="vendor-seo-localized" [email protected](c=>c.LanguageId).ToList()>+ <localized-editor localized-template="@template" name="vendor-seo-localized" language-ids="@Model.Locales.Select(c => c.LanguageId).ToList()"><div class="form-body"><div class="form-group">- <admin-label asp-for="MetaKeywords" />+ <admin-label asp-for="MetaKeywords"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="MetaKeywords" />+ <admin-input asp-for="MetaKeywords"/><span asp-validation-for="MetaKeywords"></span></div></div><div class="form-group">- <admin-label asp-for="MetaDescription" />+ <admin-label asp-for="MetaDescription"/><div class="col-md-9 col-sm-9"><admin-textarea asp-for="MetaDescription"></admin-textarea><span asp-validation-for="MetaDescription"></span></div></div><div class="form-group">- <admin-label asp-for="MetaTitle" />+ <admin-label asp-for="MetaTitle"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="MetaTitle" />+ <admin-input asp-for="MetaTitle"/><span asp-validation-for="MetaTitle"></span></div></div><div class="form-group">- <admin-label asp-for="SeName" />+ <admin-label asp-for="SeName"/><div class="col-md-9 col-sm-9">- <admin-input asp-for="SeName" />+ <admin-input asp-for="SeName"/><span asp-validation-for="SeName"></span></div></div></div></localized-editor></div>-<vc:admin-widget widget-zone="vendor_details_seo_bottom" additional-data="Model" />\ No newline at end of file+<vc:admin-widget widget-zone="vendor_details_seo_bottom" additional-data="Model"/>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorInfo/Partials/CreateOrUpdate.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorInfo/Partials/CreateOrUpdate.cshtmlindex ac3a88f73..7b6603491 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorInfo/Partials/CreateOrUpdate.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorInfo/Partials/CreateOrUpdate.cshtml@@ -1,23 +1,23 @@@model VendorModel<div asp-validation-summary="All"></div>-<input asp-for="Id" type="hidden" />+<input asp-for="Id" type="hidden"/><admin-tabstrip name="vendor-edit" BindGrid="true"><items><tabstrip-item text="@Loc["Vendor.Info"]" tab-index="0"><content><div>- <partial name="Partials/CreateOrUpdate.TabInfo" model="Model" />+ <partial name="Partials/CreateOrUpdate.TabInfo" model="Model"/></div></content></tabstrip-item><tabstrip-item text="@Loc["Vendor.Common.SEO"]" tab-index="1"><content><div>- <partial name="Partials/CreateOrUpdate.TabSeo" model="Model" />+ <partial name="Partials/CreateOrUpdate.TabSeo" model="Model"/></div></content></tabstrip-item>- <vc:vendor-widget widget-zone="vendor_vendor_details_tabs" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_vendor_details_tabs" additional-data="Model"/></items>-</admin-tabstrip>+</admin-tabstrip>\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorReview/List.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorReview/List.cshtmlindex 55a2f6413..4da4b3baa 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorReview/List.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorReview/List.cshtml@@ -1,7 +1,6 @@@model VendorReviewListModel@inject AdminAreaSettings adminAreaSettings@{-//page titleViewBag.Title = Loc["Vendor.VendorReviews"];}@@ -17,7 +16,7 @@<div class="actions btn-group btn-group-devided"><button type="button" id="approve-selected" class="k-button"><span class="k-icon k-i-check-outline"></span> @Loc["Vendor.VendorReviews.ApproveSelected"]</button><button type="button" id="disapprove-selected" class="k-button"><span class="k-icon k-i-close-outline"></span> @Loc["Vendor.VendorReviews.DisapproveSelected"]</button>- <vc:vendor-widget widget-zone="vendor_review_list_buttons" additional-data="Model" />+ <vc:vendor-widget widget-zone="vendor_review_list_buttons" additional-data="Model"/></div></div><div class="x_content form">@@ -27,8 +26,8 @@<div class="row align-items-end"><div class="col-md-8 col-ms-12 col-12"><div class="form-group mb-0">- <admin-label asp-for="SearchText" class="control-labe" />- <admin-input asp-for="SearchText" />+ <admin-label asp-for="SearchText" class="control-labe"/>+ <admin-input asp-for="SearchText"/></div></div><div class="col-md-4 col-sm-12 col-12">@@ -48,15 +47,15 @@<div class="collapse" id="filterCollapse"><div class="drop-filters-container w-100"><div class="form-group">- <admin-label asp-for="CreatedOnFrom" />+ <admin-label asp-for="CreatedOnFrom"/><div class="col-md-4 col-sm-6">- <admin-input asp-for="CreatedOnFrom" />+ <admin-input asp-for="CreatedOnFrom"/></div></div><div class="form-group">- <admin-label asp-for="CreatedOnTo" />+ <admin-label asp-for="CreatedOnTo"/><div class="col-md-4 col-sm-6">- <admin-input asp-for="CreatedOnTo" />+ <admin-input asp-for="CreatedOnTo"/></div></div></div>diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/_ViewImports.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/_ViewImports.cshtmlindex 8fcb07419..a6eb511ef 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/_ViewImports.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/_ViewImports.cshtml@@ -23,6 +23,8 @@@using Grand.Web.Common.Themes@using Grand.Web.Common.Page@using Grand.Web.Common.Link;++@using Grand.Web.Common.Localization@using Grand.Web.Vendor.Extensions;@using Grand.Web.Vendor.Models.Common;@using Grand.Web.Vendor.Models.Catalog;@@ -32,4 +34,4 @@@using Grand.Web.Vendor.Models.Vendor;@using Grand.Web.Vendor.Models.VendorReview;@using Grand.Web.Vendor.Models.Report;-@inject Grand.Web.Common.Localization.LocService Loc+@inject LocService Loc\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Components/LatestVendorOrder.cs b/src/Web/Grand.Web.Vendor/Components/LatestVendorOrder.csindex 6545e9827..f208a5fdd 100644--- a/src/Web/Grand.Web.Vendor/Components/LatestVendorOrder.cs+++ b/src/Web/Grand.Web.Vendor/Components/LatestVendorOrder.cs@@ -3,22 +3,22 @@ using Grand.Business.Core.Utilities.Common.Security;using Grand.Web.Common.Components;using Microsoft.AspNetCore.Mvc;-namespace Grand.Web.Vendor.Components+namespace Grand.Web.Vendor.Components;++public class LatestVendorOrderViewComponent : BaseVendorViewComponent{- public class LatestVendorOrderViewComponent : BaseVendorViewComponent+ private readonly IPermissionService _permissionService;++ public LatestVendorOrderViewComponent(IPermissionService permissionService)+ {+ _permissionService = permissionService;+ }++ public async Task<IViewComponentResult> InvokeAsync(){- private readonly IPermissionService _permissionService;- public LatestVendorOrderViewComponent(IPermissionService permissionService)- {- _permissionService = permissionService;- }+ if (!await _permissionService.Authorize(StandardPermission.ManageOrders))+ return Content("");- public async Task<IViewComponentResult> InvokeAsync()- {- if (!await _permissionService.Authorize(StandardPermission.ManageOrders))- return Content("");-- return View();- }+ return View();}}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Components/VendorBestsellersBriefReportByAmount.cs b/src/Web/Grand.Web.Vendor/Components/VendorBestsellersBriefReportByAmount.csindex 6cea90ddc..9f9fba03e 100644--- a/src/Web/Grand.Web.Vendor/Components/VendorBestsellersBriefReportByAmount.cs+++ b/src/Web/Grand.Web.Vendor/Components/VendorBestsellersBriefReportByAmount.cs@@ -1,14 +1,12 @@using Grand.Web.Common.Components;using Microsoft.AspNetCore.Mvc;-namespace Grand.Web.Vendor.Components+namespace Grand.Web.Vendor.Components;++public class VendorBestsellersBriefReportByAmountViewComponent : BaseVendorViewComponent{- public class VendorBestsellersBriefReportByAmountViewComponent : BaseVendorViewComponent+ public IViewComponentResult Invoke(){-- public IViewComponentResult Invoke()- {- return View();- }+ return View();}}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Components/VendorBestsellersBriefReportByQuantity.cs b/src/Web/Grand.Web.Vendor/Components/VendorBestsellersBriefReportByQuantity.csindex d1fc9d528..e275665f2 100644--- a/src/Web/Grand.Web.Vendor/Components/VendorBestsellersBriefReportByQuantity.cs+++ b/src/Web/Grand.Web.Vendor/Components/VendorBestsellersBriefReportByQuantity.cs@@ -1,13 +1,12 @@using Grand.Web.Common.Components;using Microsoft.AspNetCore.Mvc;-namespace Grand.Web.Vendor.Components+namespace Grand.Web.Vendor.Components;++public class VendorBestsellersBriefReportByQuantityViewComponent : BaseVendorViewComponent{- public class VendorBestsellersBriefReportByQuantityViewComponent : BaseVendorViewComponent+ public IViewComponentResult Invoke(){- public IViewComponentResult Invoke()- {- return View();- }+ return View();}}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Components/VendorPage.cs b/src/Web/Grand.Web.Vendor/Components/VendorPage.csindex d33d1a7b1..22f3b41b2 100644--- a/src/Web/Grand.Web.Vendor/Components/VendorPage.cs+++ b/src/Web/Grand.Web.Vendor/Components/VendorPage.cs@@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Mvc;namespace Grand.Web.Vendor.Components;-public class VendorPageViewComponent: BaseVendorViewComponent+public class VendorPageViewComponent : BaseVendorViewComponent{#region Fields@@ -33,5 +33,4 @@ public class VendorPageViewComponent: BaseVendorViewComponent}#endregion-}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Components/VendorWidget.cs b/src/Web/Grand.Web.Vendor/Components/VendorWidget.csindex 82ed31ab6..3c183bc04 100644--- a/src/Web/Grand.Web.Vendor/Components/VendorWidget.cs+++ b/src/Web/Grand.Web.Vendor/Components/VendorWidget.cs@@ -1,61 +1,57 @@using Grand.Business.Core.Interfaces.Cms;using Grand.Infrastructure;-using Grand.Web.Vendor.Models.Cms;using Grand.Web.Common.Components;+using Grand.Web.Vendor.Models.Cms;using Microsoft.AspNetCore.Mvc;-namespace Grand.Web.Vendor.Components+namespace Grand.Web.Vendor.Components;++public class VendorWidgetViewComponent : BaseVendorViewComponent{- public class VendorWidgetViewComponent : BaseVendorViewComponent+ #region Constructors++ public VendorWidgetViewComponent(IWidgetService widgetService, IWorkContext workContext){- #region Fields+ _widgetService = widgetService;+ _workContext = workContext;+ }- private readonly IWidgetService _widgetService;- private readonly IWorkContext _workContext;+ #endregion- #endregion+ #region Invoker- #region Constructors+ public async Task<IViewComponentResult> InvokeAsync(string widgetZone, object additionalData = null)+ {+ var model = new List<VendorWidgetModel>();- public VendorWidgetViewComponent(IWidgetService widgetService, IWorkContext workContext)+ var widgets = await _widgetService.LoadActiveWidgetsByWidgetZone(widgetZone, _workContext.CurrentStore.Id,+ _workContext.CurrentCustomer);+ foreach (var item in widgets){- _widgetService = widgetService;- _workContext = workContext;+ var viewComponentName = await item.GetPublicViewComponentName(widgetZone);+ var widgetModel = new VendorWidgetModel {+ WidgetZone = widgetZone,+ ViewComponentName = viewComponentName+ };+ model.Add(widgetModel);}- #endregion+ if (!model.Any())+ return Content("");- #region Invoker+ if (additionalData == null) return View(model);- public async Task<IViewComponentResult> InvokeAsync(string widgetZone, object additionalData = null)- {- var model = new List<VendorWidgetModel>();-- var widgets = await _widgetService.LoadActiveWidgetsByWidgetZone(widgetZone, _workContext.CurrentStore.Id,- _workContext.CurrentCustomer);- foreach (var item in widgets)- {- var viewComponentName = await item.GetPublicViewComponentName(widgetZone);- var widgetModel = new VendorWidgetModel {- WidgetZone = widgetZone,- ViewComponentName = viewComponentName- };- model.Add(widgetModel);- }-- if (!model.Any())- return Content("");-- if (additionalData == null) return View(model);-- foreach (var item in model)- {- item.AdditionalData = additionalData;- }-- return View(model);- }+ foreach (var item in model) item.AdditionalData = additionalData;- #endregion+ return View(model);}++ #endregion++ #region Fields++ private readonly IWidgetService _widgetService;+ private readonly IWorkContext _workContext;++ #endregion}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Controllers/BaseVendorController.cs b/src/Web/Grand.Web.Vendor/Controllers/BaseVendorController.csindex 00b0c7340..090a55674 100644--- a/src/Web/Grand.Web.Vendor/Controllers/BaseVendorController.cs+++ b/src/Web/Grand.Web.Vendor/Controllers/BaseVendorController.cs@@ -1,50 +1,44 @@using Grand.Web.Common.Controllers;using Grand.Web.Common.Filters;-using Microsoft.AspNetCore.Mvc;using Grand.Web.Vendor.Extensions;+using Microsoft.AspNetCore.Mvc;-namespace Grand.Web.Vendor.Controllers+namespace Grand.Web.Vendor.Controllers;++[AutoValidateAntiforgeryToken]+[Area(Constants.AreaVendor)]+[AuthorizeVendor]+[AuthorizeMenu]+public abstract class BaseVendorController : BaseController{- [AutoValidateAntiforgeryToken]- [Area(Constants.AreaVendor)]- [AuthorizeVendor]- [AuthorizeMenu]- public abstract class BaseVendorController : BaseController+ /// <summary>+ /// Save selected TAB index+ /// </summary>+ /// <param name="index">Index to save; null to automatically detect it</param>+ /// <param name="persistForTheNextRequest">A value indicating whether a message should be persisted for the next request</param>+ protected async Task SaveSelectedTabIndex(int? index = null, bool persistForTheNextRequest = true){- /// <summary>- /// Save selected TAB index- /// </summary>- /// <param name="index">Index to save; null to automatically detect it</param>- /// <param name="persistForTheNextRequest">A value indicating whether a message should be persisted for the next request</param>- protected async Task SaveSelectedTabIndex(int? index = null, bool persistForTheNextRequest = true)+ if (!index.HasValue){- if (!index.HasValue)+ var form = await HttpContext.Request.ReadFormAsync();+ var tabindex = form["selected-tab-index"];+ if (tabindex.Count > 0){- var form = await HttpContext.Request.ReadFormAsync();- var tabindex = form["selected-tab-index"];- if (tabindex.Count > 0)- {- if (int.TryParse(tabindex[0], out var tmp))- {- index = tmp;- }- }- else- index = 1;+ if (int.TryParse(tabindex[0], out var tmp)) index = tmp;}-- if (index.HasValue)+ else{- var dataKey = "Grand.selected-tab-index";- if (persistForTheNextRequest)- {- TempData[dataKey] = index;- }- else- {- ViewData[dataKey] = index;- }+ index = 1;}}++ if (index.HasValue)+ {+ var dataKey = "Grand.selected-tab-index";+ if (persistForTheNextRequest)+ TempData[dataKey] = index;+ else+ ViewData[dataKey] = index;+ }}}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Controllers/HomeController.cs b/src/Web/Grand.Web.Vendor/Controllers/HomeController.csindex 47d4a74a5..290226409 100644--- a/src/Web/Grand.Web.Vendor/Controllers/HomeController.cs+++ b/src/Web/Grand.Web.Vendor/Controllers/HomeController.cs@@ -6,99 +6,99 @@ using Grand.Infrastructure;using Microsoft.AspNetCore.Mvc;using Microsoft.Extensions.Logging;-namespace Grand.Web.Vendor.Controllers+namespace Grand.Web.Vendor.Controllers;++public class HomeController : BaseVendorController{- public class HomeController : BaseVendorController+ #region Ctor++ public HomeController(+ IWorkContext workContext,+ ILogger<HomeController> logger,+ IGrandAuthenticationService authenticationService){- #region Fields+ _workContext = workContext;+ _logger = logger;+ _authenticationService = authenticationService;+ }- private readonly IWorkContext _workContext;- private readonly ILogger<HomeController> _logger;- private readonly IGrandAuthenticationService _authenticationService;+ #endregion- #endregion+ #region Fields- #region Ctor+ private readonly IWorkContext _workContext;+ private readonly ILogger<HomeController> _logger;+ private readonly IGrandAuthenticationService _authenticationService;- public HomeController(- IWorkContext workContext,- ILogger<HomeController> logger,- IGrandAuthenticationService authenticationService)- {- _workContext = workContext;- _logger = logger;- _authenticationService = authenticationService;- }+ #endregion- #endregion+ #region Methods- #region Methods+ public IActionResult Index()+ {+ return View();+ }- public IActionResult Index()- {- return View();- }-- public IActionResult Statistics()- {- return View();- }-- public IActionResult AccessDenied(string pageUrl)- {- _logger.LogInformation("Access denied to user #{CurrentCustomerEmail} on {PageUrl}", _workContext.CurrentCustomer.Email, pageUrl);- return View();- }+ public IActionResult Statistics()+ {+ return View();+ }++ public IActionResult AccessDenied(string pageUrl)+ {+ _logger.LogInformation("Access denied to user #{CurrentCustomerEmail} on {PageUrl}",+ _workContext.CurrentCustomer.Email, pageUrl);+ return View();+ }++ public async Task<IActionResult> Logout()+ {+ await _authenticationService.SignOut();+ return RedirectToRoute("VendorLogin");+ }++ [AcceptVerbs("Get")]+ public async Task<IActionResult> GetStatesByCountryId(+ [FromServices] ICountryService countryService,+ [FromServices] ITranslationService translationService,+ string countryId, bool? addSelectStateItem, bool? addAsterisk)+ {+ // This action method gets called via an ajax request+ if (string.IsNullOrEmpty(countryId))+ return Json(new List<dynamic>+ { new { id = "", name = translationService.GetResource("Address.SelectState") } });- public async Task<IActionResult> Logout()+ var country = await countryService.GetCountryById(countryId);+ var states = country != null ? country.StateProvinces.ToList() : new List<StateProvince>();+ var result = (from s in states+ select new { id = s.Id, name = s.Name }).ToList();+ if (addAsterisk.HasValue && addAsterisk.Value){- await _authenticationService.SignOut();- return RedirectToRoute("VendorLogin");+ //asterisk+ result.Insert(0, new { id = "", name = "*" });}- [AcceptVerbs("Get")]- public async Task<IActionResult> GetStatesByCountryId(- [FromServices] ICountryService countryService,- [FromServices] ITranslationService translationService,- string countryId, bool? addSelectStateItem, bool? addAsterisk)+ else{- // This action method gets called via an ajax request- if (string.IsNullOrEmpty(countryId))- return Json(new List<dynamic> { new { id = "", name = translationService.GetResource("Address.SelectState") } });-- var country = await countryService.GetCountryById(countryId);- var states = country != null ? country.StateProvinces.ToList() : new List<StateProvince>();- var result = (from s in states- select new { id = s.Id, name = s.Name }).ToList();- if (addAsterisk.HasValue && addAsterisk.Value)+ if (country == null){- //asterisk- result.Insert(0, new { id = "", name = "*" });+ //country is not selected ("choose country" item)+ if (addSelectStateItem.HasValue && addSelectStateItem.Value)+ result.Insert(0,+ new { id = "", name = translationService.GetResource("Vendor.Address.SelectState") });}else{- if (country == null)- {- //country is not selected ("choose country" item)+ //some country is selected+ if (result.Any())+ //country has some statesif (addSelectStateItem.HasValue && addSelectStateItem.Value)- {- result.Insert(0, new { id = "", name = translationService.GetResource("Vendor.Address.SelectState") });- }- }- else- {- //some country is selected- if (result.Any())- {- //country has some states- if (addSelectStateItem.HasValue && addSelectStateItem.Value)- {- result.Insert(0, new { id = "", name = translationService.GetResource("Vendor.Address.SelectState") });- }- }- }+ result.Insert(0,+ new { id = "", name = translationService.GetResource("Vendor.Address.SelectState") });}- return Json(result);}- #endregion++ return Json(result);}-}++ #endregion+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Controllers/LoginController.cs b/src/Web/Grand.Web.Vendor/Controllers/LoginController.csindex bb479a8f4..7a27ad27c 100644--- a/src/Web/Grand.Web.Vendor/Controllers/LoginController.cs+++ b/src/Web/Grand.Web.Vendor/Controllers/LoginController.cs@@ -1,13 +1,13 @@-using Grand.Business.Core.Interfaces.Authentication;+using Grand.Business.Core.Events.Customers;+using Grand.Business.Core.Interfaces.Authentication;using Grand.Business.Core.Interfaces.Common.Localization;-using Grand.Business.Core.Events.Customers;using Grand.Business.Core.Interfaces.Customers;using Grand.Business.Core.Interfaces.Messages;-using Grand.Web.Common.Controllers;-using Grand.Web.Common.Security.Captcha;using Grand.Domain.Common;using Grand.Domain.Customers;using Grand.Infrastructure;+using Grand.Web.Common.Controllers;+using Grand.Web.Common.Security.Captcha;using Grand.Web.Vendor.Extensions;using Grand.Web.Vendor.Models.Common;using MediatR;@@ -15,158 +15,168 @@ using Microsoft.AspNetCore.Http;using Microsoft.AspNetCore.Mvc;using Microsoft.AspNetCore.Routing;-namespace Grand.Web.Vendor.Controllers+namespace Grand.Web.Vendor.Controllers;++[Area(Constants.AreaVendor)]+public class LoginController : BaseController{- [Area(Constants.AreaVendor)]- public class LoginController : BaseController+ private readonly IGrandAuthenticationService _authenticationService;+ private readonly CaptchaSettings _captchaSettings;+ private readonly ICustomerManagerService _customerManagerService;+ private readonly ICustomerService _customerService;+ private readonly CustomerSettings _customerSettings;+ private readonly IMediator _mediator;+ private readonly IMessageProviderService _messageProviderService;+ private readonly ITranslationService _translationService;+ private readonly IWorkContext _workContext;++ public LoginController(+ CustomerSettings customerSettings,+ CaptchaSettings captchaSettings,+ ITranslationService translationService,+ ICustomerManagerService customerManagerService,+ ICustomerService customerService,+ IGrandAuthenticationService authenticationService,+ IMessageProviderService messageProviderService,+ IWorkContext workContext,+ IMediator mediator){- private readonly CustomerSettings _customerSettings;- private readonly CaptchaSettings _captchaSettings;- private readonly ITranslationService _translationService;- private readonly ICustomerManagerService _customerManagerService;- private readonly ICustomerService _customerService;- private readonly IGrandAuthenticationService _authenticationService;- private readonly IMessageProviderService _messageProviderService;- private readonly IWorkContext _workContext;- private readonly IMediator _mediator;-- public LoginController(- CustomerSettings customerSettings,- CaptchaSettings captchaSettings,- ITranslationService translationService,- ICustomerManagerService customerManagerService,- ICustomerService customerService,- IGrandAuthenticationService authenticationService,- IMessageProviderService messageProviderService,- IWorkContext workContext,- IMediator mediator)- {- _customerSettings = customerSettings;- _captchaSettings = captchaSettings;- _translationService = translationService;- _customerManagerService = customerManagerService;- _customerService = customerService;- _authenticationService = authenticationService;- _messageProviderService = messageProviderService;- _workContext = workContext;- _mediator = mediator;- }+ _customerSettings = customerSettings;+ _captchaSettings = captchaSettings;+ _translationService = translationService;+ _customerManagerService = customerManagerService;+ _customerService = customerService;+ _authenticationService = authenticationService;+ _messageProviderService = messageProviderService;+ _workContext = workContext;+ _mediator = mediator;+ }- public IActionResult Index()- {- var model = new LoginModel {- UsernamesEnabled = _customerSettings.UsernamesEnabled,- DisplayCaptcha = _captchaSettings.Enabled && _captchaSettings.ShowOnLoginPage- };- return View(model);- }+ public IActionResult Index()+ {+ var model = new LoginModel {+ UsernamesEnabled = _customerSettings.UsernamesEnabled,+ DisplayCaptcha = _captchaSettings.Enabled && _captchaSettings.ShowOnLoginPage+ };+ return View(model);+ }- [HttpPost]- [AutoValidateAntiforgeryToken]- public virtual async Task<IActionResult> Index(LoginModel model)+ [HttpPost]+ [AutoValidateAntiforgeryToken]+ public virtual async Task<IActionResult> Index(LoginModel model)+ {+ if (ModelState.IsValid){- if (ModelState.IsValid)+ var loginResult =+ await _customerManagerService.LoginCustomer(+ _customerSettings.UsernamesEnabled ? model.Username : model.Email, model.Password);+ switch (loginResult){- var loginResult =- await _customerManagerService.LoginCustomer(- _customerSettings.UsernamesEnabled ? model.Username : model.Email, model.Password);- switch (loginResult)+ case CustomerLoginResults.Successful:+ {+ var customer = _customerSettings.UsernamesEnabled+ ? await _customerService.GetCustomerByUsername(model.Username)+ : await _customerService.GetCustomerByEmail(model.Email);+ //sign in+ return await SignInAction(customer, model.RememberMe);+ }+ case CustomerLoginResults.RequiresTwoFactor:{- case CustomerLoginResults.Successful:- {- var customer = _customerSettings.UsernamesEnabled- ? await _customerService.GetCustomerByUsername(model.Username)- : await _customerService.GetCustomerByEmail(model.Email);- //sign in- return await SignInAction(customer, model.RememberMe);- }- case CustomerLoginResults.RequiresTwoFactor:- {- var userName = _customerSettings.UsernamesEnabled ? model.Username : model.Email;- HttpContext.Session.SetString("VendorRequiresTwoFactor", userName);- return RedirectToRoute("TwoFactorAuthorization");- }+ var userName = _customerSettings.UsernamesEnabled ? model.Username : model.Email;+ HttpContext.Session.SetString("VendorRequiresTwoFactor", userName);+ return RedirectToRoute("TwoFactorAuthorization");}}-- //If we got this far, something failed, redisplay form- model.UsernamesEnabled = _customerSettings.UsernamesEnabled;- model.DisplayCaptcha = _captchaSettings.Enabled && _captchaSettings.ShowOnLoginPage;-- return View(model);}- protected async Task<IActionResult> SignInAction(Customer customer, bool createPersistent)- {- //sign in new customer- await _authenticationService.SignIn(customer, createPersistent);- //raise event- await _mediator.Publish(new CustomerLoggedInEvent(customer));+ //If we got this far, something failed, redisplay form+ model.UsernamesEnabled = _customerSettings.UsernamesEnabled;+ model.DisplayCaptcha = _captchaSettings.Enabled && _captchaSettings.ShowOnLoginPage;- return RedirectToRoute("VendorIndex", new RouteValueDictionary());- }+ return View(model);+ }- public async Task<IActionResult> TwoFactorAuthorization([FromServices] ITwoFactorAuthenticationService twoFactorAuthenticationService)- {- if (!_customerSettings.TwoFactorAuthenticationEnabled)- return RedirectToRoute("VendorLogin");+ protected async Task<IActionResult> SignInAction(Customer customer, bool createPersistent)+ {+ //sign in new customer+ await _authenticationService.SignIn(customer, createPersistent);- var username = HttpContext.Session.GetString("VendorRequiresTwoFactor");- if (string.IsNullOrEmpty(username))- return RedirectToRoute("VendorLogin");+ //raise event+ await _mediator.Publish(new CustomerLoggedInEvent(customer));- var customer = _customerSettings.UsernamesEnabled ? await _customerService.GetCustomerByUsername(username) : await _customerService.GetCustomerByEmail(username);- if (customer == null)- return RedirectToRoute("VendorLogin");+ return RedirectToRoute("VendorIndex", new RouteValueDictionary());+ }- if (!customer.GetUserFieldFromEntity<bool>(SystemCustomerFieldNames.TwoFactorEnabled))- return RedirectToRoute("VendorLogin");+ public async Task<IActionResult> TwoFactorAuthorization(+ [FromServices] ITwoFactorAuthenticationService twoFactorAuthenticationService)+ {+ if (!_customerSettings.TwoFactorAuthenticationEnabled)+ return RedirectToRoute("VendorLogin");- if (_customerSettings.TwoFactorAuthenticationType != TwoFactorAuthenticationType.AppVerification)- {- await twoFactorAuthenticationService.GenerateCodeSetup("", customer, _workContext.WorkingLanguage, _customerSettings.TwoFactorAuthenticationType);- if (_customerSettings.TwoFactorAuthenticationType == TwoFactorAuthenticationType.EmailVerification)- await _messageProviderService.SendCustomerEmailTokenValidationMessage(customer, _workContext.CurrentStore, _workContext.WorkingLanguage.Id);+ var username = HttpContext.Session.GetString("VendorRequiresTwoFactor");+ if (string.IsNullOrEmpty(username))+ return RedirectToRoute("VendorLogin");- }+ var customer = _customerSettings.UsernamesEnabled+ ? await _customerService.GetCustomerByUsername(username)+ : await _customerService.GetCustomerByEmail(username);+ if (customer == null)+ return RedirectToRoute("VendorLogin");- return View();- }+ if (!customer.GetUserFieldFromEntity<bool>(SystemCustomerFieldNames.TwoFactorEnabled))+ return RedirectToRoute("VendorLogin");- [HttpPost]- public async Task<IActionResult> TwoFactorAuthorization(string token,- [FromServices] ITwoFactorAuthenticationService twoFactorAuthenticationService)+ if (_customerSettings.TwoFactorAuthenticationType != TwoFactorAuthenticationType.AppVerification){- if (!_customerSettings.TwoFactorAuthenticationEnabled)- return RedirectToRoute("VendorLogin");+ await twoFactorAuthenticationService.GenerateCodeSetup("", customer, _workContext.WorkingLanguage,+ _customerSettings.TwoFactorAuthenticationType);+ if (_customerSettings.TwoFactorAuthenticationType == TwoFactorAuthenticationType.EmailVerification)+ await _messageProviderService.SendCustomerEmailTokenValidationMessage(customer,+ _workContext.CurrentStore, _workContext.WorkingLanguage.Id);+ }- var username = HttpContext.Session.GetString("VendorRequiresTwoFactor");- if (string.IsNullOrEmpty(username))- return RedirectToRoute("HomePage");+ return View();+ }- var customer = _customerSettings.UsernamesEnabled ? await _customerService.GetCustomerByUsername(username) : await _customerService.GetCustomerByEmail(username);- if (customer == null)- return RedirectToRoute("VendorLogin");+ [HttpPost]+ public async Task<IActionResult> TwoFactorAuthorization(string token,+ [FromServices] ITwoFactorAuthenticationService twoFactorAuthenticationService)+ {+ if (!_customerSettings.TwoFactorAuthenticationEnabled)+ return RedirectToRoute("VendorLogin");- if (string.IsNullOrEmpty(token))- {- ModelState.AddModelError("", _translationService.GetResource("Account.TwoFactorAuth.SecurityCodeIsRequired"));- }- else+ var username = HttpContext.Session.GetString("VendorRequiresTwoFactor");+ if (string.IsNullOrEmpty(username))+ return RedirectToRoute("HomePage");++ var customer = _customerSettings.UsernamesEnabled+ ? await _customerService.GetCustomerByUsername(username)+ : await _customerService.GetCustomerByEmail(username);+ if (customer == null)+ return RedirectToRoute("VendorLogin");++ if (string.IsNullOrEmpty(token))+ {+ ModelState.AddModelError("",+ _translationService.GetResource("Account.TwoFactorAuth.SecurityCodeIsRequired"));+ }+ else+ {+ var secretKey = customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.TwoFactorSecretKey);+ if (await twoFactorAuthenticationService.AuthenticateTwoFactor(secretKey, token, customer,+ _customerSettings.TwoFactorAuthenticationType)){- var secretKey = customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.TwoFactorSecretKey);- if (await twoFactorAuthenticationService.AuthenticateTwoFactor(secretKey, token, customer, _customerSettings.TwoFactorAuthenticationType))- {- //remove session- HttpContext.Session.Remove("VendorRequiresTwoFactor");+ //remove session+ HttpContext.Session.Remove("VendorRequiresTwoFactor");- //sign in- return await SignInAction(customer, false);- }- ModelState.AddModelError("", _translationService.GetResource("Account.TwoFactorAuth.WrongSecurityCode"));+ //sign in+ return await SignInAction(customer, false);}- await _mediator.Publish(new CustomerLoginFailedEvent(customer));- return View();++ ModelState.AddModelError("", _translationService.GetResource("Account.TwoFactorAuth.WrongSecurityCode"));}++ await _mediator.Publish(new CustomerLoginFailedEvent(customer));+ return View();}-}+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Controllers/MerchandiseReturnController.cs b/src/Web/Grand.Web.Vendor/Controllers/MerchandiseReturnController.csindex ab692fcf7..aa2bb039a 100644--- a/src/Web/Grand.Web.Vendor/Controllers/MerchandiseReturnController.cs+++ b/src/Web/Grand.Web.Vendor/Controllers/MerchandiseReturnController.cs@@ -5,213 +5,221 @@ using Grand.Business.Core.Utilities.Common.Security;using Grand.Domain.Common;using Grand.Domain.Orders;using Grand.Infrastructure;-using Grand.Web.Vendor.Extensions;-using Grand.Web.Vendor.Interfaces;using Grand.Web.Common.DataSource;using Grand.Web.Common.Filters;using Grand.Web.Common.Security.Authorization;+using Grand.Web.Vendor.Extensions;+using Grand.Web.Vendor.Interfaces;using Grand.Web.Vendor.Models.MerchandiseReturn;using Microsoft.AspNetCore.Mvc;-namespace Grand.Web.Vendor.Controllers+namespace Grand.Web.Vendor.Controllers;++[PermissionAuthorize(PermissionSystemName.MerchandiseReturns)]+public class MerchandiseReturnController : BaseVendorController{- [PermissionAuthorize(PermissionSystemName.MerchandiseReturns)]- public class MerchandiseReturnController : BaseVendorController+ #region Constructors++ public MerchandiseReturnController(+ IMerchandiseReturnViewModelService merchandiseReturnViewModelService,+ ITranslationService translationService,+ IMerchandiseReturnService merchandiseReturnService,+ IWorkContext workContext){- #region Fields+ _merchandiseReturnViewModelService = merchandiseReturnViewModelService;+ _translationService = translationService;+ _merchandiseReturnService = merchandiseReturnService;+ _workContext = workContext;+ }- private readonly IMerchandiseReturnViewModelService _merchandiseReturnViewModelService;- private readonly ITranslationService _translationService;- private readonly IMerchandiseReturnService _merchandiseReturnService;- private readonly IWorkContext _workContext;+ #endregion- #endregion Fields+ #region Fields- #region Constructors+ private readonly IMerchandiseReturnViewModelService _merchandiseReturnViewModelService;+ private readonly ITranslationService _translationService;+ private readonly IMerchandiseReturnService _merchandiseReturnService;+ private readonly IWorkContext _workContext;- public MerchandiseReturnController(- IMerchandiseReturnViewModelService merchandiseReturnViewModelService,- ITranslationService translationService,- IMerchandiseReturnService merchandiseReturnService,- IWorkContext workContext)- {- _merchandiseReturnViewModelService = merchandiseReturnViewModelService;- _translationService = translationService;- _merchandiseReturnService = merchandiseReturnService;- _workContext = workContext;- }+ #endregion Fields- #endregion+ #region Methods- #region Methods+ //list+ public IActionResult Index()+ {+ return RedirectToAction("List");+ }- //list- public IActionResult Index()- {+ public IActionResult List()+ {+ var model = _merchandiseReturnViewModelService.PrepareReturnRequestListModel();+ return View(model);+ }++ [PermissionAuthorizeAction(PermissionActionName.List)]+ [HttpPost]+ public async Task<IActionResult> List(DataSourceRequest command, MerchandiseReturnListModel model)+ {+ var merchandiseReturnModels =+ await _merchandiseReturnViewModelService.PrepareMerchandiseReturnModel(model, command.Page,+ command.PageSize);+ var gridModel = new DataSourceResult {+ Data = merchandiseReturnModels.merchandiseReturnModels,+ Total = merchandiseReturnModels.totalCount+ };++ return Json(gridModel);+ }++ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> GoToId(MerchandiseReturnListModel model)+ {+ var merchandiseReturn = await _merchandiseReturnService.GetMerchandiseReturnById(model.GoDirectlyToId);+ if (merchandiseReturn == null || merchandiseReturn.VendorId != _workContext.CurrentVendor.Id)+ //not found+ return RedirectToAction("List", "MerchandiseReturn");++ return RedirectToAction("Edit", "MerchandiseReturn", new { id = merchandiseReturn.Id });+ }++ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> ProductsForMerchandiseReturn(string merchandiseReturnId)+ {+ var merchandiseReturn = await _merchandiseReturnService.GetMerchandiseReturnById(merchandiseReturnId);+ if (merchandiseReturn == null || merchandiseReturn.VendorId != _workContext.CurrentVendor.Id)+ return ErrorForKendoGridJson("Merchandise return not found");++ var items = await _merchandiseReturnViewModelService.PrepareMerchandiseReturnItemModel(merchandiseReturnId);+ var gridModel = new DataSourceResult {+ Data = items,+ Total = items.Count+ };++ return Json(gridModel);+ }++ //edit+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ public async Task<IActionResult> Edit(string id)+ {+ var merchandiseReturn = await _merchandiseReturnService.GetMerchandiseReturnById(id);+ if (merchandiseReturn == null || merchandiseReturn.VendorId != _workContext.CurrentVendor.Id)+ //No merchandise return found with the specified idreturn RedirectToAction("List");- }- public IActionResult List()- {- var model = _merchandiseReturnViewModelService.PrepareReturnRequestListModel();- return View(model);- }+ var model = new MerchandiseReturnModel();+ await _merchandiseReturnViewModelService.PrepareMerchandiseReturnModel(model, merchandiseReturn, false);+ return View(model);+ }- [PermissionAuthorizeAction(PermissionActionName.List)]- [HttpPost]- public async Task<IActionResult> List(DataSourceRequest command, MerchandiseReturnListModel model)- {- var merchandiseReturnModels = await _merchandiseReturnViewModelService.PrepareMerchandiseReturnModel(model, command.Page, command.PageSize);- var gridModel = new DataSourceResult- {- Data = merchandiseReturnModels.merchandiseReturnModels,- Total = merchandiseReturnModels.totalCount- };-- return Json(gridModel);- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ [ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]+ public async Task<IActionResult> Edit(MerchandiseReturnModel model, bool continueEditing,+ [FromServices] IAddressAttributeService addressAttributeService,+ [FromServices] IAddressAttributeParser addressAttributeParser,+ [FromServices] OrderSettings orderSettings+ )+ {+ var merchandiseReturn = await _merchandiseReturnService.GetMerchandiseReturnById(model.Id);+ if (merchandiseReturn == null || merchandiseReturn.VendorId != _workContext.CurrentVendor.Id)+ //No merchandise return found with the specified id+ return RedirectToAction("List");- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> GoToId(MerchandiseReturnListModel model)+ if (ModelState.IsValid){- var merchandiseReturn = await _merchandiseReturnService.GetMerchandiseReturnById(model.GoDirectlyToId);- if (merchandiseReturn == null || merchandiseReturn.VendorId != _workContext.CurrentVendor.Id)- //not found- return RedirectToAction("List", "MerchandiseReturn");-- return RedirectToAction("Edit", "MerchandiseReturn", new { id = merchandiseReturn.Id });+ var customAddressAttributes = new List<CustomAttribute>();+ if (orderSettings.MerchandiseReturns_AllowToSpecifyPickupAddress)+ customAddressAttributes =+ await model.PickupAddress.ParseCustomAddressAttributes(addressAttributeParser,+ addressAttributeService);+ merchandiseReturn =+ await _merchandiseReturnViewModelService.UpdateMerchandiseReturnModel(merchandiseReturn, model,+ customAddressAttributes);++ Success(_translationService.GetResource("Vendor.Orders.MerchandiseReturns.Updated"));+ return continueEditing+ ? RedirectToAction("Edit", new { id = merchandiseReturn.Id })+ : RedirectToAction("List");}- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> ProductsForMerchandiseReturn(string merchandiseReturnId)- {- var merchandiseReturn = await _merchandiseReturnService.GetMerchandiseReturnById(merchandiseReturnId);- if (merchandiseReturn == null || merchandiseReturn.VendorId != _workContext.CurrentVendor.Id)- return ErrorForKendoGridJson("Merchandise return not found");-- var items = await _merchandiseReturnViewModelService.PrepareMerchandiseReturnItemModel(merchandiseReturnId);- var gridModel = new DataSourceResult- {- Data = items,- Total = items.Count- };-- return Json(gridModel);- }+ //If we got this far, something failed, redisplay form+ await _merchandiseReturnViewModelService.PrepareMerchandiseReturnModel(model, merchandiseReturn, false);+ return View(model);+ }- //edit- [PermissionAuthorizeAction(PermissionActionName.Preview)]- public async Task<IActionResult> Edit(string id)- {- var merchandiseReturn = await _merchandiseReturnService.GetMerchandiseReturnById(id);- if (merchandiseReturn == null || merchandiseReturn.VendorId != _workContext.CurrentVendor.Id)- //No merchandise return found with the specified id- return RedirectToAction("List");-- var model = new MerchandiseReturnModel();- await _merchandiseReturnViewModelService.PrepareMerchandiseReturnModel(model, merchandiseReturn, false);- return View(model);- }+ //delete+ [PermissionAuthorizeAction(PermissionActionName.Delete)]+ [HttpPost]+ public async Task<IActionResult> Delete(string id)+ {+ var merchandiseReturn = await _merchandiseReturnService.GetMerchandiseReturnById(id);+ if (merchandiseReturn == null || merchandiseReturn.VendorId != _workContext.CurrentVendor.Id)+ //No merchandise return found with the specified id+ return RedirectToAction("List");- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost, ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]- public async Task<IActionResult> Edit(MerchandiseReturnModel model, bool continueEditing,- [FromServices] IAddressAttributeService addressAttributeService,- [FromServices] IAddressAttributeParser addressAttributeParser,- [FromServices] OrderSettings orderSettings- )+ if (ModelState.IsValid){- var merchandiseReturn = await _merchandiseReturnService.GetMerchandiseReturnById(model.Id);- if (merchandiseReturn == null || merchandiseReturn.VendorId != _workContext.CurrentVendor.Id)- //No merchandise return found with the specified id- return RedirectToAction("List");-- if (ModelState.IsValid)- {- var customAddressAttributes = new List<CustomAttribute>();- if (orderSettings.MerchandiseReturns_AllowToSpecifyPickupAddress)- {- customAddressAttributes = await model.PickupAddress.ParseCustomAddressAttributes(addressAttributeParser, addressAttributeService);- }- merchandiseReturn = await _merchandiseReturnViewModelService.UpdateMerchandiseReturnModel(merchandiseReturn, model, customAddressAttributes);-- Success(_translationService.GetResource("Vendor.Orders.MerchandiseReturns.Updated"));- return continueEditing ? RedirectToAction("Edit", new { id = merchandiseReturn.Id }) : RedirectToAction("List");- }-- //If we got this far, something failed, redisplay form- await _merchandiseReturnViewModelService.PrepareMerchandiseReturnModel(model, merchandiseReturn, false);- return View(model);+ await _merchandiseReturnViewModelService.DeleteMerchandiseReturn(merchandiseReturn);+ Success(_translationService.GetResource("Vendor.Orders.MerchandiseReturns.Deleted"));+ return RedirectToAction("List");}- //delete- [PermissionAuthorizeAction(PermissionActionName.Delete)]- [HttpPost]- public async Task<IActionResult> Delete(string id)- {- var merchandiseReturn = await _merchandiseReturnService.GetMerchandiseReturnById(id);- if (merchandiseReturn == null || merchandiseReturn.VendorId != _workContext.CurrentVendor.Id)- //No merchandise return found with the specified id- return RedirectToAction("List");-- if (ModelState.IsValid)- {- await _merchandiseReturnViewModelService.DeleteMerchandiseReturn(merchandiseReturn);- Success(_translationService.GetResource("Vendor.Orders.MerchandiseReturns.Deleted"));- return RedirectToAction("List");- }- Error(ModelState);- return RedirectToAction("Edit", new { id = merchandiseReturn.Id });- }+ Error(ModelState);+ return RedirectToAction("Edit", new { id = merchandiseReturn.Id });+ }- #endregion+ #endregion- #region Merchandise return notes+ #region Merchandise return notes- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> MerchandiseReturnNotesSelect(string merchandiseReturnId)- {- var merchandiseReturn = await _merchandiseReturnService.GetMerchandiseReturnById(merchandiseReturnId);- if (merchandiseReturn == null || merchandiseReturn.VendorId != _workContext.CurrentVendor.Id)- throw new ArgumentException("No merchandise return found with the specified id");-- //merchandise return notes- var merchandiseReturnNoteModels = await _merchandiseReturnViewModelService.PrepareMerchandiseReturnNotes(merchandiseReturn);- var gridModel = new DataSourceResult- {- Data = merchandiseReturnNoteModels,- Total = merchandiseReturnNoteModels.Count- };- return Json(gridModel);- }+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> MerchandiseReturnNotesSelect(string merchandiseReturnId)+ {+ var merchandiseReturn = await _merchandiseReturnService.GetMerchandiseReturnById(merchandiseReturnId);+ if (merchandiseReturn == null || merchandiseReturn.VendorId != _workContext.CurrentVendor.Id)+ throw new ArgumentException("No merchandise return found with the specified id");++ //merchandise return notes+ var merchandiseReturnNoteModels =+ await _merchandiseReturnViewModelService.PrepareMerchandiseReturnNotes(merchandiseReturn);+ var gridModel = new DataSourceResult {+ Data = merchandiseReturnNoteModels,+ Total = merchandiseReturnNoteModels.Count+ };+ return Json(gridModel);+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> MerchandiseReturnNoteAdd(string merchandiseReturnId, bool displayToCustomer, string message)- {- var merchandiseReturn = await _merchandiseReturnService.GetMerchandiseReturnById(merchandiseReturnId);- if (merchandiseReturn == null || merchandiseReturn.VendorId != _workContext.CurrentVendor.Id)- return Json(new { Result = false });-- await _merchandiseReturnViewModelService.InsertMerchandiseReturnNote(merchandiseReturn, displayToCustomer, message);+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> MerchandiseReturnNoteAdd(string merchandiseReturnId, bool displayToCustomer,+ string message)+ {+ var merchandiseReturn = await _merchandiseReturnService.GetMerchandiseReturnById(merchandiseReturnId);+ if (merchandiseReturn == null || merchandiseReturn.VendorId != _workContext.CurrentVendor.Id)+ return Json(new { Result = false });- return Json(new { Result = true });- }+ await _merchandiseReturnViewModelService.InsertMerchandiseReturnNote(merchandiseReturn, displayToCustomer,+ message);- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> MerchandiseReturnNoteDelete(string id, string merchandiseReturnId)- {- var merchandiseReturn = await _merchandiseReturnService.GetMerchandiseReturnById(merchandiseReturnId);- if (merchandiseReturn == null || merchandiseReturn.VendorId != _workContext.CurrentVendor.Id)- throw new ArgumentException("No merchandise return found with the specified id");+ return Json(new { Result = true });+ }- await _merchandiseReturnViewModelService.DeleteMerchandiseReturnNote(merchandiseReturn, id);+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> MerchandiseReturnNoteDelete(string id, string merchandiseReturnId)+ {+ var merchandiseReturn = await _merchandiseReturnService.GetMerchandiseReturnById(merchandiseReturnId);+ if (merchandiseReturn == null || merchandiseReturn.VendorId != _workContext.CurrentVendor.Id)+ throw new ArgumentException("No merchandise return found with the specified id");- return new JsonResult("");- }- #endregion+ await _merchandiseReturnViewModelService.DeleteMerchandiseReturnNote(merchandiseReturn, id);++ return new JsonResult("");}-}++ #endregion+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Controllers/OrderController.cs b/src/Web/Grand.Web.Vendor/Controllers/OrderController.csindex a7b92b607..ee322f727 100644--- a/src/Web/Grand.Web.Vendor/Controllers/OrderController.cs+++ b/src/Web/Grand.Web.Vendor/Controllers/OrderController.cs@@ -5,215 +5,217 @@ using Grand.Business.Core.Interfaces.Common.Pdf;using Grand.Business.Core.Utilities.Common.Security;using Grand.Domain.Orders;using Grand.Infrastructure;-using Grand.Web.Vendor.Interfaces;-using Grand.Web.Vendor.Models.Orders;using Grand.Web.Common.DataSource;using Grand.Web.Common.Security.Authorization;-using Microsoft.AspNetCore.Mvc;using Grand.Web.Vendor.Extensions;+using Grand.Web.Vendor.Interfaces;+using Grand.Web.Vendor.Models.Orders;+using Microsoft.AspNetCore.Mvc;++namespace Grand.Web.Vendor.Controllers;-namespace Grand.Web.Vendor.Controllers+[PermissionAuthorize(PermissionSystemName.Orders)]+public class OrderController : BaseVendorController{- [PermissionAuthorize(PermissionSystemName.Orders)]- public class OrderController : BaseVendorController+ #region Ctor++ public OrderController(+ IOrderViewModelService orderViewModelService,+ IOrderService orderService,+ ITranslationService translationService,+ IWorkContext workContext,+ IPdfService pdfService){- #region Fields+ _orderViewModelService = orderViewModelService;+ _orderService = orderService;+ _translationService = translationService;+ _workContext = workContext;+ _pdfService = pdfService;+ }- private readonly IOrderViewModelService _orderViewModelService;- private readonly IOrderService _orderService;- private readonly ITranslationService _translationService;- private readonly IWorkContext _workContext;- private readonly IPdfService _pdfService;+ #endregion- #endregion+ #region Fields- #region Ctor+ private readonly IOrderViewModelService _orderViewModelService;+ private readonly IOrderService _orderService;+ private readonly ITranslationService _translationService;+ private readonly IWorkContext _workContext;+ private readonly IPdfService _pdfService;- public OrderController(- IOrderViewModelService orderViewModelService,- IOrderService orderService,- ITranslationService translationService,- IWorkContext workContext,- IPdfService pdfService)- {- _orderViewModelService = orderViewModelService;- _orderService = orderService;- _translationService = translationService;- _workContext = workContext;- _pdfService = pdfService;- }+ #endregion- #endregion+ #region Order list- #region Order list+ public IActionResult Index()+ {+ return RedirectToAction("List");+ }- public IActionResult Index()- {- return RedirectToAction("List");- }+ public async Task<IActionResult> List(int? orderStatusId = null,+ int? paymentStatusId = null, int? shippingStatusId = null,+ DateTime? startDate = null, string code = null)+ {+ var model = await _orderViewModelService.PrepareOrderListModel(orderStatusId, paymentStatusId, shippingStatusId,+ startDate, code);+ return View(model);+ }- public async Task<IActionResult> List(int? orderStatusId = null,- int? paymentStatusId = null, int? shippingStatusId = null,- DateTime? startDate = null, string code = null)- {- var model = await _orderViewModelService.PrepareOrderListModel(orderStatusId, paymentStatusId, shippingStatusId, startDate, code);- return View(model);- }+ public async Task<IActionResult> ProductSearchAutoComplete(string term,+ [FromServices] IProductService productService)+ {+ const int searchTermMinimumLength = 3;+ if (string.IsNullOrWhiteSpace(term) || term.Length < searchTermMinimumLength)+ return Content("");++ //products+ const int productNumber = 15;+ var products = (await productService.SearchProducts(+ vendorId: _workContext.CurrentVendor.Id,+ keywords: term,+ pageSize: productNumber,+ showHidden: true)).products;++ var result = (from p in products+ select new {+ label = p.Name,+ productid = p.Id+ })+ .ToList();+ return Json(result);+ }- public async Task<IActionResult> ProductSearchAutoComplete(string term, [FromServices] IProductService productService)- {- const int searchTermMinimumLength = 3;- if (string.IsNullOrWhiteSpace(term) || term.Length < searchTermMinimumLength)- return Content("");-- //products- const int productNumber = 15;- var products = (await productService.SearchProducts(- vendorId: _workContext.CurrentVendor.Id,- keywords: term,- pageSize: productNumber,- showHidden: true)).products;-- var result = (from p in products- select new- {- label = p.Name,- productid = p.Id- })- .ToList();- return Json(result);- }+ [PermissionAuthorizeAction(PermissionActionName.List)]+ [HttpPost]+ public async Task<IActionResult> OrderList(DataSourceRequest command, OrderListModel model)+ {+ var (orderModels, totalCount) =+ await _orderViewModelService.PrepareOrderModel(model, command.Page, command.PageSize);+ var gridModel = new DataSourceResult {+ Data = orderModels.ToList(),+ Total = totalCount+ };+ return Json(gridModel);+ }- [PermissionAuthorizeAction(PermissionActionName.List)]- [HttpPost]- public async Task<IActionResult> OrderList(DataSourceRequest command, OrderListModel model)+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> GoToOrderId(OrderListModel model)+ {+ Order order = null;+ if (int.TryParse(model.GoDirectlyToNumber, out var orderNumber)){- var (orderModels, totalCount) = await _orderViewModelService.PrepareOrderModel(model, command.Page, command.PageSize);- var gridModel = new DataSourceResult- {- Data = orderModels.ToList(),- Total = totalCount- };- return Json(gridModel);+ order = await _orderService.GetOrderByNumber(orderNumber);}-- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> GoToOrderId(OrderListModel model)+ else{- Order order = null;- if(int.TryParse(model.GoDirectlyToNumber, out var orderNumber))- {- order = await _orderService.GetOrderByNumber(orderNumber);- }- else+ var orders = await _orderService.GetOrdersByCode(model.GoDirectlyToNumber);+ switch (orders.Count){- var orders = await _orderService.GetOrdersByCode(model.GoDirectlyToNumber);- switch (orders.Count)- {- case > 1:- return RedirectToAction("List", new { Code = model.GoDirectlyToNumber });- case 1:- order = orders.FirstOrDefault();- break;- }+ case > 1:+ return RedirectToAction("List", new { Code = model.GoDirectlyToNumber });+ case 1:+ order = orders.FirstOrDefault();+ break;}- return RedirectToAction("Edit", "Order", new { id = order?.Id });}- #endregion-- #region Order details-- #region Edit, delete+ return RedirectToAction("Edit", "Order", new { id = order?.Id });+ }- [PermissionAuthorizeAction(PermissionActionName.Preview)]- public async Task<IActionResult> Edit(string id)- {- var order = await _orderService.GetOrderById(id);- if (order == null || order.Deleted || !_workContext.HasAccessToOrder(order))- //No order found with the specified id- return RedirectToAction("List");+ #endregion- var model = new OrderModel();- await _orderViewModelService.PrepareOrderDetailsModel(model, order);+ #region Order details- return View(model);- }+ #region Edit, delete- public async Task<IActionResult> PdfInvoice(string orderId)- {- var order = await _orderService.GetOrderById(orderId);+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ public async Task<IActionResult> Edit(string id)+ {+ var order = await _orderService.GetOrderById(id);+ if (order == null || order.Deleted || !_workContext.HasAccessToOrder(order))//No order found with the specified id- if (order == null || order.Deleted || !_workContext.HasAccessToOrder(order))- {- return RedirectToAction("List");- }+ return RedirectToAction("List");- var orders = new List<Order>- {- order- };- byte[] bytes;- using (var stream = new MemoryStream())- {- await _pdfService.PrintOrdersToPdf(stream, orders, _workContext.WorkingLanguage.Id, _workContext.CurrentVendor.Id);- bytes = stream.ToArray();- }- return File(bytes, "application/pdf", $"order_{order.Id}.pdf");+ var model = new OrderModel();+ await _orderViewModelService.PrepareOrderDetailsModel(model, order);++ return View(model);+ }++ public async Task<IActionResult> PdfInvoice(string orderId)+ {+ var order = await _orderService.GetOrderById(orderId);+ //No order found with the specified id+ if (order == null || order.Deleted || !_workContext.HasAccessToOrder(order)) return RedirectToAction("List");++ var orders = new List<Order> {+ order+ };+ byte[] bytes;+ using (var stream = new MemoryStream())+ {+ await _pdfService.PrintOrdersToPdf(stream, orders, _workContext.WorkingLanguage.Id,+ _workContext.CurrentVendor.Id);+ bytes = stream.ToArray();}- [PermissionAuthorizeAction(PermissionActionName.Export)]- [HttpPost]- public async Task<IActionResult> PdfInvoiceAll(OrderListModel model)+ return File(bytes, "application/pdf", $"order_{order.Id}.pdf");+ }++ [PermissionAuthorizeAction(PermissionActionName.Export)]+ [HttpPost]+ public async Task<IActionResult> PdfInvoiceAll(OrderListModel model)+ {+ //load orders+ var orders = await _orderViewModelService.PrepareOrders(model);+ byte[] bytes;+ using (var stream = new MemoryStream()){- //load orders- var orders = await _orderViewModelService.PrepareOrders(model);- byte[] bytes;- using (var stream = new MemoryStream())- {- await _pdfService.PrintOrdersToPdf(stream, orders, _workContext.WorkingLanguage.Id, _workContext.CurrentVendor.Id);- bytes = stream.ToArray();- }- return File(bytes, "application/pdf", "orders.pdf");+ await _pdfService.PrintOrdersToPdf(stream, orders, _workContext.WorkingLanguage.Id,+ _workContext.CurrentVendor.Id);+ bytes = stream.ToArray();}- [PermissionAuthorizeAction(PermissionActionName.Export)]- [HttpPost]- public async Task<IActionResult> PdfInvoiceSelected(string selectedIds)+ return File(bytes, "application/pdf", "orders.pdf");+ }++ [PermissionAuthorizeAction(PermissionActionName.Export)]+ [HttpPost]+ public async Task<IActionResult> PdfInvoiceSelected(string selectedIds)+ {+ var orders = new List<Order>();+ if (selectedIds != null){- var orders = new List<Order>();- if (selectedIds != null)- {- var ids = selectedIds- .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)- .Select(x => x)- .ToArray();- orders.AddRange(await _orderService.GetOrdersByIds(ids));- }-- //a vendor should have access only to his products- orders = orders.Where(_workContext.HasAccessToOrder).ToList();-- //ensure that we at least one order selected- if (orders.Count == 0)- {- Error(_translationService.GetResource("Vendor.Orders.PdfInvoice.NoOrders"));- return RedirectToAction("List");- }+ var ids = selectedIds+ .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)+ .Select(x => x)+ .ToArray();+ orders.AddRange(await _orderService.GetOrdersByIds(ids));+ }- byte[] bytes;- using (var stream = new MemoryStream())- {- await _pdfService.PrintOrdersToPdf(stream, orders, _workContext.WorkingLanguage.Id, _workContext.CurrentVendor.Id);- bytes = stream.ToArray();- }- return File(bytes, "application/pdf", "orders.pdf");+ //a vendor should have access only to his products+ orders = orders.Where(_workContext.HasAccessToOrder).ToList();++ //ensure that we at least one order selected+ if (orders.Count == 0)+ {+ Error(_translationService.GetResource("Vendor.Orders.PdfInvoice.NoOrders"));+ return RedirectToAction("List");}- #endregion+ byte[] bytes;+ using (var stream = new MemoryStream())+ {+ await _pdfService.PrintOrdersToPdf(stream, orders, _workContext.WorkingLanguage.Id,+ _workContext.CurrentVendor.Id);+ bytes = stream.ToArray();+ }- #endregion-+ return File(bytes, "application/pdf", "orders.pdf");}-}++ #endregion++ #endregion+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Controllers/ProductController.cs b/src/Web/Grand.Web.Vendor/Controllers/ProductController.csindex 322c48766..1a9cbbc3e 100644--- a/src/Web/Grand.Web.Vendor/Controllers/ProductController.cs+++ b/src/Web/Grand.Web.Vendor/Controllers/ProductController.cs@@ -10,2668 +10,2581 @@ using Grand.Domain.Catalog;using Grand.Domain.Common;using Grand.Domain.Media;using Grand.Infrastructure;-using Grand.Web.Vendor.Extensions;-using Grand.Web.Vendor.Interfaces;-using Grand.Web.Vendor.Models.Catalog;using Grand.Web.Common.DataSource;using Grand.Web.Common.Extensions;using Grand.Web.Common.Filters;using Grand.Web.Common.Security.Authorization;+using Grand.Web.Vendor.Extensions;+using Grand.Web.Vendor.Interfaces;+using Grand.Web.Vendor.Models.Catalog;using Grand.Web.Vendor.Models.Orders;using Microsoft.AspNetCore.Mvc;using Microsoft.AspNetCore.Mvc.Rendering;using Microsoft.AspNetCore.StaticFiles;-namespace Grand.Web.Vendor.Controllers+namespace Grand.Web.Vendor.Controllers;++[PermissionAuthorize(PermissionSystemName.Products)]+public class ProductController : BaseVendorController{- [PermissionAuthorize(PermissionSystemName.Products)]- public class ProductController : BaseVendorController- {- #region Fields-- private readonly IProductViewModelService _productViewModelService;- private readonly IProductService _productService;- private readonly IInventoryManageService _inventoryManageService;- private readonly IWorkContext _workContext;- private readonly ILanguageService _languageService;- private readonly ITranslationService _translationService;- private readonly IProductReservationService _productReservationService;- private readonly IAuctionService _auctionService;- private readonly IDateTimeService _dateTimeService;- private readonly IPermissionService _permissionService;-- #endregion-- #region Constructors-- public ProductController(- IProductViewModelService productViewModelService,- IProductService productService,- IInventoryManageService inventoryManageService,- IWorkContext workContext,- ILanguageService languageService,- ITranslationService translationService,- IProductReservationService productReservationService,- IAuctionService auctionService,- IDateTimeService dateTimeService,- IPermissionService permissionService)- {- _productViewModelService = productViewModelService;- _productService = productService;- _inventoryManageService = inventoryManageService;- _workContext = workContext;- _languageService = languageService;- _translationService = translationService;- _productReservationService = productReservationService;- _auctionService = auctionService;- _dateTimeService = dateTimeService;- _permissionService = permissionService;- }+ #region Constructors++ public ProductController(+ IProductViewModelService productViewModelService,+ IProductService productService,+ IInventoryManageService inventoryManageService,+ IWorkContext workContext,+ ILanguageService languageService,+ ITranslationService translationService,+ IProductReservationService productReservationService,+ IAuctionService auctionService,+ IDateTimeService dateTimeService,+ IPermissionService permissionService)+ {+ _productViewModelService = productViewModelService;+ _productService = productService;+ _inventoryManageService = inventoryManageService;+ _workContext = workContext;+ _languageService = languageService;+ _translationService = translationService;+ _productReservationService = productReservationService;+ _auctionService = auctionService;+ _dateTimeService = dateTimeService;+ _permissionService = permissionService;+ }- #endregion+ #endregion- #region Methods+ #region Fields- private Task<(bool allow, string message)> CheckAccessToProduct(Product product)- {- if (product == null)- {- return Task.FromResult((false, "Product not exists"));- }+ private readonly IProductViewModelService _productViewModelService;+ private readonly IProductService _productService;+ private readonly IInventoryManageService _inventoryManageService;+ private readonly IWorkContext _workContext;+ private readonly ILanguageService _languageService;+ private readonly ITranslationService _translationService;+ private readonly IProductReservationService _productReservationService;+ private readonly IAuctionService _auctionService;+ private readonly IDateTimeService _dateTimeService;+ private readonly IPermissionService _permissionService;- //a vendor should have access only to his products- return product.VendorId != _workContext.CurrentVendor.Id ?- Task.FromResult((false, "This is not your product")) : Task.FromResult<(bool allow, string message)>((true, null));- }+ #endregion- #region Product list / create / edit / delete+ #region Methods- //list products- public IActionResult Index()- {- return RedirectToAction("List");- }+ private Task<(bool allow, string message)> CheckAccessToProduct(Product product)+ {+ if (product == null) return Task.FromResult((false, "Product not exists"));- public async Task<IActionResult> List()- {- var model = await _productViewModelService.PrepareProductListModel();- return View(model);- }+ //a vendor should have access only to his products+ return product.VendorId != _workContext.CurrentVendor.Id+ ? Task.FromResult((false, "This is not your product"))+ : Task.FromResult<(bool allow, string message)>((true, null));+ }- [PermissionAuthorizeAction(PermissionActionName.List)]- [HttpPost]- public async Task<IActionResult> ProductList(DataSourceRequest command, ProductListModel model)- {- var (productModels, totalCount) =- await _productViewModelService.PrepareProductsModel(model, command.Page, command.PageSize);- var gridModel = new DataSourceResult {- Data = productModels.ToList(),- Total = totalCount- };-- return Json(gridModel);- }+ #region Product list / create / edit / delete- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> GoToSku(ProductListModel model)- {- var sku = model.GoDirectlyToSku;+ //list products+ public IActionResult Index()+ {+ return RedirectToAction("List");+ }- //try to load a product entity- var product = await _productService.GetProductBySku(sku);- if (product != null)- {- return RedirectToAction("Edit", "Product", new { id = product.Id });- }+ public async Task<IActionResult> List()+ {+ var model = await _productViewModelService.PrepareProductListModel();+ return View(model);+ }- //not found- Warning(_translationService.GetResource("Vendor.Catalog.Products.List.SkuNotFound"));- return RedirectToAction("List", "Product");- }+ [PermissionAuthorizeAction(PermissionActionName.List)]+ [HttpPost]+ public async Task<IActionResult> ProductList(DataSourceRequest command, ProductListModel model)+ {+ var (productModels, totalCount) =+ await _productViewModelService.PrepareProductsModel(model, command.Page, command.PageSize);+ var gridModel = new DataSourceResult {+ Data = productModels.ToList(),+ Total = totalCount+ };++ return Json(gridModel);+ }++ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> GoToSku(ProductListModel model)+ {+ var sku = model.GoDirectlyToSku;- //create product- [PermissionAuthorizeAction(PermissionActionName.Create)]- public async Task<IActionResult> Create()+ //try to load a product entity+ var product = await _productService.GetProductBySku(sku);+ if (product != null) return RedirectToAction("Edit", "Product", new { id = product.Id });++ //not found+ Warning(_translationService.GetResource("Vendor.Catalog.Products.List.SkuNotFound"));+ return RedirectToAction("List", "Product");+ }++ //create product+ [PermissionAuthorizeAction(PermissionActionName.Create)]+ public async Task<IActionResult> Create()+ {+ var model = new ProductModel();+ await _productViewModelService.PrepareProductModel(model, null, true);+ await AddLocales(_languageService, model.Locales);+ return View(model);+ }++ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ [ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]+ public async Task<IActionResult> Create(ProductModel model, bool continueEditing)+ {+ if (ModelState.IsValid){- var model = new ProductModel();- await _productViewModelService.PrepareProductModel(model, null, true);- await AddLocales(_languageService, model.Locales);- return View(model);+ var product = await _productViewModelService.InsertProductModel(model);+ Success(_translationService.GetResource("Vendor.Catalog.Products.Added"));+ return continueEditing ? RedirectToAction("Edit", new { id = product.Id }) : RedirectToAction("List");}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost, ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]- public async Task<IActionResult> Create(ProductModel model, bool continueEditing)- {- if (ModelState.IsValid)- {- var product = await _productViewModelService.InsertProductModel(model);- Success(_translationService.GetResource("Vendor.Catalog.Products.Added"));- return continueEditing ? RedirectToAction("Edit", new { id = product.Id }) : RedirectToAction("List");- }+ //If we got this far, something failed, redisplay form+ await _productViewModelService.PrepareProductModel(model, null, false);+ return View(model);+ }- //If we got this far, something failed, redisplay form- await _productViewModelService.PrepareProductModel(model, null, false);- return View(model);- }+ //edit product+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ public async Task<IActionResult> Edit(string id)+ {+ var product = await _productService.GetProductById(id, true);+ if (product == null || product.VendorId != _workContext.CurrentVendor.Id)+ //No product found with the specified id+ return RedirectToAction("List");- //edit product- [PermissionAuthorizeAction(PermissionActionName.Preview)]- public async Task<IActionResult> Edit(string id)+ var model = product.ToModel(_dateTimeService);+ //model.Ticks = product.UpdatedOnUtc.Ticks;++ await _productViewModelService.PrepareProductModel(model, product, false);+ await AddLocales(_languageService, model.Locales, (locale, languageId) =>{- var product = await _productService.GetProductById(id, true);- if (product == null || product.VendorId != _workContext.CurrentVendor.Id)- //No product found with the specified id- return RedirectToAction("List");+ locale.Name = product.GetTranslation(x => x.Name, languageId, false);+ locale.ShortDescription = product.GetTranslation(x => x.ShortDescription, languageId, false);+ locale.FullDescription = product.GetTranslation(x => x.FullDescription, languageId, false);+ locale.MetaKeywords = product.GetTranslation(x => x.MetaKeywords, languageId, false);+ locale.MetaDescription = product.GetTranslation(x => x.MetaDescription, languageId, false);+ locale.MetaTitle = product.GetTranslation(x => x.MetaTitle, languageId, false);+ locale.SeName = product.GetSeName(languageId, false);+ });- var model = product.ToModel(_dateTimeService);- //model.Ticks = product.UpdatedOnUtc.Ticks;+ return View(model);+ }- await _productViewModelService.PrepareProductModel(model, product, false);- await AddLocales(_languageService, model.Locales, (locale, languageId) =>- {- locale.Name = product.GetTranslation(x => x.Name, languageId, false);- locale.ShortDescription = product.GetTranslation(x => x.ShortDescription, languageId, false);- locale.FullDescription = product.GetTranslation(x => x.FullDescription, languageId, false);- locale.MetaKeywords = product.GetTranslation(x => x.MetaKeywords, languageId, false);- locale.MetaDescription = product.GetTranslation(x => x.MetaDescription, languageId, false);- locale.MetaTitle = product.GetTranslation(x => x.MetaTitle, languageId, false);- locale.SeName = product.GetSeName(languageId, false);- });+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ [ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]+ public async Task<IActionResult> Edit(ProductModel model, bool continueEditing)+ {+ var product = await _productService.GetProductById(model.Id, true);+ if (product == null || product.VendorId != _workContext.CurrentVendor.Id)+ //No product found with the specified id+ return RedirectToAction("List");- return View(model);+ if (model.Ticks != product.Ticks)+ {+ Error(_translationService.GetResource("Vendor.Catalog.Products.Fields.ChangedWarning"));+ return RedirectToAction("Edit", new { id = product.Id });}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost, ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]- public async Task<IActionResult> Edit(ProductModel model, bool continueEditing)+ if (ModelState.IsValid){- var product = await _productService.GetProductById(model.Id, true);- if (product == null || product.VendorId != _workContext.CurrentVendor.Id)- //No product found with the specified id- return RedirectToAction("List");+ product = await _productViewModelService.UpdateProductModel(product, model);- if (model.Ticks != product.Ticks)+ Success(_translationService.GetResource("Vendor.Catalog.Products.Updated"));+ if (continueEditing){- Error(_translationService.GetResource("Vendor.Catalog.Products.Fields.ChangedWarning"));+ //selected tab+ await SaveSelectedTabIndex();return RedirectToAction("Edit", new { id = product.Id });}- if (ModelState.IsValid)- {- product = await _productViewModelService.UpdateProductModel(product, model);-- Success(_translationService.GetResource("Vendor.Catalog.Products.Updated"));- if (continueEditing)- {- //selected tab- await SaveSelectedTabIndex();- return RedirectToAction("Edit", new { id = product.Id });- }+ return RedirectToAction("List");+ }- return RedirectToAction("List");- }+ //If we got this far, something failed, redisplay form+ await _productViewModelService.PrepareProductModel(model, product, false);- //If we got this far, something failed, redisplay form- await _productViewModelService.PrepareProductModel(model, product, false);+ return View(model);+ }- return View(model);- }+ //delete product+ [PermissionAuthorizeAction(PermissionActionName.Delete)]+ [HttpPost]+ public async Task<IActionResult> Delete(string id)+ {+ var product = await _productService.GetProductById(id, true);+ if (product == null || product.VendorId != _workContext.CurrentVendor.Id)+ //No product found with the specified id+ return RedirectToAction("List");- //delete product- [PermissionAuthorizeAction(PermissionActionName.Delete)]- [HttpPost]- public async Task<IActionResult> Delete(string id)+ if (ModelState.IsValid){- var product = await _productService.GetProductById(id, true);- if (product == null || product.VendorId != _workContext.CurrentVendor.Id)- //No product found with the specified id- return RedirectToAction("List");-- if (ModelState.IsValid)- {- await _productViewModelService.DeleteProduct(product);- Success(_translationService.GetResource("Vendor.Catalog.Products.Deleted"));- return RedirectToAction("List");- }-- Error(ModelState);- return RedirectToAction("Edit", new { id });+ await _productViewModelService.DeleteProduct(product);+ Success(_translationService.GetResource("Vendor.Catalog.Products.Deleted"));+ return RedirectToAction("List");}- [PermissionAuthorizeAction(PermissionActionName.Delete)]- [HttpPost]- public async Task<IActionResult> DeleteSelected(ICollection<string> selectedIds)- {- if (selectedIds != null)- {- await _productViewModelService.DeleteSelected(selectedIds.ToList());- }+ Error(ModelState);+ return RedirectToAction("Edit", new { id });+ }- return Json(new { Result = true });- }+ [PermissionAuthorizeAction(PermissionActionName.Delete)]+ [HttpPost]+ public async Task<IActionResult> DeleteSelected(ICollection<string> selectedIds)+ {+ if (selectedIds != null) await _productViewModelService.DeleteSelected(selectedIds.ToList());++ return Json(new { Result = true });+ }- [PermissionAuthorizeAction(PermissionActionName.Create)]- [HttpPost]- public async Task<IActionResult> CopyProduct(ProductModel model,- [FromServices] ICopyProductService copyProductService, [FromServices] IPictureService pictureService)+ [PermissionAuthorizeAction(PermissionActionName.Create)]+ [HttpPost]+ public async Task<IActionResult> CopyProduct(ProductModel model,+ [FromServices] ICopyProductService copyProductService, [FromServices] IPictureService pictureService)+ {+ var copyModel = model.CopyProductModel;+ try{- var copyModel = model.CopyProductModel;- try- {- var originalProduct = await _productService.GetProductById(copyModel.Id, true);- //a vendor should have access only to his products- if (originalProduct == null || originalProduct.VendorId != _workContext.CurrentVendor.Id)- return RedirectToAction("List");+ var originalProduct = await _productService.GetProductById(copyModel.Id, true);+ //a vendor should have access only to his products+ if (originalProduct == null || originalProduct.VendorId != _workContext.CurrentVendor.Id)+ return RedirectToAction("List");- var newProduct = await copyProductService.CopyProduct(originalProduct,- copyModel.Name, copyModel.Published);+ var newProduct = await copyProductService.CopyProduct(originalProduct,+ copyModel.Name, copyModel.Published);- if (copyModel.CopyImages) await CopyImages(originalProduct, newProduct, pictureService);+ if (copyModel.CopyImages) await CopyImages(originalProduct, newProduct, pictureService);- Success("The product has been copied successfully");- return RedirectToAction("Edit", new { id = newProduct.Id });- }- catch (Exception exc)- {- Error(exc.Message);- return RedirectToAction("Edit", new { id = copyModel.Id });- }+ Success("The product has been copied successfully");+ return RedirectToAction("Edit", new { id = newProduct.Id });}-- private async Task CopyImages(Product originalProduct, Product newProduct, IPictureService pictureService)+ catch (Exception exc){- foreach (var productPicture in originalProduct.ProductPictures)- {- var picture = await pictureService.GetPictureById(productPicture.PictureId);- var pictureCopy = await pictureService.InsertPicture(- await pictureService.LoadPictureBinary(picture),- picture.MimeType,- pictureService.GetPictureSeName(newProduct.Name),- picture.AltAttribute,- picture.TitleAttribute,- false,- Reference.Product,- newProduct.Id);-- await _productService.InsertProductPicture(new ProductPicture {- PictureId = pictureCopy.Id,- DisplayOrder = productPicture.DisplayOrder- }, newProduct.Id);- }+ Error(exc.Message);+ return RedirectToAction("Edit", new { id = copyModel.Id });+ }+ }++ private async Task CopyImages(Product originalProduct, Product newProduct, IPictureService pictureService)+ {+ foreach (var productPicture in originalProduct.ProductPictures)+ {+ var picture = await pictureService.GetPictureById(productPicture.PictureId);+ var pictureCopy = await pictureService.InsertPicture(+ await pictureService.LoadPictureBinary(picture),+ picture.MimeType,+ pictureService.GetPictureSeName(newProduct.Name),+ picture.AltAttribute,+ picture.TitleAttribute,+ false,+ Reference.Product,+ newProduct.Id);++ await _productService.InsertProductPicture(new ProductPicture {+ PictureId = pictureCopy.Id,+ DisplayOrder = productPicture.DisplayOrder+ }, newProduct.Id);}+ }++ #endregion- #endregion+ #region Required products- #region Required products+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> LoadProductFriendlyNames(string productIds)+ {+ var result = "";- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> LoadProductFriendlyNames(string productIds)+ if (!string.IsNullOrWhiteSpace(productIds)){- var result = "";+ var rangeArray = productIds+ .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)+ .Select(x => x.Trim())+ .ToList();- if (!string.IsNullOrWhiteSpace(productIds))+ var products = await _productService.GetProductsByIds(Enumerable.ToArray(rangeArray), true);+ for (var i = 0; i <= products.Count - 1; i++){- var rangeArray = productIds- .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)- .Select(x => x.Trim())- .ToList();+ if (products[i].VendorId != _workContext.CurrentVendor.Id) continue;- var products = await _productService.GetProductsByIds(Enumerable.ToArray(rangeArray), true);- for (var i = 0; i <= products.Count - 1; i++)- {- if (products[i].VendorId != _workContext.CurrentVendor.Id) continue;-- result += products[i].Name;- if (i != products.Count - 1)- result += ", ";- }+ result += products[i].Name;+ if (i != products.Count - 1)+ result += ", ";}-- return Json(new { Text = result });}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> RequiredProductAddPopup(string productIdsInput)- {- var model = await _productViewModelService.PrepareAddRequiredProductModel();- ViewBag.productIdsInput = productIdsInput;- return View(model);- }+ return Json(new { Text = result });+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> RequiredProductAddPopupList(DataSourceRequest command,- ProductModel.AddRequiredProductModel model)- {- var (products, totalCount) =- await _productViewModelService.PrepareProductModel(model, command.Page, command.PageSize);- var gridModel = new DataSourceResult {- Data = products.ToList(),- Total = totalCount- };- return Json(gridModel);- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> RequiredProductAddPopup(string productIdsInput)+ {+ var model = await _productViewModelService.PrepareAddRequiredProductModel();+ ViewBag.productIdsInput = productIdsInput;+ return View(model);+ }- #endregion+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> RequiredProductAddPopupList(DataSourceRequest command,+ ProductModel.AddRequiredProductModel model)+ {+ var (products, totalCount) =+ await _productViewModelService.PrepareProductModel(model, command.Page, command.PageSize);+ var gridModel = new DataSourceResult {+ Data = products.ToList(),+ Total = totalCount+ };+ return Json(gridModel);+ }- #region Product categories+ #endregion- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> ProductCategoryList(string productId)- {- var product = await _productService.GetProductById(productId);+ #region Product categories++ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> ProductCategoryList(string productId)+ {+ var product = await _productService.GetProductById(productId);- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return ErrorForKendoGridJson(permission.message);+ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return ErrorForKendoGridJson(permission.message);- var productCategoriesModel = await _productViewModelService.PrepareProductCategoryModel(product);- var gridModel = new DataSourceResult {- Data = productCategoriesModel,- Total = productCategoriesModel.Count- };+ var productCategoriesModel = await _productViewModelService.PrepareProductCategoryModel(product);+ var gridModel = new DataSourceResult {+ Data = productCategoriesModel,+ Total = productCategoriesModel.Count+ };- return Json(gridModel);- }+ return Json(gridModel);+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductCategoryInsert(ProductModel.ProductCategoryModel model)- {- if (ModelState.IsValid)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductCategoryInsert(ProductModel.ProductCategoryModel model)+ {+ if (ModelState.IsValid)+ try{- try- {- await _productViewModelService.InsertProductCategoryModel(model);- return new JsonResult("");- }- catch (Exception ex)- {- return ErrorForKendoGridJson(ex.Message);- }+ await _productViewModelService.InsertProductCategoryModel(model);+ return new JsonResult("");}-- return ErrorForKendoGridJson(ModelState);- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductCategoryUpdate(ProductModel.ProductCategoryModel model)- {- if (ModelState.IsValid)+ catch (Exception ex){- try- {- await _productViewModelService.UpdateProductCategoryModel(model);- return new JsonResult("");- }- catch (Exception ex)- {- return ErrorForKendoGridJson(ex.Message);- }+ return ErrorForKendoGridJson(ex.Message);}- return ErrorForKendoGridJson(ModelState);- }+ return ErrorForKendoGridJson(ModelState);+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductCategoryDelete(ProductModel.ProductCategoryModel model)- {- if (ModelState.IsValid)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductCategoryUpdate(ProductModel.ProductCategoryModel model)+ {+ if (ModelState.IsValid)+ try{- await _productViewModelService.DeleteProductCategory(model.Id, model.ProductId);+ await _productViewModelService.UpdateProductCategoryModel(model);return new JsonResult("");}+ catch (Exception ex)+ {+ return ErrorForKendoGridJson(ex.Message);+ }- return ErrorForKendoGridJson(ModelState);+ return ErrorForKendoGridJson(ModelState);+ }++ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductCategoryDelete(ProductModel.ProductCategoryModel model)+ {+ if (ModelState.IsValid)+ {+ await _productViewModelService.DeleteProductCategory(model.Id, model.ProductId);+ return new JsonResult("");}- #endregion+ return ErrorForKendoGridJson(ModelState);+ }++ #endregion- #region Product collections+ #region Product collections- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> ProductCollectionList(string productId)- {- var product = await _productService.GetProductById(productId);+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> ProductCollectionList(string productId)+ {+ var product = await _productService.GetProductById(productId);- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return ErrorForKendoGridJson(permission.message);+ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return ErrorForKendoGridJson(permission.message);- var productCollectionsModel = await _productViewModelService.PrepareProductCollectionModel(product);- var gridModel = new DataSourceResult {- Data = productCollectionsModel,- Total = productCollectionsModel.Count- };+ var productCollectionsModel = await _productViewModelService.PrepareProductCollectionModel(product);+ var gridModel = new DataSourceResult {+ Data = productCollectionsModel,+ Total = productCollectionsModel.Count+ };- return Json(gridModel);- }+ return Json(gridModel);+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductCollectionInsert(ProductModel.ProductCollectionModel model)- {- if (ModelState.IsValid)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductCollectionInsert(ProductModel.ProductCollectionModel model)+ {+ if (ModelState.IsValid)+ try{- try- {- await _productViewModelService.InsertProductCollection(model);- return new JsonResult("");- }- catch (Exception ex)- {- return ErrorForKendoGridJson(ex.Message);- }+ await _productViewModelService.InsertProductCollection(model);+ return new JsonResult("");}-- return ErrorForKendoGridJson(ModelState);- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductCollectionUpdate(ProductModel.ProductCollectionModel model)- {- if (ModelState.IsValid)+ catch (Exception ex){- try- {- await _productViewModelService.UpdateProductCollection(model);- return new JsonResult("");- }- catch (Exception ex)- {- return ErrorForKendoGridJson(ex.Message);- }+ return ErrorForKendoGridJson(ex.Message);}- return ErrorForKendoGridJson(ModelState);- }+ return ErrorForKendoGridJson(ModelState);+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductCollectionDelete(ProductModel.ProductCollectionModel model)- {- if (ModelState.IsValid)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductCollectionUpdate(ProductModel.ProductCollectionModel model)+ {+ if (ModelState.IsValid)+ try{- await _productViewModelService.DeleteProductCollection(model.Id, model.ProductId);+ await _productViewModelService.UpdateProductCollection(model);return new JsonResult("");}+ catch (Exception ex)+ {+ return ErrorForKendoGridJson(ex.Message);+ }- return ErrorForKendoGridJson(ModelState);- }-- #endregion-- #region Related products+ return ErrorForKendoGridJson(ModelState);+ }- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> RelatedProductList(string productId)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductCollectionDelete(ProductModel.ProductCollectionModel model)+ {+ if (ModelState.IsValid){- var product = await _productService.GetProductById(productId);+ await _productViewModelService.DeleteProductCollection(model.Id, model.ProductId);+ return new JsonResult("");+ }- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return ErrorForKendoGridJson(permission.message);+ return ErrorForKendoGridJson(ModelState);+ }- var relatedProducts = product.RelatedProducts.OrderBy(x => x.DisplayOrder);- var relatedProductsModel = new List<ProductModel.RelatedProductModel>();- foreach (var x in relatedProducts)- {- relatedProductsModel.Add(new ProductModel.RelatedProductModel {- Id = x.Id,- ProductId1 = productId,- ProductId2 = x.ProductId2,- Product2Name = (await _productService.GetProductById(x.ProductId2))?.Name,- DisplayOrder = x.DisplayOrder- });- }+ #endregion- var gridModel = new DataSourceResult {- Data = relatedProductsModel,- Total = relatedProductsModel.Count- };+ #region Related products- return Json(gridModel);- }+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> RelatedProductList(string productId)+ {+ var product = await _productService.GetProductById(productId);++ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return ErrorForKendoGridJson(permission.message);++ var relatedProducts = product.RelatedProducts.OrderBy(x => x.DisplayOrder);+ var relatedProductsModel = new List<ProductModel.RelatedProductModel>();+ foreach (var x in relatedProducts)+ relatedProductsModel.Add(new ProductModel.RelatedProductModel {+ Id = x.Id,+ ProductId1 = productId,+ ProductId2 = x.ProductId2,+ Product2Name = (await _productService.GetProductById(x.ProductId2))?.Name,+ DisplayOrder = x.DisplayOrder+ });- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> RelatedProductUpdate(ProductModel.RelatedProductModel model)- {- if (ModelState.IsValid)- {- await _productViewModelService.UpdateRelatedProductModel(model);- return new JsonResult("");- }+ var gridModel = new DataSourceResult {+ Data = relatedProductsModel,+ Total = relatedProductsModel.Count+ };- return ErrorForKendoGridJson(ModelState);- }+ return Json(gridModel);+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> RelatedProductDelete(ProductModel.RelatedProductModel model)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> RelatedProductUpdate(ProductModel.RelatedProductModel model)+ {+ if (ModelState.IsValid){- if (ModelState.IsValid)- {- await _productViewModelService.DeleteRelatedProductModel(model);- return new JsonResult("");- }-- return ErrorForKendoGridJson(ModelState);+ await _productViewModelService.UpdateRelatedProductModel(model);+ return new JsonResult("");}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> RelatedProductAddPopup(string productId)- {- var model = await _productViewModelService.PrepareRelatedProductModel();- model.ProductId = productId;- return View(model);- }+ return ErrorForKendoGridJson(ModelState);+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> RelatedProductAddPopupList(DataSourceRequest command,- ProductModel.AddRelatedProductModel model)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> RelatedProductDelete(ProductModel.RelatedProductModel model)+ {+ if (ModelState.IsValid){- var (products, totalCount) =- await _productViewModelService.PrepareProductModel(model, command.Page, command.PageSize);- var gridModel = new DataSourceResult {- Data = products.ToList(),- Total = totalCount- };-- return Json(gridModel);+ await _productViewModelService.DeleteRelatedProductModel(model);+ return new JsonResult("");}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> RelatedProductAddPopup(ProductModel.AddRelatedProductModel model)- {- if (ModelState.IsValid)- {- if (model.SelectedProductIds != null)- {- await _productViewModelService.InsertRelatedProductModel(model);- }- return Content("");- }- return Content(ModelState.GetErrors());- }+ return ErrorForKendoGridJson(ModelState);+ }- #endregion+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> RelatedProductAddPopup(string productId)+ {+ var model = await _productViewModelService.PrepareRelatedProductModel();+ model.ProductId = productId;+ return View(model);+ }- #region Similar products+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> RelatedProductAddPopupList(DataSourceRequest command,+ ProductModel.AddRelatedProductModel model)+ {+ var (products, totalCount) =+ await _productViewModelService.PrepareProductModel(model, command.Page, command.PageSize);+ var gridModel = new DataSourceResult {+ Data = products.ToList(),+ Total = totalCount+ };++ return Json(gridModel);+ }- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> SimilarProductList(string productId)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> RelatedProductAddPopup(ProductModel.AddRelatedProductModel model)+ {+ if (ModelState.IsValid){- var product = await _productService.GetProductById(productId);+ if (model.SelectedProductIds != null) await _productViewModelService.InsertRelatedProductModel(model);+ return Content("");+ }- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return ErrorForKendoGridJson(permission.message);+ return Content(ModelState.GetErrors());+ }- var similarProducts = product.SimilarProducts.OrderBy(x => x.DisplayOrder);- var similarProductsModel = new List<ProductModel.SimilarProductModel>();- foreach (var x in similarProducts)- {- similarProductsModel.Add(new ProductModel.SimilarProductModel {- Id = x.Id,- ProductId1 = productId,- ProductId2 = x.ProductId2,- Product2Name = (await _productService.GetProductById(x.ProductId2))?.Name,- DisplayOrder = x.DisplayOrder- });- }+ #endregion- var gridModel = new DataSourceResult {- Data = similarProductsModel,- Total = similarProductsModel.Count- };+ #region Similar products- return Json(gridModel);- }+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> SimilarProductList(string productId)+ {+ var product = await _productService.GetProductById(productId);++ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return ErrorForKendoGridJson(permission.message);++ var similarProducts = product.SimilarProducts.OrderBy(x => x.DisplayOrder);+ var similarProductsModel = new List<ProductModel.SimilarProductModel>();+ foreach (var x in similarProducts)+ similarProductsModel.Add(new ProductModel.SimilarProductModel {+ Id = x.Id,+ ProductId1 = productId,+ ProductId2 = x.ProductId2,+ Product2Name = (await _productService.GetProductById(x.ProductId2))?.Name,+ DisplayOrder = x.DisplayOrder+ });- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> SimilarProductUpdate(ProductModel.SimilarProductModel model)- {- if (ModelState.IsValid)- {- await _productViewModelService.UpdateSimilarProductModel(model);- return new JsonResult("");- }+ var gridModel = new DataSourceResult {+ Data = similarProductsModel,+ Total = similarProductsModel.Count+ };- return ErrorForKendoGridJson(ModelState);- }+ return Json(gridModel);+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> SimilarProductDelete(ProductModel.SimilarProductModel model)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> SimilarProductUpdate(ProductModel.SimilarProductModel model)+ {+ if (ModelState.IsValid){- if (ModelState.IsValid)- {- await _productViewModelService.DeleteSimilarProductModel(model);- return new JsonResult("");- }-- return ErrorForKendoGridJson(ModelState);+ await _productViewModelService.UpdateSimilarProductModel(model);+ return new JsonResult("");}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> SimilarProductAddPopup(string productId)- {- var model = await _productViewModelService.PrepareSimilarProductModel();- model.ProductId = productId;- return View(model);- }+ return ErrorForKendoGridJson(ModelState);+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> SimilarProductAddPopupList(DataSourceRequest command,- ProductModel.AddSimilarProductModel model)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> SimilarProductDelete(ProductModel.SimilarProductModel model)+ {+ if (ModelState.IsValid){- var (products, totalCount) =- await _productViewModelService.PrepareProductModel(model, command.Page, command.PageSize);- var gridModel = new DataSourceResult {- Data = products.ToList(),- Total = totalCount- };-- return Json(gridModel);+ await _productViewModelService.DeleteSimilarProductModel(model);+ return new JsonResult("");}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> SimilarProductAddPopup(ProductModel.AddSimilarProductModel model)- {- if (ModelState.IsValid)- {- if (model.SelectedProductIds != null)- {- await _productViewModelService.InsertSimilarProductModel(model);- }- return Content("");- }- return Content(ModelState.GetErrors());- }+ return ErrorForKendoGridJson(ModelState);+ }- #endregion+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> SimilarProductAddPopup(string productId)+ {+ var model = await _productViewModelService.PrepareSimilarProductModel();+ model.ProductId = productId;+ return View(model);+ }- #region Bundle products+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> SimilarProductAddPopupList(DataSourceRequest command,+ ProductModel.AddSimilarProductModel model)+ {+ var (products, totalCount) =+ await _productViewModelService.PrepareProductModel(model, command.Page, command.PageSize);+ var gridModel = new DataSourceResult {+ Data = products.ToList(),+ Total = totalCount+ };++ return Json(gridModel);+ }- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> BundleProductList(string productId)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> SimilarProductAddPopup(ProductModel.AddSimilarProductModel model)+ {+ if (ModelState.IsValid){- var product = await _productService.GetProductById(productId);+ if (model.SelectedProductIds != null) await _productViewModelService.InsertSimilarProductModel(model);+ return Content("");+ }- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return ErrorForKendoGridJson(permission.message);+ return Content(ModelState.GetErrors());+ }- var bundleProducts = product.BundleProducts.OrderBy(x => x.DisplayOrder);- var bundleProductsModel = new List<ProductModel.BundleProductModel>();- foreach (var x in bundleProducts)- {- bundleProductsModel.Add(new ProductModel.BundleProductModel {- Id = x.Id,- ProductBundleId = productId,- ProductId = x.ProductId,- ProductName = (await _productService.GetProductById(x.ProductId))?.Name,- DisplayOrder = x.DisplayOrder,- Quantity = x.Quantity- });- }+ #endregion- var gridModel = new DataSourceResult {- Data = bundleProductsModel,- Total = bundleProductsModel.Count- };+ #region Bundle products- return Json(gridModel);- }+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> BundleProductList(string productId)+ {+ var product = await _productService.GetProductById(productId);++ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return ErrorForKendoGridJson(permission.message);++ var bundleProducts = product.BundleProducts.OrderBy(x => x.DisplayOrder);+ var bundleProductsModel = new List<ProductModel.BundleProductModel>();+ foreach (var x in bundleProducts)+ bundleProductsModel.Add(new ProductModel.BundleProductModel {+ Id = x.Id,+ ProductBundleId = productId,+ ProductId = x.ProductId,+ ProductName = (await _productService.GetProductById(x.ProductId))?.Name,+ DisplayOrder = x.DisplayOrder,+ Quantity = x.Quantity+ });- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> BundleProductUpdate(ProductModel.BundleProductModel model)- {- if (ModelState.IsValid)- {- await _productViewModelService.UpdateBundleProductModel(model);- return new JsonResult("");- }+ var gridModel = new DataSourceResult {+ Data = bundleProductsModel,+ Total = bundleProductsModel.Count+ };- return ErrorForKendoGridJson(ModelState);- }+ return Json(gridModel);+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> BundleProductDelete(ProductModel.BundleProductModel model)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> BundleProductUpdate(ProductModel.BundleProductModel model)+ {+ if (ModelState.IsValid){- if (ModelState.IsValid)- {- await _productViewModelService.DeleteBundleProductModel(model);- return new JsonResult("");- }-- return ErrorForKendoGridJson(ModelState);+ await _productViewModelService.UpdateBundleProductModel(model);+ return new JsonResult("");}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> BundleProductAddPopup(string productId)- {- var model = await _productViewModelService.PrepareBundleProductModel();- model.ProductId = productId;- return View(model);- }+ return ErrorForKendoGridJson(ModelState);+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> BundleProductAddPopupList(DataSourceRequest command,- ProductModel.AddBundleProductModel model)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> BundleProductDelete(ProductModel.BundleProductModel model)+ {+ if (ModelState.IsValid){- var (products, totalCount) =- await _productViewModelService.PrepareProductModel(model, command.Page, command.PageSize);- var gridModel = new DataSourceResult {- Data = products.ToList(),- Total = totalCount- };-- return Json(gridModel);+ await _productViewModelService.DeleteBundleProductModel(model);+ return new JsonResult("");}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> BundleProductAddPopup(ProductModel.AddBundleProductModel model)- {- if (ModelState.IsValid)- {- if (model.SelectedProductIds != null)- {- await _productViewModelService.InsertBundleProductModel(model);- }-- return Content("");- }- return Content(ModelState.GetErrors());- }+ return ErrorForKendoGridJson(ModelState);+ }- #endregion+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> BundleProductAddPopup(string productId)+ {+ var model = await _productViewModelService.PrepareBundleProductModel();+ model.ProductId = productId;+ return View(model);+ }- #region Cross-sell products+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> BundleProductAddPopupList(DataSourceRequest command,+ ProductModel.AddBundleProductModel model)+ {+ var (products, totalCount) =+ await _productViewModelService.PrepareProductModel(model, command.Page, command.PageSize);+ var gridModel = new DataSourceResult {+ Data = products.ToList(),+ Total = totalCount+ };++ return Json(gridModel);+ }- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> CrossSellProductList(string productId)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> BundleProductAddPopup(ProductModel.AddBundleProductModel model)+ {+ if (ModelState.IsValid){- var product = await _productService.GetProductById(productId);-- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return ErrorForKendoGridJson(permission.message);-- var crossSellProducts = product.CrossSellProduct;- var crossSellProductsModel = new List<ProductModel.CrossSellProductModel>();- foreach (var x in crossSellProducts)- {- crossSellProductsModel.Add(new ProductModel.CrossSellProductModel {- Id = x,- ProductId = product.Id,- Product2Name = (await _productService.GetProductById(x))?.Name- });- }+ if (model.SelectedProductIds != null) await _productViewModelService.InsertBundleProductModel(model);- var gridModel = new DataSourceResult {- Data = crossSellProductsModel,- Total = crossSellProductsModel.Count- };-- return Json(gridModel);+ return Content("");}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> CrossSellProductDelete(ProductModel.CrossSellProductModel model)- {- if (ModelState.IsValid)- {- var product = await _productService.GetProductById(model.ProductId);+ return Content(ModelState.GetErrors());+ }- var crossSellProduct = product.CrossSellProduct.FirstOrDefault(x => x == model.Id);- if (string.IsNullOrEmpty(crossSellProduct))- throw new ArgumentException("No cross-sell product found with the specified id");+ #endregion- await _productViewModelService.DeleteCrossSellProduct(product.Id, crossSellProduct);- return new JsonResult("");- }+ #region Cross-sell products- return ErrorForKendoGridJson(ModelState);- }+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> CrossSellProductList(string productId)+ {+ var product = await _productService.GetProductById(productId);- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> CrossSellProductAddPopup(string productId)- {- var model = await _productViewModelService.PrepareCrossSellProductModel();- model.ProductId = productId;- return View(model);- }+ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return ErrorForKendoGridJson(permission.message);- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> CrossSellProductAddPopupList(DataSourceRequest command,- ProductModel.AddCrossSellProductModel model)- {- var (products, totalCount) =- await _productViewModelService.PrepareProductModel(model, command.Page, command.PageSize);- var gridModel = new DataSourceResult {- Data = products.ToList(),- Total = totalCount- };-- return Json(gridModel);- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> CrossSellProductAddPopup(ProductModel.AddCrossSellProductModel model)- {- if (ModelState.IsValid)- {- if (model.SelectedProductIds != null)- {- await _productViewModelService.InsertCrossSellProductModel(model);- }- return Content("");- }- return Content(ModelState.GetErrors());- }+ var crossSellProducts = product.CrossSellProduct;+ var crossSellProductsModel = new List<ProductModel.CrossSellProductModel>();+ foreach (var x in crossSellProducts)+ crossSellProductsModel.Add(new ProductModel.CrossSellProductModel {+ Id = x,+ ProductId = product.Id,+ Product2Name = (await _productService.GetProductById(x))?.Name+ });- #endregion+ var gridModel = new DataSourceResult {+ Data = crossSellProductsModel,+ Total = crossSellProductsModel.Count+ };- #region Recommended products+ return Json(gridModel);+ }- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> RecommendedProductList(string productId)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> CrossSellProductDelete(ProductModel.CrossSellProductModel model)+ {+ if (ModelState.IsValid){- var product = await _productService.GetProductById(productId);-- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return ErrorForKendoGridJson(permission.message);-- var recommendedProductsModel = new List<ProductModel.RecommendedProductModel>();- foreach (var x in product.RecommendedProduct)- {- recommendedProductsModel.Add(new ProductModel.RecommendedProductModel {- Id = x,- ProductId = product.Id,- Product2Name = (await _productService.GetProductById(x))?.Name- });- }+ var product = await _productService.GetProductById(model.ProductId);- var gridModel = new DataSourceResult {- Data = recommendedProductsModel,- Total = recommendedProductsModel.Count- };+ var crossSellProduct = product.CrossSellProduct.FirstOrDefault(x => x == model.Id);+ if (string.IsNullOrEmpty(crossSellProduct))+ throw new ArgumentException("No cross-sell product found with the specified id");- return Json(gridModel);+ await _productViewModelService.DeleteCrossSellProduct(product.Id, crossSellProduct);+ return new JsonResult("");}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> RecommendedProductDelete(ProductModel.RecommendedProductModel model)- {- var product = await _productService.GetProductById(model.ProductId);- if (product == null)- {- throw new ArgumentException("Product not exists");- }-- var recommendedProduct = product.RecommendedProduct.FirstOrDefault(x => x == model.Id);- if (string.IsNullOrEmpty(recommendedProduct))- throw new ArgumentException("No recommended product found with the specified id");+ return ErrorForKendoGridJson(ModelState);+ }- if (ModelState.IsValid)- {- await _productViewModelService.DeleteRecommendedProduct(product.Id, recommendedProduct);- return new JsonResult("");- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> CrossSellProductAddPopup(string productId)+ {+ var model = await _productViewModelService.PrepareCrossSellProductModel();+ model.ProductId = productId;+ return View(model);+ }- return ErrorForKendoGridJson(ModelState);- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> CrossSellProductAddPopupList(DataSourceRequest command,+ ProductModel.AddCrossSellProductModel model)+ {+ var (products, totalCount) =+ await _productViewModelService.PrepareProductModel(model, command.Page, command.PageSize);+ var gridModel = new DataSourceResult {+ Data = products.ToList(),+ Total = totalCount+ };++ return Json(gridModel);+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> RecommendedProductAddPopup(string productId)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> CrossSellProductAddPopup(ProductModel.AddCrossSellProductModel model)+ {+ if (ModelState.IsValid){- var model = await _productViewModelService.PrepareRecommendedProductModel();- model.ProductId = productId;- return View(model);+ if (model.SelectedProductIds != null) await _productViewModelService.InsertCrossSellProductModel(model);+ return Content("");}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> RecommendedProductAddPopupList(DataSourceRequest command,- ProductModel.AddRecommendedProductModel model)- {- var (products, totalCount) =- await _productViewModelService.PrepareProductModel(model, command.Page, command.PageSize);- var gridModel = new DataSourceResult {- Data = products.ToList(),- Total = totalCount- };-- return Json(gridModel);- }+ return Content(ModelState.GetErrors());+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> RecommendedProductAddPopup(ProductModel.AddRecommendedProductModel model)- {- if (ModelState.IsValid)- {- if (model.SelectedProductIds != null)- {- await _productViewModelService.InsertRecommendedProductModel(model);- }- return Content("");- }- return Content(ModelState.GetErrors());- }+ #endregion- #endregion+ #region Recommended products- #region Associated products+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> RecommendedProductList(string productId)+ {+ var product = await _productService.GetProductById(productId);- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> AssociatedProductList(string productId)- {- var product = await _productService.GetProductById(productId);+ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return ErrorForKendoGridJson(permission.message);- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return ErrorForKendoGridJson(permission.message);+ var recommendedProductsModel = new List<ProductModel.RecommendedProductModel>();+ foreach (var x in product.RecommendedProduct)+ recommendedProductsModel.Add(new ProductModel.RecommendedProductModel {+ Id = x,+ ProductId = product.Id,+ Product2Name = (await _productService.GetProductById(x))?.Name+ });- var vendorId = "";- if (_workContext.CurrentVendor != null)- {- vendorId = _workContext.CurrentVendor.Id;- }+ var gridModel = new DataSourceResult {+ Data = recommendedProductsModel,+ Total = recommendedProductsModel.Count+ };- var associatedProducts = await _productService.GetAssociatedProducts(parentGroupedProductId: productId,- vendorId: vendorId,- showHidden: true);- var associatedProductsModel = associatedProducts- .Select(x => new ProductModel.AssociatedProductModel {- Id = x.Id,- ProductId = productId,- ProductName = x.Name,- DisplayOrder = x.DisplayOrder- })- .ToList();+ return Json(gridModel);+ }- var gridModel = new DataSourceResult {- Data = associatedProductsModel,- Total = associatedProductsModel.Count- };+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> RecommendedProductDelete(ProductModel.RecommendedProductModel model)+ {+ var product = await _productService.GetProductById(model.ProductId);+ if (product == null) throw new ArgumentException("Product not exists");- return Json(gridModel);- }+ var recommendedProduct = product.RecommendedProduct.FirstOrDefault(x => x == model.Id);+ if (string.IsNullOrEmpty(recommendedProduct))+ throw new ArgumentException("No recommended product found with the specified id");- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> AssociatedProductUpdate(ProductModel.AssociatedProductModel model)+ if (ModelState.IsValid){- if (ModelState.IsValid)- {- var associatedProduct = await _productService.GetProductById(model.Id);- if (associatedProduct == null || associatedProduct.VendorId != _workContext.CurrentVendor.Id)- throw new ArgumentException("No associated product found with the specified id");+ await _productViewModelService.DeleteRecommendedProduct(product.Id, recommendedProduct);+ return new JsonResult("");+ }- associatedProduct.DisplayOrder = model.DisplayOrder;- await _productService.UpdateAssociatedProduct(associatedProduct);+ return ErrorForKendoGridJson(ModelState);+ }- return new JsonResult("");- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> RecommendedProductAddPopup(string productId)+ {+ var model = await _productViewModelService.PrepareRecommendedProductModel();+ model.ProductId = productId;+ return View(model);+ }- return ErrorForKendoGridJson(ModelState);- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> RecommendedProductAddPopupList(DataSourceRequest command,+ ProductModel.AddRecommendedProductModel model)+ {+ var (products, totalCount) =+ await _productViewModelService.PrepareProductModel(model, command.Page, command.PageSize);+ var gridModel = new DataSourceResult {+ Data = products.ToList(),+ Total = totalCount+ };++ return Json(gridModel);+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> AssociatedProductDelete(ProductModel.AssociatedProductModel model)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> RecommendedProductAddPopup(ProductModel.AddRecommendedProductModel model)+ {+ if (ModelState.IsValid){- if (ModelState.IsValid)- {- var product = await _productService.GetProductById(model.Id);- if (product == null || product.VendorId != _workContext.CurrentVendor.Id)- throw new ArgumentException("No associated product found with the specified id");+ if (model.SelectedProductIds != null) await _productViewModelService.InsertRecommendedProductModel(model);+ return Content("");+ }- await _productViewModelService.DeleteAssociatedProduct(product);- return new JsonResult("");- }+ return Content(ModelState.GetErrors());+ }- return ErrorForKendoGridJson(ModelState);- }+ #endregion- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> AssociatedProductAddPopup(string productId)- {- var model = await _productViewModelService.PrepareAssociatedProductModel();- model.ProductId = productId;- return View(model);- }+ #region Associated products- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> AssociatedProductAddPopupList(DataSourceRequest command,- ProductModel.AddAssociatedProductModel model)- {- var (products, totalCount) =- await _productViewModelService.PrepareProductModel(model, command.Page, command.PageSize);- var gridModel = new DataSourceResult {- Data = products.ToList(),- Total = totalCount- };- return Json(gridModel);- }+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> AssociatedProductList(string productId)+ {+ var product = await _productService.GetProductById(productId);++ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return ErrorForKendoGridJson(permission.message);++ var vendorId = "";+ if (_workContext.CurrentVendor != null) vendorId = _workContext.CurrentVendor.Id;++ var associatedProducts = await _productService.GetAssociatedProducts(productId,+ vendorId: vendorId,+ showHidden: true);+ var associatedProductsModel = associatedProducts+ .Select(x => new ProductModel.AssociatedProductModel {+ Id = x.Id,+ ProductId = productId,+ ProductName = x.Name,+ DisplayOrder = x.DisplayOrder+ })+ .ToList();++ var gridModel = new DataSourceResult {+ Data = associatedProductsModel,+ Total = associatedProductsModel.Count+ };++ return Json(gridModel);+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> AssociatedProductAddPopup(ProductModel.AddAssociatedProductModel model)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> AssociatedProductUpdate(ProductModel.AssociatedProductModel model)+ {+ if (ModelState.IsValid){- if (ModelState.IsValid)- {- if (model.SelectedProductIds != null)- {- await _productViewModelService.InsertAssociatedProductModel(model);- }+ var associatedProduct = await _productService.GetProductById(model.Id);+ if (associatedProduct == null || associatedProduct.VendorId != _workContext.CurrentVendor.Id)+ throw new ArgumentException("No associated product found with the specified id");- return Content("");- }+ associatedProduct.DisplayOrder = model.DisplayOrder;+ await _productService.UpdateAssociatedProduct(associatedProduct);- Error(ModelState);- model = await _productViewModelService.PrepareAssociatedProductModel();- model.ProductId = model.ProductId;- return View(model);+ return new JsonResult("");}- #endregion-- #region Product pictures+ return ErrorForKendoGridJson(ModelState);+ }- [HttpPost]- [IgnoreAntiforgeryToken]- public async Task<IActionResult> ProductPictureAdd(Reference reference, string objectId,- [FromServices] IPictureService pictureService,- [FromServices] MediaSettings mediaSettings)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> AssociatedProductDelete(ProductModel.AssociatedProductModel model)+ {+ if (ModelState.IsValid){- if (!await _permissionService.Authorize(PermissionSystemName.Pictures))- return Json(new {- success = false,- message = "Access denied - picture permissions"- });+ var product = await _productService.GetProductById(model.Id);+ if (product == null || product.VendorId != _workContext.CurrentVendor.Id)+ throw new ArgumentException("No associated product found with the specified id");- if (reference != Reference.Product || string.IsNullOrEmpty(objectId))- return Json(new {- success = false,- message = "Please save form before upload new pictures"- });+ await _productViewModelService.DeleteAssociatedProduct(product);+ return new JsonResult("");+ }- var form = await HttpContext.Request.ReadFormAsync();- var httpPostedFiles = form.Files.ToList();- if (!httpPostedFiles.Any())- {- return Json(new {- success = false,- message = "No files uploaded"- });- }+ return ErrorForKendoGridJson(ModelState);+ }- var product = await _productService.GetProductById(objectId);+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> AssociatedProductAddPopup(string productId)+ {+ var model = await _productViewModelService.PrepareAssociatedProductModel();+ model.ProductId = productId;+ return View(model);+ }- //a vendor should have access only to his products- if (product.VendorId != _workContext.CurrentVendor.Id)- return Json(new {- success = false,- message = "Access denied - vendor permissions"- });+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> AssociatedProductAddPopupList(DataSourceRequest command,+ ProductModel.AddAssociatedProductModel model)+ {+ var (products, totalCount) =+ await _productViewModelService.PrepareProductModel(model, command.Page, command.PageSize);+ var gridModel = new DataSourceResult {+ Data = products.ToList(),+ Total = totalCount+ };+ return Json(gridModel);+ }- var values = new List<(string pictureUrl, string pictureId)>();- foreach (var file in httpPostedFiles)- {- var qqFileNameParameter = "qqfilename";- var fileName = file.FileName;- if (string.IsNullOrEmpty(fileName) && form.ContainsKey(qqFileNameParameter))- fileName = form[qqFileNameParameter].ToString();+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> AssociatedProductAddPopup(ProductModel.AddAssociatedProductModel model)+ {+ if (ModelState.IsValid)+ {+ if (model.SelectedProductIds != null) await _productViewModelService.InsertAssociatedProductModel(model);- fileName = Path.GetFileName(fileName);+ return Content("");+ }- var contentType = file.ContentType;- var fileExtension = Path.GetExtension(fileName);- if (!string.IsNullOrEmpty(fileExtension))- fileExtension = fileExtension.ToLowerInvariant();+ Error(ModelState);+ model = await _productViewModelService.PrepareAssociatedProductModel();+ model.ProductId = model.ProductId;+ return View(model);+ }- if (string.IsNullOrEmpty(contentType))- {- _ = new FileExtensionContentTypeProvider().TryGetContentType(fileName, out contentType);- }+ #endregion- if (FileExtensions.GetAllowedMediaFileTypes(mediaSettings.AllowedFileTypes).Contains(fileExtension))- {- var fileBinary = file.GetDownloadBits();- //insert picture- var picture = await pictureService.InsertPicture(fileBinary, contentType, null,- reference: reference, objectId: objectId);- var pictureUrl = await pictureService.GetPictureUrl(picture);-- values.Add((pictureUrl, picture.Id));- //assign picture to the product- await _productViewModelService.InsertProductPicture(product, picture, 0);- }- }+ #region Product pictures- return Json(new { success = values.Any(), data = values });- }+ [HttpPost]+ [IgnoreAntiforgeryToken]+ public async Task<IActionResult> ProductPictureAdd(Reference reference, string objectId,+ [FromServices] IPictureService pictureService,+ [FromServices] MediaSettings mediaSettings)+ {+ if (!await _permissionService.Authorize(PermissionSystemName.Pictures))+ return Json(new {+ success = false,+ message = "Access denied - picture permissions"+ });- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> ProductPictureList(string productId)- {- var product = await _productService.GetProductById(productId);+ if (reference != Reference.Product || string.IsNullOrEmpty(objectId))+ return Json(new {+ success = false,+ message = "Please save form before upload new pictures"+ });- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return ErrorForKendoGridJson(permission.message);+ var form = await HttpContext.Request.ReadFormAsync();+ var httpPostedFiles = form.Files.ToList();+ if (!httpPostedFiles.Any())+ return Json(new {+ success = false,+ message = "No files uploaded"+ });- var productPicturesModel = await _productViewModelService.PrepareProductPicturesModel(product);- var gridModel = new DataSourceResult {- Data = productPicturesModel,- Total = productPicturesModel.Count- };+ var product = await _productService.GetProductById(objectId);- return Json(gridModel);- }+ //a vendor should have access only to his products+ if (product.VendorId != _workContext.CurrentVendor.Id)+ return Json(new {+ success = false,+ message = "Access denied - vendor permissions"+ });- [PermissionAuthorizeAction(PermissionActionName.Preview)]- public async Task<IActionResult> ProductPicturePopup(string productId, string id)+ var values = new List<(string pictureUrl, string pictureId)>();+ foreach (var file in httpPostedFiles){- var product = await _productService.GetProductById(productId);- if (product == null)- return Content("Product not exist");+ var qqFileNameParameter = "qqfilename";+ var fileName = file.FileName;+ if (string.IsNullOrEmpty(fileName) && form.ContainsKey(qqFileNameParameter))+ fileName = form[qqFileNameParameter].ToString();- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return Content(permission.message);+ fileName = Path.GetFileName(fileName);- var pp = product.ProductPictures.FirstOrDefault(x => x.Id == id);- if (pp == null)- return Content("Product picture not exist");+ var contentType = file.ContentType;+ var fileExtension = Path.GetExtension(fileName);+ if (!string.IsNullOrEmpty(fileExtension))+ fileExtension = fileExtension.ToLowerInvariant();- var (model, picture) = await _productViewModelService.PrepareProductPictureModel(product, pp);- //locales- await AddLocales(_languageService, model.Locales, (locale, languageId) =>+ if (string.IsNullOrEmpty(contentType))+ _ = new FileExtensionContentTypeProvider().TryGetContentType(fileName, out contentType);++ if (FileExtensions.GetAllowedMediaFileTypes(mediaSettings.AllowedFileTypes).Contains(fileExtension)){- locale.AltAttribute = picture?.GetTranslation(x => x.AltAttribute, languageId, false);- locale.TitleAttribute = picture?.GetTranslation(x => x.TitleAttribute, languageId, false);- });+ var fileBinary = file.GetDownloadBits();+ //insert picture+ var picture = await pictureService.InsertPicture(fileBinary, contentType, null,+ reference: reference, objectId: objectId);+ var pictureUrl = await pictureService.GetPictureUrl(picture);- return View(model);+ values.Add((pictureUrl, picture.Id));+ //assign picture to the product+ await _productViewModelService.InsertProductPicture(product, picture, 0);+ }}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductPicturePopup(ProductModel.ProductPictureModel model)- {- if (ModelState.IsValid)- {- var product = await _productService.GetProductById(model.ProductId);- if (product == null)- throw new ArgumentException("No product found with the specified id");+ return Json(new { success = values.Any(), data = values });+ }- if (product.ProductPictures.FirstOrDefault(x => x.Id == model.Id) == null)- throw new ArgumentException("No product picture found with the specified id");+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> ProductPictureList(string productId)+ {+ var product = await _productService.GetProductById(productId);- await _productViewModelService.UpdateProductPicture(model);+ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return ErrorForKendoGridJson(permission.message);- return Content("");- }+ var productPicturesModel = await _productViewModelService.PrepareProductPicturesModel(product);+ var gridModel = new DataSourceResult {+ Data = productPicturesModel,+ Total = productPicturesModel.Count+ };- Error(ModelState);+ return Json(gridModel);+ }- return View(model);- }+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ public async Task<IActionResult> ProductPicturePopup(string productId, string id)+ {+ var product = await _productService.GetProductById(productId);+ if (product == null)+ return Content("Product not exist");- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductPictureDelete(ProductModel.ProductPictureModel model)- {- if (ModelState.IsValid)- {- await _productViewModelService.DeleteProductPicture(model);- return new JsonResult("");- }+ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return Content(permission.message);- return ErrorForKendoGridJson(ModelState);- }+ var pp = product.ProductPictures.FirstOrDefault(x => x.Id == id);+ if (pp == null)+ return Content("Product picture not exist");- #endregion+ var (model, picture) = await _productViewModelService.PrepareProductPictureModel(product, pp);+ //locales+ await AddLocales(_languageService, model.Locales, (locale, languageId) =>+ {+ locale.AltAttribute = picture?.GetTranslation(x => x.AltAttribute, languageId, false);+ locale.TitleAttribute = picture?.GetTranslation(x => x.TitleAttribute, languageId, false);+ });- #region Product specification attributes+ return View(model);+ }- //ajax- [AcceptVerbs("GET")]- public async Task<IActionResult> GetOptionsByAttributeId(string attributeId,- [FromServices] ISpecificationAttributeService specificationAttributeService)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductPicturePopup(ProductModel.ProductPictureModel model)+ {+ if (ModelState.IsValid){- if (string.IsNullOrEmpty(attributeId))- return Json("");+ var product = await _productService.GetProductById(model.ProductId);+ if (product == null)+ throw new ArgumentException("No product found with the specified id");- var options =- (await specificationAttributeService.GetSpecificationAttributeById(attributeId))- .SpecificationAttributeOptions.OrderBy(x => x.DisplayOrder);- var result = (from o in options- select new { id = o.Id, name = o.Name }).ToList();- return Json(result);- }+ if (product.ProductPictures.FirstOrDefault(x => x.Id == model.Id) == null)+ throw new ArgumentException("No product picture found with the specified id");- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> ProductSpecAttrList(string productId)- {- var product = await _productService.GetProductById(productId);-- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return ErrorForKendoGridJson(permission.message);-- var productSpecsModel = await _productViewModelService.PrepareProductSpecificationAttributeModel(product);- var gridModel = new DataSourceResult {- Data = productSpecsModel,- Total = productSpecsModel.Count- };- return Json(gridModel);+ await _productViewModelService.UpdateProductPicture(model);++ return Content("");}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> ProductSpecAttrPopup(- [FromServices] ISpecificationAttributeService specificationAttributeService,- string productId, string id)- {- var product = await _productService.GetProductById(productId);+ Error(ModelState);- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return Content(permission.message);+ return View(model);+ }- var model = new ProductModel.AddProductSpecificationAttributeModel {- //default specs values- ShowOnProductPage = true- };+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductPictureDelete(ProductModel.ProductPictureModel model)+ {+ if (ModelState.IsValid)+ {+ await _productViewModelService.DeleteProductPicture(model);+ return new JsonResult("");+ }- if (!string.IsNullOrEmpty(id))- {- var specification = product.ProductSpecificationAttributes.FirstOrDefault(x => x.Id == id);- if (specification != null)- {- model = specification.ToModel();- }- }+ return ErrorForKendoGridJson(ModelState);+ }- model.AvailableAttributes = await PrepareAvailableAttributes(specificationAttributeService);+ #endregion- return View(model);- }+ #region Product specification attributes- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductSpecAttrPopup(- [FromServices] ISpecificationAttributeService specificationAttributeService,- ProductModel.AddProductSpecificationAttributeModel model)- {- if (ModelState.IsValid)- {- var product = await _productService.GetProductById(model.ProductId);+ //ajax+ [AcceptVerbs("GET")]+ public async Task<IActionResult> GetOptionsByAttributeId(string attributeId,+ [FromServices] ISpecificationAttributeService specificationAttributeService)+ {+ if (string.IsNullOrEmpty(attributeId))+ return Json("");- var psa = product.ProductSpecificationAttributes.FirstOrDefault(x => x.Id == model.Id);- if (psa == null)- await _productViewModelService.InsertProductSpecificationAttributeModel(model, product);- else- await _productViewModelService.UpdateProductSpecificationAttributeModel(psa, model);+ var options =+ (await specificationAttributeService.GetSpecificationAttributeById(attributeId))+ .SpecificationAttributeOptions.OrderBy(x => x.DisplayOrder);+ var result = (from o in options+ select new { id = o.Id, name = o.Name }).ToList();+ return Json(result);+ }++ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> ProductSpecAttrList(string productId)+ {+ var product = await _productService.GetProductById(productId);++ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return ErrorForKendoGridJson(permission.message);++ var productSpecsModel = await _productViewModelService.PrepareProductSpecificationAttributeModel(product);+ var gridModel = new DataSourceResult {+ Data = productSpecsModel,+ Total = productSpecsModel.Count+ };+ return Json(gridModel);+ }- return new JsonResult("");- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> ProductSpecAttrPopup(+ [FromServices] ISpecificationAttributeService specificationAttributeService,+ string productId, string id)+ {+ var product = await _productService.GetProductById(productId);- Error(ModelState);- model.AvailableAttributes = await PrepareAvailableAttributes(specificationAttributeService);+ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return Content(permission.message);- return View(model);- }+ var model = new ProductModel.AddProductSpecificationAttributeModel {+ //default specs values+ ShowOnProductPage = true+ };- private async Task<List<SelectListItem>> PrepareAvailableAttributes(- ISpecificationAttributeService specificationAttributeService)+ if (!string.IsNullOrEmpty(id)){- return (await specificationAttributeService.GetSpecificationAttributes()).Select(sa => new SelectListItem { Text = sa.Name, Value = sa.Id }).ToList();+ var specification = product.ProductSpecificationAttributes.FirstOrDefault(x => x.Id == id);+ if (specification != null) model = specification.ToModel();}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductSpecAttrDelete(ProductSpecificationAttributeModel model)- {- if (ModelState.IsValid)- {- var product = await _productService.GetProductById(model.ProductId);+ model.AvailableAttributes = await PrepareAvailableAttributes(specificationAttributeService);- var psa = product.ProductSpecificationAttributes.FirstOrDefault(x => x.Id == model.Id);- if (psa == null)- throw new ArgumentException("No specification attribute found with the specified id");+ return View(model);+ }- await _productViewModelService.DeleteProductSpecificationAttribute(product, psa);- return new JsonResult("");- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductSpecAttrPopup(+ [FromServices] ISpecificationAttributeService specificationAttributeService,+ ProductModel.AddProductSpecificationAttributeModel model)+ {+ if (ModelState.IsValid)+ {+ var product = await _productService.GetProductById(model.ProductId);++ var psa = product.ProductSpecificationAttributes.FirstOrDefault(x => x.Id == model.Id);+ if (psa == null)+ await _productViewModelService.InsertProductSpecificationAttributeModel(model, product);+ else+ await _productViewModelService.UpdateProductSpecificationAttributeModel(psa, model);- return ErrorForKendoGridJson(ModelState);+ return new JsonResult("");}- #endregion+ Error(ModelState);+ model.AvailableAttributes = await PrepareAvailableAttributes(specificationAttributeService);++ return View(model);+ }- #region Purchased with order+ private async Task<List<SelectListItem>> PrepareAvailableAttributes(+ ISpecificationAttributeService specificationAttributeService)+ {+ return (await specificationAttributeService.GetSpecificationAttributes())+ .Select(sa => new SelectListItem { Text = sa.Name, Value = sa.Id }).ToList();+ }- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> PurchasedWithOrders(DataSourceRequest command, string productId,- [FromServices] IOrderViewModelService orderViewModelService)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductSpecAttrDelete(ProductSpecificationAttributeModel model)+ {+ if (ModelState.IsValid){- if (!await _permissionService.Authorize(StandardPermission.ManageOrders))- return Json(new DataSourceResult {- Data = null,- Total = 0- });+ var product = await _productService.GetProductById(model.ProductId);- var product = await _productService.GetProductById(productId);+ var psa = product.ProductSpecificationAttributes.FirstOrDefault(x => x.Id == model.Id);+ if (psa == null)+ throw new ArgumentException("No specification attribute found with the specified id");++ await _productViewModelService.DeleteProductSpecificationAttribute(product, psa);+ return new JsonResult("");+ }- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return ErrorForKendoGridJson(permission.message);+ return ErrorForKendoGridJson(ModelState);+ }- var model = new OrderListModel {- ProductId = productId- };+ #endregion- var (orderModels, totalCount) =- await orderViewModelService.PrepareOrderModel(model, command.Page, command.PageSize);- var gridModel = new DataSourceResult {- Data = orderModels.ToList(),- Total = totalCount- };- return Json(gridModel);- }+ #region Purchased with order- #endregion+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> PurchasedWithOrders(DataSourceRequest command, string productId,+ [FromServices] IOrderViewModelService orderViewModelService)+ {+ if (!await _permissionService.Authorize(StandardPermission.ManageOrders))+ return Json(new DataSourceResult {+ Data = null,+ Total = 0+ });- #region Reviews+ var product = await _productService.GetProductById(productId);- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> Reviews(DataSourceRequest command, string productId,- [FromServices] IProductReviewService productReviewService)- {- var product = await _productService.GetProductById(productId);+ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return ErrorForKendoGridJson(permission.message);- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return ErrorForKendoGridJson(permission.message);+ var model = new OrderListModel {+ ProductId = productId+ };- var productReviews = await productReviewService.GetAllProductReviews("", null,- null, null, "", "", productId);+ var (orderModels, totalCount) =+ await orderViewModelService.PrepareOrderModel(model, command.Page, command.PageSize);+ var gridModel = new DataSourceResult {+ Data = orderModels.ToList(),+ Total = totalCount+ };+ return Json(gridModel);+ }- var items = new List<ProductReviewModel>();- foreach (var item in productReviews.PagedForCommand(command))- {- var m = new ProductReviewModel();- await _productViewModelService.PrepareProductReviewModel(m, item, false, true);- items.Add(m);- }+ #endregion- var gridModel = new DataSourceResult {- Data = items,- Total = productReviews.Count- };+ #region Reviews- return Json(gridModel);- }+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> Reviews(DataSourceRequest command, string productId,+ [FromServices] IProductReviewService productReviewService)+ {+ var product = await _productService.GetProductById(productId);- #endregion+ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return ErrorForKendoGridJson(permission.message);- #region Export / Import+ var productReviews = await productReviewService.GetAllProductReviews("", null,+ null, null, "", "", productId);- [PermissionAuthorizeAction(PermissionActionName.Export)]- [HttpPost]- public async Task<IActionResult> ExportExcelAll(ProductListModel model,- [FromServices] IExportManager<Product> exportManager)+ var items = new List<ProductReviewModel>();+ foreach (var item in productReviews.PagedForCommand(command)){- var products = await _productViewModelService.PrepareProducts(model);- try- {- var bytes = await exportManager.Export(products);- return File(bytes, "text/xls", "products.xlsx");- }- catch (Exception exc)- {- Error(exc);- return RedirectToAction("List");- }+ var m = new ProductReviewModel();+ await _productViewModelService.PrepareProductReviewModel(m, item, false, true);+ items.Add(m);}- [PermissionAuthorizeAction(PermissionActionName.Export)]- [HttpPost]- public async Task<IActionResult> ExportExcelSelected(string selectedIds,- [FromServices] IExportManager<Product> exportManager)- {- var products = new List<Product>();- if (selectedIds != null)- {- var ids = selectedIds- .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)- .Select(x => x)- .ToArray();- products.AddRange(await _productService.GetProductsByIds(ids, true));- }+ var gridModel = new DataSourceResult {+ Data = items,+ Total = productReviews.Count+ };- //a vendor should have access only to his products- products = products.Where(p => p.VendorId == _workContext.CurrentVendor.Id).ToList();+ return Json(gridModel);+ }++ #endregion++ #region Export / Import+ [PermissionAuthorizeAction(PermissionActionName.Export)]+ [HttpPost]+ public async Task<IActionResult> ExportExcelAll(ProductListModel model,+ [FromServices] IExportManager<Product> exportManager)+ {+ var products = await _productViewModelService.PrepareProducts(model);+ try+ {var bytes = await exportManager.Export(products);return File(bytes, "text/xls", "products.xlsx");}-- #endregion-- #region Bulk editing-- [PermissionAuthorizeAction(PermissionActionName.Preview)]- public async Task<IActionResult> BulkEdit()+ catch (Exception exc){- var model = await _productViewModelService.PrepareBulkEditListModel();- return View(model);+ Error(exc);+ return RedirectToAction("List");}+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> BulkEditSelect(DataSourceRequest command, BulkEditListModel model)+ [PermissionAuthorizeAction(PermissionActionName.Export)]+ [HttpPost]+ public async Task<IActionResult> ExportExcelSelected(string selectedIds,+ [FromServices] IExportManager<Product> exportManager)+ {+ var products = new List<Product>();+ if (selectedIds != null){- var (bulkEditProductModels, totalCount) =- await _productViewModelService.PrepareBulkEditProductModel(model, command.Page, command.PageSize);- var gridModel = new DataSourceResult {- Data = bulkEditProductModels.ToList(),- Total = totalCount- };- return Json(gridModel);+ var ids = selectedIds+ .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)+ .Select(x => x)+ .ToArray();+ products.AddRange(await _productService.GetProductsByIds(ids, true));}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> BulkEditUpdate(IEnumerable<BulkEditProductModel> products)- {- if (products != null)- {- await _productViewModelService.UpdateBulkEdit(products.ToList());- }+ //a vendor should have access only to his products+ products = products.Where(p => p.VendorId == _workContext.CurrentVendor.Id).ToList();- return new JsonResult("");- }+ var bytes = await exportManager.Export(products);+ return File(bytes, "text/xls", "products.xlsx");+ }- [PermissionAuthorizeAction(PermissionActionName.Delete)]- [HttpPost]- public async Task<IActionResult> BulkEditDelete(IEnumerable<BulkEditProductModel> products)- {- if (products != null)- {- await _productViewModelService.DeleteBulkEdit(products.ToList());- }+ #endregion- return new JsonResult("");- }+ #region Bulk editing- #endregion+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ public async Task<IActionResult> BulkEdit()+ {+ var model = await _productViewModelService.PrepareBulkEditListModel();+ return View(model);+ }- #region Product currency price+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> BulkEditSelect(DataSourceRequest command, BulkEditListModel model)+ {+ var (bulkEditProductModels, totalCount) =+ await _productViewModelService.PrepareBulkEditProductModel(model, command.Page, command.PageSize);+ var gridModel = new DataSourceResult {+ Data = bulkEditProductModels.ToList(),+ Total = totalCount+ };+ return Json(gridModel);+ }- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> ProductPriceList(string productId)- {- var product = await _productService.GetProductById(productId);+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> BulkEditUpdate(IEnumerable<BulkEditProductModel> products)+ {+ if (products != null) await _productViewModelService.UpdateBulkEdit(products.ToList());- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return ErrorForKendoGridJson(permission.message);+ return new JsonResult("");+ }- var items = new List<ProductModel.ProductPriceModel>();- foreach (var item in product.ProductPrices)- {- items.Add(new ProductModel.ProductPriceModel {- Id = item.Id,- CurrencyCode = item.CurrencyCode,- Price = item.Price- });- }+ [PermissionAuthorizeAction(PermissionActionName.Delete)]+ [HttpPost]+ public async Task<IActionResult> BulkEditDelete(IEnumerable<BulkEditProductModel> products)+ {+ if (products != null) await _productViewModelService.DeleteBulkEdit(products.ToList());- var gridModel = new DataSourceResult {- Data = items,- Total = items.Count- };+ return new JsonResult("");+ }- return Json(gridModel);- }+ #endregion- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductPriceInsert(string productId, ProductModel.ProductPriceModel model)- {- var product = await _productService.GetProductById(productId);- if (product == null)- throw new ArgumentException("No product found with the specified id");+ #region Product currency price++ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> ProductPriceList(string productId)+ {+ var product = await _productService.GetProductById(productId);++ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return ErrorForKendoGridJson(permission.message);++ var items = new List<ProductModel.ProductPriceModel>();+ foreach (var item in product.ProductPrices)+ items.Add(new ProductModel.ProductPriceModel {+ Id = item.Id,+ CurrencyCode = item.CurrencyCode,+ Price = item.Price+ });++ var gridModel = new DataSourceResult {+ Data = items,+ Total = items.Count+ };++ return Json(gridModel);+ }++ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductPriceInsert(string productId, ProductModel.ProductPriceModel model)+ {+ var product = await _productService.GetProductById(productId);+ if (product == null)+ throw new ArgumentException("No product found with the specified id");- if (product.ProductPrices.Any(x => x.CurrencyCode == model.CurrencyCode))- throw new ArgumentException("Currency code exists");+ if (product.ProductPrices.Any(x => x.CurrencyCode == model.CurrencyCode))+ throw new ArgumentException("Currency code exists");- if (ModelState.IsValid)+ if (ModelState.IsValid)+ try{- try- {- await _productService.InsertProductPrice(new ProductPrice {- ProductId = product.Id,- CurrencyCode = model.CurrencyCode,- Price = model.Price- });- return new JsonResult("");- }- catch (Exception ex)- {- return ErrorForKendoGridJson(ex.Message);- }+ await _productService.InsertProductPrice(new ProductPrice {+ ProductId = product.Id,+ CurrencyCode = model.CurrencyCode,+ Price = model.Price+ });+ return new JsonResult("");+ }+ catch (Exception ex)+ {+ return ErrorForKendoGridJson(ex.Message);}- return ErrorForKendoGridJson(ModelState);- }+ return ErrorForKendoGridJson(ModelState);+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductPriceUpdate(string productId, ProductModel.ProductPriceModel model)- {- var product = await _productService.GetProductById(productId);- if (product == null)- throw new ArgumentException("No product found with the specified id");+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductPriceUpdate(string productId, ProductModel.ProductPriceModel model)+ {+ var product = await _productService.GetProductById(productId);+ if (product == null)+ throw new ArgumentException("No product found with the specified id");- var productPrice = product.ProductPrices.FirstOrDefault(x => x.Id == model.Id);- if (productPrice == null)- throw new ArgumentException("Product price model not exists");+ var productPrice = product.ProductPrices.FirstOrDefault(x => x.Id == model.Id);+ if (productPrice == null)+ throw new ArgumentException("Product price model not exists");- if (product.ProductPrices.Any(x => x.Id != model.Id && x.CurrencyCode == model.CurrencyCode))- throw new ArgumentException("You can't use this currency code");+ if (product.ProductPrices.Any(x => x.Id != model.Id && x.CurrencyCode == model.CurrencyCode))+ throw new ArgumentException("You can't use this currency code");- if (ModelState.IsValid)+ if (ModelState.IsValid)+ try{- try- {- productPrice!.CurrencyCode = model.CurrencyCode;- productPrice.Price = model.Price;- productPrice.ProductId = productId;+ productPrice!.CurrencyCode = model.CurrencyCode;+ productPrice.Price = model.Price;+ productPrice.ProductId = productId;- await _productService.UpdateProductPrice(productPrice);+ await _productService.UpdateProductPrice(productPrice);- return new JsonResult("");- }- catch (Exception ex)- {- return ErrorForKendoGridJson(ex.Message);- }+ return new JsonResult("");+ }+ catch (Exception ex)+ {+ return ErrorForKendoGridJson(ex.Message);}- return ErrorForKendoGridJson(ModelState);- }+ return ErrorForKendoGridJson(ModelState);+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductPriceDelete(string productId, ProductModel.ProductPriceModel model)- {- var product = await _productService.GetProductById(productId);- if (product == null)- throw new ArgumentException("No product found with the specified id");+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductPriceDelete(string productId, ProductModel.ProductPriceModel model)+ {+ var product = await _productService.GetProductById(productId);+ if (product == null)+ throw new ArgumentException("No product found with the specified id");- var productPrice = product.ProductPrices.FirstOrDefault(x => x.Id == model.Id);- if (productPrice == null)- throw new ArgumentException("Product price model not exists");+ var productPrice = product.ProductPrices.FirstOrDefault(x => x.Id == model.Id);+ if (productPrice == null)+ throw new ArgumentException("Product price model not exists");- if (ModelState.IsValid)- {- productPrice!.ProductId = productId;- await _productService.DeleteProductPrice(productPrice);+ if (ModelState.IsValid)+ {+ productPrice!.ProductId = productId;+ await _productService.DeleteProductPrice(productPrice);- return new JsonResult("");- }- return Content(ModelState.GetErrors());+ return new JsonResult("");}- #endregion+ return Content(ModelState.GetErrors());+ }- #region Tier prices+ #endregion- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> TierPriceList(string productId)- {- var product = await _productService.GetProductById(productId);-- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return ErrorForKendoGridJson(permission.message);-- var tierPricesModel = await _productViewModelService.PrepareTierPriceModel(product);- var gridModel = new DataSourceResult {- Data = tierPricesModel,- Total = tierPricesModel.Count- };- return Json(gridModel);- }+ #region Tier prices- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> TierPriceCreatePopup(string productId)- {- var model = new ProductModel.TierPriceModel {- ProductId = productId- };- await _productViewModelService.PrepareTierPriceModel(model);- return View(model);- }+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> TierPriceList(string productId)+ {+ var product = await _productService.GetProductById(productId);++ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return ErrorForKendoGridJson(permission.message);++ var tierPricesModel = await _productViewModelService.PrepareTierPriceModel(product);+ var gridModel = new DataSourceResult {+ Data = tierPricesModel,+ Total = tierPricesModel.Count+ };+ return Json(gridModel);+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> TierPriceCreatePopup(ProductModel.TierPriceModel model)- {- if (ModelState.IsValid)- {- var tierPrice = model.ToEntity(_dateTimeService);- await _productService.InsertTierPrice(tierPrice, model.ProductId);+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> TierPriceCreatePopup(string productId)+ {+ var model = new ProductModel.TierPriceModel {+ ProductId = productId+ };+ await _productViewModelService.PrepareTierPriceModel(model);+ return View(model);+ }- return Content("");- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> TierPriceCreatePopup(ProductModel.TierPriceModel model)+ {+ if (ModelState.IsValid)+ {+ var tierPrice = model.ToEntity(_dateTimeService);+ await _productService.InsertTierPrice(tierPrice, model.ProductId);- Error(ModelState);- //If we got this far, something failed, redisplay form- await _productViewModelService.PrepareTierPriceModel(model);- return View(model);+ return Content("");}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> TierPriceEditPopup(string id, string productId)+ Error(ModelState);+ //If we got this far, something failed, redisplay form+ await _productViewModelService.PrepareTierPriceModel(model);+ return View(model);+ }++ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> TierPriceEditPopup(string id, string productId)+ {+ var product = await _productService.GetProductById(productId);+ if (product == null)+ throw new ArgumentException("No product found with the specified id");++ var tierPrice = product.TierPrices.FirstOrDefault(x => x.Id == id);+ if (tierPrice == null)+ return Content("Empty tier price");++ //a vendor should have access only to his products+ if (product.VendorId != _workContext.CurrentVendor.Id)+ return Content("This is not your product");++ var model = tierPrice.ToModel(_dateTimeService);+ model.ProductId = productId;+ await _productViewModelService.PrepareTierPriceModel(model);+ return View(model);+ }++ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> TierPriceEditPopup(string productId, ProductModel.TierPriceModel model)+ {+ if (ModelState.IsValid){- var product = await _productService.GetProductById(productId);- if (product == null)- throw new ArgumentException("No product found with the specified id");+ var product = await _productService.GetProductById(productId, true);- var tierPrice = product.TierPrices.FirstOrDefault(x => x.Id == id);+ var tierPrice = product.TierPrices.FirstOrDefault(x => x.Id == model.Id);if (tierPrice == null)return Content("Empty tier price");- //a vendor should have access only to his products- if (product.VendorId != _workContext.CurrentVendor.Id)- return Content("This is not your product");+ tierPrice = model.ToEntity(tierPrice, _dateTimeService);+ await _productService.UpdateTierPrice(tierPrice, product.Id);- var model = tierPrice.ToModel(_dateTimeService);- model.ProductId = productId;- await _productViewModelService.PrepareTierPriceModel(model);- return View(model);+ return Content("");}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> TierPriceEditPopup(string productId, ProductModel.TierPriceModel model)- {- if (ModelState.IsValid)- {- var product = await _productService.GetProductById(productId, true);-- var tierPrice = product.TierPrices.FirstOrDefault(x => x.Id == model.Id);- if (tierPrice == null)- return Content("Empty tier price");-- tierPrice = model.ToEntity(tierPrice, _dateTimeService);- await _productService.UpdateTierPrice(tierPrice, product.Id);+ Error(ModelState);+ //stores+ await _productViewModelService.PrepareTierPriceModel(model);+ return View(model);+ }- return Content("");- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> TierPriceDelete(ProductModel.TierPriceDeleteModel model)+ {+ if (ModelState.IsValid)+ {+ var product = await _productService.GetProductById(model.ProductId, true);+ var tierPrice = product.TierPrices.FirstOrDefault(x => x.Id == model.Id);+ if (tierPrice == null)+ throw new ArgumentException("No tier price found with the specified id");- Error(ModelState);- //stores- await _productViewModelService.PrepareTierPriceModel(model);- return View(model);+ await _productService.DeleteTierPrice(tierPrice, product.Id);+ return new JsonResult("");}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> TierPriceDelete(ProductModel.TierPriceDeleteModel model)- {- if (ModelState.IsValid)- {- var product = await _productService.GetProductById(model.ProductId, true);- var tierPrice = product.TierPrices.FirstOrDefault(x => x.Id == model.Id);- if (tierPrice == null)- throw new ArgumentException("No tier price found with the specified id");+ return ErrorForKendoGridJson(ModelState);+ }- await _productService.DeleteTierPrice(tierPrice, product.Id);- return new JsonResult("");- }+ #endregion- return ErrorForKendoGridJson(ModelState);- }+ #region Product attributes- #endregion+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> ProductAttributeMappingList(string productId)+ {+ var product = await _productService.GetProductById(productId);- #region Product attributes+ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return ErrorForKendoGridJson(permission.message);- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> ProductAttributeMappingList(string productId)- {- var product = await _productService.GetProductById(productId);+ var attributesModel = await _productViewModelService.PrepareProductAttributeMappingModels(product);+ var gridModel = new DataSourceResult {+ Data = attributesModel,+ Total = attributesModel.Count+ };- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return ErrorForKendoGridJson(permission.message);+ return Json(gridModel);+ }- var attributesModel = await _productViewModelService.PrepareProductAttributeMappingModels(product);- var gridModel = new DataSourceResult {- Data = attributesModel,- Total = attributesModel.Count- };+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> ProductAttributeMappingPopup(string productId,+ string productAttributeMappingId)+ {+ var product = await _productService.GetProductById(productId);- return Json(gridModel);- }+ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return Content(permission.message);- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> ProductAttributeMappingPopup(string productId,- string productAttributeMappingId)+ if (string.IsNullOrEmpty(productAttributeMappingId)){- var product = await _productService.GetProductById(productId);-- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return Content(permission.message);+ var model = await _productViewModelService.PrepareProductAttributeMappingModel(product);+ return View(model);+ }+ else+ {+ var productAttributeMapping =+ product.ProductAttributeMappings.FirstOrDefault(x => x.Id == productAttributeMappingId);+ var model = await _productViewModelService.PrepareProductAttributeMappingModel(productAttributeMapping);+ return View(model);+ }+ }- if (string.IsNullOrEmpty(productAttributeMappingId))- {- var model = await _productViewModelService.PrepareProductAttributeMappingModel(product);- return View(model);- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductAttributeMappingPopup(ProductModel.ProductAttributeMappingModel model)+ {+ if (ModelState.IsValid)+ {+ if (string.IsNullOrEmpty(model.Id))+ await _productViewModelService.InsertProductAttributeMappingModel(model);else- {- var productAttributeMapping =- product.ProductAttributeMappings.FirstOrDefault(x => x.Id == productAttributeMappingId);- var model = await _productViewModelService.PrepareProductAttributeMappingModel(productAttributeMapping);- return View(model);- }+ await _productViewModelService.UpdateProductAttributeMappingModel(model);++ return Content("");}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductAttributeMappingPopup(ProductModel.ProductAttributeMappingModel model)- {- if (ModelState.IsValid)- {- if (string.IsNullOrEmpty(model.Id))- await _productViewModelService.InsertProductAttributeMappingModel(model);- else- await _productViewModelService.UpdateProductAttributeMappingModel(model);+ Error(ModelState);+ model = await _productViewModelService.PrepareProductAttributeMappingModel(model);+ return View(model);+ }- return Content("");- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductAttributeMappingDelete(string id, string productId,+ [FromServices] IProductAttributeService productAttributeService)+ {+ var product = await _productService.GetProductById(productId);+ if (product == null)+ throw new ArgumentException("No product found with the specified id");- Error(ModelState);- model = await _productViewModelService.PrepareProductAttributeMappingModel(model);- return View(model);- }+ var productAttributeMapping = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == id);+ if (productAttributeMapping == null)+ throw new ArgumentException("No product attribute mapping found with the specified id");- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductAttributeMappingDelete(string id, string productId,- [FromServices] IProductAttributeService productAttributeService)- {- var product = await _productService.GetProductById(productId);- if (product == null)- throw new ArgumentException("No product found with the specified id");+ //a vendor should have access only to his products+ if (product.VendorId != _workContext.CurrentVendor.Id)+ return Content("This is not your product");- var productAttributeMapping = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == id);- if (productAttributeMapping == null)- throw new ArgumentException("No product attribute mapping found with the specified id");+ await productAttributeService.DeleteProductAttributeMapping(productAttributeMapping, product.Id);+ return new JsonResult("");+ }- //a vendor should have access only to his products- if (product.VendorId != _workContext.CurrentVendor.Id)- return Content("This is not your product");+ //edit+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> ProductAttributeValidationRulesPopup(string id, string productId)+ {+ var product = await _productService.GetProductById(productId);- await productAttributeService.DeleteProductAttributeMapping(productAttributeMapping, product.Id);- return new JsonResult("");- }+ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return Content(permission.message);- //edit- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> ProductAttributeValidationRulesPopup(string id, string productId)- {- var product = await _productService.GetProductById(productId);+ var productAttributeMapping = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == id);+ if (productAttributeMapping == null)+ return Content("No attribute value found with the specified id");- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return Content(permission.message);- var productAttributeMapping = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == id);- if (productAttributeMapping == null)- return Content("No attribute value found with the specified id");+ var model = await _productViewModelService.PrepareProductAttributeMappingModel(productAttributeMapping);+ return View(model);+ }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductAttributeValidationRulesPopup(+ ProductModel.ProductAttributeMappingModel model)+ {+ var product = await _productService.GetProductById(model.ProductId);+ if (product == null)+ throw new ArgumentException("No product found with the specified id");- var model = await _productViewModelService.PrepareProductAttributeMappingModel(productAttributeMapping);- return View(model);- }+ var productAttributeMapping = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == model.Id);+ if (productAttributeMapping == null)+ throw new ArgumentException("No attribute value found with the specified id");- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductAttributeValidationRulesPopup(- ProductModel.ProductAttributeMappingModel model)+ if (ModelState.IsValid){- var product = await _productService.GetProductById(model.ProductId);- if (product == null)- throw new ArgumentException("No product found with the specified id");+ await _productViewModelService.UpdateProductAttributeValidationRulesModel(productAttributeMapping,+ model);+ return Content("");+ }- var productAttributeMapping = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == model.Id);- if (productAttributeMapping == null)- throw new ArgumentException("No attribute value found with the specified id");+ Error(ModelState);+ model = await _productViewModelService.PrepareProductAttributeMappingModel(productAttributeMapping);+ return View(model);+ }- if (ModelState.IsValid)- {- await _productViewModelService.UpdateProductAttributeValidationRulesModel(productAttributeMapping,- model);- return Content("");- }+ #endregion- Error(ModelState);- model = await _productViewModelService.PrepareProductAttributeMappingModel(productAttributeMapping);- return View(model);- }+ #region Product attributes. Condition- #endregion+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> ProductAttributeConditionPopup(string productId,+ string productAttributeMappingId)+ {+ var product = await _productService.GetProductById(productId);- #region Product attributes. Condition+ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return Content(permission.message);- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> ProductAttributeConditionPopup(string productId,- string productAttributeMappingId)- {- var product = await _productService.GetProductById(productId);+ var productAttributeMapping =+ product.ProductAttributeMappings.FirstOrDefault(x => x.Id == productAttributeMappingId);+ if (productAttributeMapping == null)+ //No attribute value found with the specified id+ return Content("No attribute value found with the specified id");- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return Content(permission.message);+ var model = await _productViewModelService.PrepareProductAttributeConditionModel(product,+ productAttributeMapping);+ return View(model);+ }++ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductAttributeConditionPopup(ProductAttributeConditionModel model)+ {+ if (ModelState.IsValid)+ {+ var product = await _productService.GetProductById(model.ProductId);var productAttributeMapping =- product.ProductAttributeMappings.FirstOrDefault(x => x.Id == productAttributeMappingId);+ product.ProductAttributeMappings.FirstOrDefault(x => x.Id == model.ProductAttributeMappingId);if (productAttributeMapping == null)- //No attribute value found with the specified idreturn Content("No attribute value found with the specified id");- var model = await _productViewModelService.PrepareProductAttributeConditionModel(product,- productAttributeMapping);- return View(model);+ await _productViewModelService.UpdateProductAttributeConditionModel(product, productAttributeMapping,+ model);}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductAttributeConditionPopup(ProductAttributeConditionModel model)- {- if (ModelState.IsValid)- {- var product = await _productService.GetProductById(model.ProductId);-- var productAttributeMapping =- product.ProductAttributeMappings.FirstOrDefault(x => x.Id == model.ProductAttributeMappingId);- if (productAttributeMapping == null)- return Content("No attribute value found with the specified id");-- await _productViewModelService.UpdateProductAttributeConditionModel(product, productAttributeMapping,- model);- }-- return Content(ModelState.GetErrors());- }+ return Content(ModelState.GetErrors());+ }- #endregion+ #endregion- #region Product attribute values+ #region Product attribute values- //list- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> EditAttributeValues(string productAttributeMappingId, string productId,- [FromServices] IProductAttributeService productAttributeService)- {- var product = await _productService.GetProductById(productId);- if (product == null || product.VendorId != _workContext.CurrentVendor.Id)- throw new ArgumentException("No product found with the specified id");+ //list+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> EditAttributeValues(string productAttributeMappingId, string productId,+ [FromServices] IProductAttributeService productAttributeService)+ {+ var product = await _productService.GetProductById(productId);+ if (product == null || product.VendorId != _workContext.CurrentVendor.Id)+ throw new ArgumentException("No product found with the specified id");++ var productAttributeMapping =+ product.ProductAttributeMappings.FirstOrDefault(x => x.Id == productAttributeMappingId);+ if (productAttributeMapping == null)+ throw new ArgumentException("No product attribute mapping found with the specified id");++ var productAttribute =+ await productAttributeService.GetProductAttributeById(productAttributeMapping.ProductAttributeId);+ var model = new ProductModel.ProductAttributeValueListModel {+ ProductName = product.Name,+ ProductId = product.Id,+ ProductAttributeName = productAttribute.Name,+ ProductAttributeMappingId = productAttributeMappingId+ };++ return View(model);+ }- var productAttributeMapping =- product.ProductAttributeMappings.FirstOrDefault(x => x.Id == productAttributeMappingId);- if (productAttributeMapping == null)- throw new ArgumentException("No product attribute mapping found with the specified id");+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductAttributeValueList(string productAttributeMappingId, string productId)+ {+ var product = await _productService.GetProductById(productId);++ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return ErrorForKendoGridJson(permission.message);++ var productAttributeMapping =+ product.ProductAttributeMappings.FirstOrDefault(x => x.Id == productAttributeMappingId);+ if (productAttributeMapping == null)+ throw new ArgumentException("No product attribute mapping found with the specified id");++ var values =+ await _productViewModelService.PrepareProductAttributeValueModels(product, productAttributeMapping);+ var gridModel = new DataSourceResult {+ Data = values,+ Total = values.Count+ };+ return Json(gridModel);+ }- var productAttribute =- await productAttributeService.GetProductAttributeById(productAttributeMapping.ProductAttributeId);- var model = new ProductModel.ProductAttributeValueListModel {- ProductName = product.Name,- ProductId = product.Id,- ProductAttributeName = productAttribute.Name,- ProductAttributeMappingId = productAttributeMappingId- };+ //create+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> ProductAttributeValueCreatePopup(string productAttributeMappingId,+ string productId)+ {+ var product = await _productService.GetProductById(productId);- return View(model);- }+ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return Content(permission.message);- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductAttributeValueList(string productAttributeMappingId, string productId)- {- var product = await _productService.GetProductById(productId);+ var productAttributeMapping =+ product.ProductAttributeMappings.FirstOrDefault(x => x.Id == productAttributeMappingId);+ if (productAttributeMapping == null)+ throw new ArgumentException("No product attribute mapping found with the specified id");- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return ErrorForKendoGridJson(permission.message);+ var model = await _productViewModelService.PrepareProductAttributeValueModel(product,+ productAttributeMapping);+ //locales+ await AddLocales(_languageService, model.Locales);- var productAttributeMapping =- product.ProductAttributeMappings.FirstOrDefault(x => x.Id == productAttributeMappingId);- if (productAttributeMapping == null)- throw new ArgumentException("No product attribute mapping found with the specified id");-- var values =- await _productViewModelService.PrepareProductAttributeValueModels(product, productAttributeMapping);- var gridModel = new DataSourceResult {- Data = values,- Total = values.Count- };- return Json(gridModel);- }+ return View(model);+ }- //create- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> ProductAttributeValueCreatePopup(string productAttributeMappingId,- string productId)+ [HttpPost]+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> ProductAttributeValueCreatePopup(ProductModel.ProductAttributeValueModel model)+ {+ if (ModelState.IsValid){- var product = await _productService.GetProductById(productId);-- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return Content(permission.message);+ var product = await _productService.GetProductById(model.ProductId);var productAttributeMapping =- product.ProductAttributeMappings.FirstOrDefault(x => x.Id == productAttributeMappingId);+ product.ProductAttributeMappings.FirstOrDefault(x => x.Id == model.ProductAttributeMappingId);if (productAttributeMapping == null)- throw new ArgumentException("No product attribute mapping found with the specified id");+ //No product attribute found with the specified id+ return RedirectToAction("List", "Product");- var model = await _productViewModelService.PrepareProductAttributeValueModel(product,- productAttributeMapping);- //locales- await AddLocales(_languageService, model.Locales);- return View(model);+ await _productViewModelService.InsertProductAttributeValueModel(model);+ return Content("");}- [HttpPost]- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> ProductAttributeValueCreatePopup(ProductModel.ProductAttributeValueModel model)- {- if (ModelState.IsValid)- {- var product = await _productService.GetProductById(model.ProductId);+ return Content("");+ }- var productAttributeMapping =- product.ProductAttributeMappings.FirstOrDefault(x => x.Id == model.ProductAttributeMappingId);- if (productAttributeMapping == null)- //No product attribute found with the specified id- return RedirectToAction("List", "Product");+ //edit+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> ProductAttributeValueEditPopup(string id, string productId,+ string productAttributeMappingId)+ {+ var product = await _productService.GetProductById(productId);+ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return ErrorForKendoGridJson(permission.message);- await _productViewModelService.InsertProductAttributeValueModel(model);- return Content("");- }+ var pa = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == productAttributeMappingId);+ if (pa == null)+ return RedirectToAction("List", "Product");- return Content("");- }+ var pav = pa.ProductAttributeValues.FirstOrDefault(x => x.Id == id);+ if (pav == null)+ //No attribute value found with the specified id+ return RedirectToAction("List", "Product");- //edit- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> ProductAttributeValueEditPopup(string id, string productId,- string productAttributeMappingId)+ var model = await _productViewModelService.PrepareProductAttributeValueModel(pa, pav);+ //locales+ await AddLocales(_languageService, model.Locales, (locale, languageId) =>{- var product = await _productService.GetProductById(productId);-- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return ErrorForKendoGridJson(permission.message);-- var pa = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == productAttributeMappingId);- if (pa == null)- return RedirectToAction("List", "Product");+ locale.Name = pav.GetTranslation(x => x.Name, languageId, false);+ });+ //pictures+ await _productViewModelService.PrepareProductAttributeValueModel(product, model);+ return View(model);+ }- var pav = pa.ProductAttributeValues.FirstOrDefault(x => x.Id == id);- if (pav == null)- //No attribute value found with the specified id- return RedirectToAction("List", "Product");+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductAttributeValueEditPopup(string productId,+ ProductModel.ProductAttributeValueModel model)+ {+ var product = await _productService.GetProductById(productId);+ if (product == null || product.VendorId != _workContext.CurrentVendor.Id)+ throw new ArgumentException("No product found with the specified id");++ var pav = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == model.ProductAttributeMappingId)+ ?.ProductAttributeValues.FirstOrDefault(x => x.Id == model.Id);+ if (pav == null)+ //No attribute value found with the specified id+ return RedirectToAction("List", "Product");- var model = await _productViewModelService.PrepareProductAttributeValueModel(pa, pav);- //locales- await AddLocales(_languageService, model.Locales, (locale, languageId) =>- {- locale.Name = pav.GetTranslation(x => x.Name, languageId, false);- });- //pictures- await _productViewModelService.PrepareProductAttributeValueModel(product, model);- return View(model);+ if (ModelState.IsValid)+ {+ await _productViewModelService.UpdateProductAttributeValueModel(pav, model);+ return Content("");}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductAttributeValueEditPopup(string productId,- ProductModel.ProductAttributeValueModel model)- {- var product = await _productService.GetProductById(productId);- if (product == null || product.VendorId != _workContext.CurrentVendor.Id)- throw new ArgumentException("No product found with the specified id");+ //If we got this far, something failed, redisplay form+ await _productViewModelService.PrepareProductAttributeValueModel(product, model);+ return View(model);+ }- var pav = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == model.ProductAttributeMappingId)- ?.ProductAttributeValues.FirstOrDefault(x => x.Id == model.Id);- if (pav == null)- //No attribute value found with the specified id- return RedirectToAction("List", "Product");+ //delete+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductAttributeValueDelete(string id, string pam, string productId,+ [FromServices] IProductAttributeService productAttributeService)+ {+ var product = await _productService.GetProductById(productId);+ if (product == null || product.VendorId != _workContext.CurrentVendor.Id)+ throw new ArgumentException("No product found with the specified id");- if (ModelState.IsValid)- {- await _productViewModelService.UpdateProductAttributeValueModel(pav, model);- return Content("");- }+ var pav = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == pam)?.ProductAttributeValues+ .FirstOrDefault(x => x.Id == id);+ if (pav == null)+ throw new ArgumentException("No product attribute value found with the specified id");- //If we got this far, something failed, redisplay form- await _productViewModelService.PrepareProductAttributeValueModel(product, model);- return View(model);+ if (ModelState.IsValid)+ {+ await productAttributeService.DeleteProductAttributeValue(pav, productId, pam);+ return new JsonResult("");}- //delete- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductAttributeValueDelete(string id, string pam, string productId,- [FromServices] IProductAttributeService productAttributeService)- {- var product = await _productService.GetProductById(productId);- if (product == null || product.VendorId != _workContext.CurrentVendor.Id)- throw new ArgumentException("No product found with the specified id");+ return ErrorForKendoGridJson(ModelState);+ }++ public async Task<IActionResult> AssociateProductToAttributeValuePopup()+ {+ var model = await _productViewModelService.PrepareAssociateProductToAttributeValueModel();+ return View(model);+ }- var pav = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == pam)?.ProductAttributeValues- .FirstOrDefault(x => x.Id == id);- if (pav == null)- throw new ArgumentException("No product attribute value found with the specified id");+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> AssociateProductToAttributeValuePopupList(DataSourceRequest command,+ ProductModel.ProductAttributeValueModel.AssociateProductToAttributeValueModel model)+ {+ var (products, totalCount) =+ await _productViewModelService.PrepareProductModel(model, command.Page, command.PageSize);+ var gridModel = new DataSourceResult {+ Data = products.ToList(),+ Total = totalCount+ };+ return Json(gridModel);+ }- if (ModelState.IsValid)- {- await productAttributeService.DeleteProductAttributeValue(pav, productId, pam);- return new JsonResult("");- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> AssociateProductToAttributeValuePopup(+ ProductModel.ProductAttributeValueModel.AssociateProductToAttributeValueModel model)+ {+ var associatedProduct = await _productService.GetProductById(model.AssociatedToProductId);+ if (associatedProduct == null || associatedProduct.VendorId != _workContext.CurrentVendor.Id)+ return Content("Cannot load a product");- return ErrorForKendoGridJson(ModelState);- }+ return Content("");+ }- public async Task<IActionResult> AssociateProductToAttributeValuePopup()- {- var model = await _productViewModelService.PrepareAssociateProductToAttributeValueModel();- return View(model);- }+ #endregion- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> AssociateProductToAttributeValuePopupList(DataSourceRequest command,- ProductModel.ProductAttributeValueModel.AssociateProductToAttributeValueModel model)- {- var (products, totalCount) =- await _productViewModelService.PrepareProductModel(model, command.Page, command.PageSize);- var gridModel = new DataSourceResult {- Data = products.ToList(),- Total = totalCount- };- return Json(gridModel);- }+ #region Product attribute combinations- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> AssociateProductToAttributeValuePopup(- ProductModel.ProductAttributeValueModel.AssociateProductToAttributeValueModel model)- {- var associatedProduct = await _productService.GetProductById(model.AssociatedToProductId);- if (associatedProduct == null || associatedProduct.VendorId != _workContext.CurrentVendor.Id)- return Content("Cannot load a product");+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> ProductAttributeCombinationList(string productId)+ {+ var product = await _productService.GetProductById(productId);++ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return ErrorForKendoGridJson(permission.message);++ var combinationsModel = await _productViewModelService.PrepareProductAttributeCombinationModel(product);+ var gridModel = new DataSourceResult {+ Data = combinationsModel,+ Total = combinationsModel.Count+ };+ return Json(gridModel);+ }- return Content("");- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductAttributeCombinationDelete(string id, string productId,+ [FromServices] IProductAttributeService productAttributeService)+ {+ var product = await _productService.GetProductById(productId);+ if (product == null || product.VendorId != _workContext.CurrentVendor.Id)+ throw new ArgumentException("No product found with the specified id");- #endregion+ var combination = product.ProductAttributeCombinations.FirstOrDefault(x => x.Id == id);+ if (combination == null)+ throw new ArgumentException("No product attribute combination found with the specified id");- #region Product attribute combinations+ await productAttributeService.DeleteProductAttributeCombination(combination, productId);- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> ProductAttributeCombinationList(string productId)+ if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByAttributes){- var product = await _productService.GetProductById(productId);-- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return ErrorForKendoGridJson(permission.message);-- var combinationsModel = await _productViewModelService.PrepareProductAttributeCombinationModel(product);- var gridModel = new DataSourceResult {- Data = combinationsModel,- Total = combinationsModel.Count- };- return Json(gridModel);+ var pr = await _productService.GetProductById(productId);+ pr.StockQuantity = pr.ProductAttributeCombinations.Sum(x => x.StockQuantity);+ pr.ReservedQuantity = pr.ProductAttributeCombinations.Sum(x => x.ReservedQuantity);+ await _inventoryManageService.UpdateStockProduct(pr, false);}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductAttributeCombinationDelete(string id, string productId,- [FromServices] IProductAttributeService productAttributeService)- {- var product = await _productService.GetProductById(productId);- if (product == null || product.VendorId != _workContext.CurrentVendor.Id)- throw new ArgumentException("No product found with the specified id");+ return new JsonResult("");+ }- var combination = product.ProductAttributeCombinations.FirstOrDefault(x => x.Id == id);- if (combination == null)- throw new ArgumentException("No product attribute combination found with the specified id");+ //edit+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> AttributeCombinationPopup(string productId, string id)+ {+ var product = await _productService.GetProductById(productId);- await productAttributeService.DeleteProductAttributeCombination(combination, productId);+ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return Content(permission.message);- if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByAttributes)- {- var pr = await _productService.GetProductById(productId);- pr.StockQuantity = pr.ProductAttributeCombinations.Sum(x => x.StockQuantity);- pr.ReservedQuantity = pr.ProductAttributeCombinations.Sum(x => x.ReservedQuantity);- await _inventoryManageService.UpdateStockProduct(pr, false);- }+ var model = await _productViewModelService.PrepareProductAttributeCombinationModel(product, id);+ await _productViewModelService.PrepareAddProductAttributeCombinationModel(model, product);+ return View(model);+ }- return new JsonResult("");- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> AttributeCombinationPopup(string productId,+ ProductAttributeCombinationModel model)+ {+ var product = await _productService.GetProductById(productId);+ if (product == null || product.VendorId != _workContext.CurrentVendor.Id)+ //No product found with the specified id+ return RedirectToAction("List", "Product");- //edit- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> AttributeCombinationPopup(string productId, string id)- {- var product = await _productService.GetProductById(productId);+ var warnings =+ await _productViewModelService.InsertOrUpdateProductAttributeCombinationPopup(product, model);+ if (!warnings.Any()) return Content("");- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return Content(permission.message);+ //If we got this far, something failed, redisplay form+ await _productViewModelService.PrepareAddProductAttributeCombinationModel(model, product);+ model.Warnings = warnings;+ return View(model);+ }- var model = await _productViewModelService.PrepareProductAttributeCombinationModel(product, id);- await _productViewModelService.PrepareAddProductAttributeCombinationModel(model, product);- return View(model);- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> GenerateAllAttributeCombinations(string productId)+ {+ var product = await _productService.GetProductById(productId);+ if (product == null || product.VendorId != _workContext.CurrentVendor.Id)+ throw new ArgumentException("No product found with the specified id");- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> AttributeCombinationPopup(string productId,- ProductAttributeCombinationModel model)+ await _productViewModelService.GenerateAllAttributeCombinations(product);++ return Json(new { Success = true });+ }++ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ClearAllAttributeCombinations(string productId)+ {+ var product = await _productService.GetProductById(productId);+ if (product == null || product.VendorId != _workContext.CurrentVendor.Id)+ throw new ArgumentException("No product found with the specified id");++ if (ModelState.IsValid){- var product = await _productService.GetProductById(productId);- if (product == null || product.VendorId != _workContext.CurrentVendor.Id)- //No product found with the specified id- return RedirectToAction("List", "Product");+ await _productViewModelService.ClearAllAttributeCombinations(product);- var warnings =- await _productViewModelService.InsertOrUpdateProductAttributeCombinationPopup(product, model);- if (!warnings.Any())+ if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByAttributes){- return Content("");+ product.StockQuantity = 0;+ product.ReservedQuantity = 0;+ await _inventoryManageService.UpdateStockProduct(product, false);}- //If we got this far, something failed, redisplay form- await _productViewModelService.PrepareAddProductAttributeCombinationModel(model, product);- model.Warnings = warnings;- return View(model);+ return Json(new { Success = true });}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> GenerateAllAttributeCombinations(string productId)- {- var product = await _productService.GetProductById(productId);- if (product == null || product.VendorId != _workContext.CurrentVendor.Id)- throw new ArgumentException("No product found with the specified id");+ return ErrorForKendoGridJson(ModelState);+ }- await _productViewModelService.GenerateAllAttributeCombinations(product);+ #region Product Attribute combination - tier prices- return Json(new { Success = true });- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductAttributeCombinationTierPriceList(string productId,+ string productAttributeCombinationId)+ {+ var product = await _productService.GetProductById(productId);- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ClearAllAttributeCombinations(string productId)- {- var product = await _productService.GetProductById(productId);- if (product == null || product.VendorId != _workContext.CurrentVendor.Id)- throw new ArgumentException("No product found with the specified id");+ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return ErrorForKendoGridJson(permission.message);- if (ModelState.IsValid)- {- await _productViewModelService.ClearAllAttributeCombinations(product);+ var tierPriceModel =+ await _productViewModelService.PrepareProductAttributeCombinationTierPricesModel(product,+ productAttributeCombinationId);+ var gridModel = new DataSourceResult {+ Data = tierPriceModel,+ Total = tierPriceModel.Count+ };- if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByAttributes)- {- product.StockQuantity = 0;- product.ReservedQuantity = 0;- await _inventoryManageService.UpdateStockProduct(product, false);- }+ return Json(gridModel);+ }- return Json(new { Success = true });- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductAttributeCombinationTierPriceInsert(+ ProductModel.ProductAttributeCombinationTierPricesModel model)+ {+ if (ModelState.IsValid)+ {+ var product = await _productService.GetProductById(model.ProductId);+ var combination =+ product.ProductAttributeCombinations.FirstOrDefault(+ x => x.Id == model.ProductAttributeCombinationId);+ if (combination != null)+ await _productViewModelService.InsertProductAttributeCombinationTierPricesModel(product,+ combination, model);- return ErrorForKendoGridJson(ModelState);+ return new JsonResult("");}- #region Product Attribute combination - tier prices+ return ErrorForKendoGridJson(ModelState);+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductAttributeCombinationTierPriceList(string productId, string productAttributeCombinationId)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductAttributeCombinationTierPriceUpdate(+ ProductModel.ProductAttributeCombinationTierPricesModel model)+ {+ if (ModelState.IsValid){- var product = await _productService.GetProductById(productId);+ var product = await _productService.GetProductById(model.ProductId);+ var combination =+ product.ProductAttributeCombinations.FirstOrDefault(x => x.Id == model.ProductAttributeCombinationId);+ if (combination != null)+ await _productViewModelService.UpdateProductAttributeCombinationTierPricesModel(product, combination,+ model);++ return new JsonResult("");+ }- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return ErrorForKendoGridJson(permission.message);+ return ErrorForKendoGridJson(ModelState);+ }- var tierPriceModel =- await _productViewModelService.PrepareProductAttributeCombinationTierPricesModel(product,- productAttributeCombinationId);- var gridModel = new DataSourceResult {- Data = tierPriceModel,- Total = tierPriceModel.Count- };+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductAttributeCombinationTierPriceDelete(string productId,+ string productAttributeCombinationId, string id)+ {+ var product = await _productService.GetProductById(productId);+ if (product == null || product.VendorId != _workContext.CurrentVendor.Id)+ throw new ArgumentException("No product found with the specified id");- return Json(gridModel);+ var combination =+ product.ProductAttributeCombinations.FirstOrDefault(x => x.Id == productAttributeCombinationId);+ if (combination != null)+ {+ var tierPrice = combination.TierPrices.FirstOrDefault(x => x.Id == id);+ if (tierPrice != null)+ await _productViewModelService.DeleteProductAttributeCombinationTierPrices(product, combination,+ tierPrice);}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductAttributeCombinationTierPriceInsert(- ProductModel.ProductAttributeCombinationTierPricesModel model)- {- if (ModelState.IsValid)- {- var product = await _productService.GetProductById(model.ProductId);- var combination =- product.ProductAttributeCombinations.FirstOrDefault(- x => x.Id == model.ProductAttributeCombinationId);- if (combination != null)- await _productViewModelService.InsertProductAttributeCombinationTierPricesModel(product,- combination, model);+ return new JsonResult("");+ }- return new JsonResult("");- }+ #endregion- return ErrorForKendoGridJson(ModelState);- }+ #endregion- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductAttributeCombinationTierPriceUpdate(- ProductModel.ProductAttributeCombinationTierPricesModel model)- {- if (ModelState.IsValid)- {- var product = await _productService.GetProductById(model.ProductId);- var combination = product.ProductAttributeCombinations.FirstOrDefault(x => x.Id == model.ProductAttributeCombinationId);- if (combination != null)- await _productViewModelService.UpdateProductAttributeCombinationTierPricesModel(product, combination, model);+ #region Reservation- return new JsonResult("");- }+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> ListReservations(DataSourceRequest command, string productId)+ {+ var product = await _productService.GetProductById(productId);++ var permission = await CheckAccessToProduct(product);+ if (!permission.allow)+ return ErrorForKendoGridJson(permission.message);++ var reservations =+ await _productReservationService.GetProductReservationsByProductId(productId, null, null,+ command.Page - 1, command.PageSize);+ var reservationModel = reservations+ .Select(x => new ProductModel.ReservationModel {+ ReservationId = x.Id,+ Date = x.Date,+ OrderId = x.OrderId,+ ProductId = x.ProductId,+ Parameter = x.Parameter,+ Resource = x.Resource,+ Duration = x.Duration+ }).ToList();++ var gridModel = new DataSourceResult {+ Data = reservationModel,+ Total = reservations.TotalCount+ };++ return Json(gridModel);+ }- return ErrorForKendoGridJson(ModelState);- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> GenerateCalendar(ProductModel.GenerateCalendarModel model)+ {+ var product = await _productService.GetProductById(model.ProductId);+ if (product == null || product.VendorId != _workContext.CurrentVendor.Id)+ throw new ArgumentException("No product found with the specified id");++ var reservations =+ await _productReservationService.GetProductReservationsByProductId(model.ProductId, null, null);+ if (reservations.Any())+ if ((product.IntervalUnitId is IntervalUnit.Minute or IntervalUnit.Hour &&+ (IntervalUnit)model.Interval == IntervalUnit.Day) ||+ (product.IntervalUnitId == IntervalUnit.Day &&+ ((IntervalUnit)model.IntervalUnit == IntervalUnit.Minute ||+ (IntervalUnit)model.IntervalUnit == IntervalUnit.Hour)))+ return Json(new {+ errors = _translationService.GetResource(+ "Vendor.Catalog.Products.Calendar.CannotChangeInterval")+ });- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductAttributeCombinationTierPriceDelete(string productId,- string productAttributeCombinationId, string id)+ if (!ModelState.IsValid){- var product = await _productService.GetProductById(productId);- if (product == null || product.VendorId != _workContext.CurrentVendor.Id)- throw new ArgumentException("No product found with the specified id");-- var combination =- product.ProductAttributeCombinations.FirstOrDefault(x => x.Id == productAttributeCombinationId);- if (combination != null)+ var error =+ (Dictionary<string, Dictionary<string, object>>)ModelState.SerializeErrors();+ var s = "";+ foreach (var error1 in error)+ foreach (var error2 in error1.Value){- var tierPrice = combination.TierPrices.FirstOrDefault(x => x.Id == id);- if (tierPrice != null)- {- await _productViewModelService.DeleteProductAttributeCombinationTierPrices(product, combination,- tierPrice);- }+ var v = (string[])error2.Value;+ s += v[0] + "\n";}- return new JsonResult("");+ return Json(new { errors = s });}- #endregion+ //update fields on product+ await _productService.UpdateProductField(product, x => x.Interval, model.Interval);+ await _productService.UpdateProductField(product, x => x.IntervalUnitId, (IntervalUnit)model.IntervalUnit);+ await _productService.UpdateProductField(product, x => x.IncBothDate, model.IncBothDate);- #endregion+ var minutesToAdd = (IntervalUnit)model.IntervalUnit switch {+ IntervalUnit.Minute => model.Interval,+ IntervalUnit.Hour => model.Interval * 60,+ IntervalUnit.Day => model.Interval * 60 * 24,+ _ => 0+ };- #region Reservation-- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> ListReservations(DataSourceRequest command, string productId)+ var _hourFrom = model.StartTime.Hour;+ var _minutesFrom = model.StartTime.Minute;+ var _hourTo = model.EndTime.Hour;+ var _minutesTo = model.EndTime.Minute;+ var _dateFrom = new DateTime(model.StartDate.Value.Year, model.StartDate.Value.Month,+ model.StartDate.Value.Day, 0, 0, 0, 0);+ var _dateTo = new DateTime(model.EndDate.Value.Year, model.EndDate.Value.Month,+ model.EndDate.Value.Day, 23, 59, 59, 999);+ if ((IntervalUnit)model.IntervalUnit == IntervalUnit.Day){- var product = await _productService.GetProductById(productId);-- var permission = await CheckAccessToProduct(product);- if (!permission.allow)- return ErrorForKendoGridJson(permission.message);-- var reservations =- await _productReservationService.GetProductReservationsByProductId(productId, null, null,- command.Page - 1, command.PageSize);- var reservationModel = reservations- .Select(x => new ProductModel.ReservationModel {- ReservationId = x.Id,- Date = x.Date,- OrderId = x.OrderId,- ProductId = x.ProductId,- Parameter = x.Parameter,- Resource = x.Resource,- Duration = x.Duration- }).ToList();-- var gridModel = new DataSourceResult {- Data = reservationModel,- Total = reservations.TotalCount- };-- return Json(gridModel);+ model.Quantity = 1;+ model.Parameter = "";}-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> GenerateCalendar(ProductModel.GenerateCalendarModel model)+ else{- var product = await _productService.GetProductById(model.ProductId);- if (product == null || product.VendorId != _workContext.CurrentVendor.Id)- throw new ArgumentException("No product found with the specified id");+ model.Resource = "";+ }- var reservations =- await _productReservationService.GetProductReservationsByProductId(model.ProductId, null, null);- if (reservations.Any())+ var dates = new List<DateTime>();+ var counter = 0;+ for (var iterator = _dateFrom; iterator <= _dateTo; iterator += new TimeSpan(0, minutesToAdd, 0))+ {+ if ((IntervalUnit)model.IntervalUnit != IntervalUnit.Day){- if ((product.IntervalUnitId is IntervalUnit.Minute or IntervalUnit.Hour &&- (IntervalUnit)model.Interval == IntervalUnit.Day) ||- product.IntervalUnitId == IntervalUnit.Day &&- ((IntervalUnit)model.IntervalUnit == IntervalUnit.Minute ||- (IntervalUnit)model.IntervalUnit == IntervalUnit.Hour))+ if (iterator.Hour >= _hourFrom && iterator.Hour <= _hourTo){- return Json(new {- errors = _translationService.GetResource(- "Vendor.Catalog.Products.Calendar.CannotChangeInterval")- });- }- }+ if (iterator.Hour == _hourTo)+ if (iterator.Minute > _minutesTo)+ continue;- if (!ModelState.IsValid)- {- Dictionary<string, Dictionary<string, object>> error =- (Dictionary<string, Dictionary<string, object>>)ModelState.SerializeErrors();- var s = "";- foreach (var error1 in error)+ if (iterator.Hour == _hourFrom)+ if (iterator.Minute < _minutesFrom)+ continue;+ }+ else{- foreach (var error2 in error1.Value)- {- var v = (string[])error2.Value;- s += v[0] + "\n";- }+ continue;}-- return Json(new { errors = s });}- //update fields on product- await _productService.UpdateProductField(product, x => x.Interval, model.Interval);- await _productService.UpdateProductField(product, x => x.IntervalUnitId, (IntervalUnit)model.IntervalUnit);- await _productService.UpdateProductField(product, x => x.IncBothDate, model.IncBothDate);-- var minutesToAdd = (IntervalUnit)model.IntervalUnit switch {- IntervalUnit.Minute => model.Interval,- IntervalUnit.Hour => model.Interval * 60,- IntervalUnit.Day => model.Interval * 60 * 24,- _ => 0- };-- var _hourFrom = model.StartTime.Hour;- var _minutesFrom = model.StartTime.Minute;- var _hourTo = model.EndTime.Hour;- var _minutesTo = model.EndTime.Minute;- DateTime _dateFrom = new DateTime(model.StartDate.Value.Year, model.StartDate.Value.Month,- model.StartDate.Value.Day, 0, 0, 0, 0);- DateTime _dateTo = new DateTime(model.EndDate.Value.Year, model.EndDate.Value.Month,- model.EndDate.Value.Day, 23, 59, 59, 999);- if ((IntervalUnit)model.IntervalUnit == IntervalUnit.Day)- {- model.Quantity = 1;- model.Parameter = "";- }- else- {- model.Resource = "";- }+ if ((iterator.DayOfWeek == DayOfWeek.Monday && !model.Monday) ||+ (iterator.DayOfWeek == DayOfWeek.Tuesday && !model.Tuesday) ||+ (iterator.DayOfWeek == DayOfWeek.Wednesday && !model.Wednesday) ||+ (iterator.DayOfWeek == DayOfWeek.Thursday && !model.Thursday) ||+ (iterator.DayOfWeek == DayOfWeek.Friday && !model.Friday) ||+ (iterator.DayOfWeek == DayOfWeek.Saturday && !model.Saturday) ||+ (iterator.DayOfWeek == DayOfWeek.Sunday && !model.Sunday))+ continue;- List<DateTime> dates = new List<DateTime>();- var counter = 0;- for (DateTime iterator = _dateFrom; iterator <= _dateTo; iterator += new TimeSpan(0, minutesToAdd, 0))+ for (var i = 0; i < model.Quantity; i++){- if ((IntervalUnit)model.IntervalUnit != IntervalUnit.Day)+ dates.Add(iterator);+ try{- if (iterator.Hour >= _hourFrom && iterator.Hour <= _hourTo)- {- if (iterator.Hour == _hourTo)- {- if (iterator.Minute > _minutesTo)- {- continue;- }- }-- if (iterator.Hour == _hourFrom)- {- if (iterator.Minute < _minutesFrom)- {- continue;- }- }- }- else+ var insert = true;+ if ((IntervalUnit)model.IntervalUnit == IntervalUnit.Day)+ if (reservations.Any(x => x.Resource == model.Resource && x.Date == iterator))+ insert = false;++ if (insert){- continue;+ if (counter++ > 1000)+ break;++ await _productReservationService.InsertProductReservation(new ProductReservation {+ OrderId = "",+ Date = iterator,+ ProductId = model.ProductId,+ Resource = model.Resource,+ Parameter = model.Parameter,+ Duration = model.Interval + " " ++ ((IntervalUnit)model.IntervalUnit).GetTranslationEnum(_translationService,+ _workContext)+ });}}-- if ((iterator.DayOfWeek == DayOfWeek.Monday && !model.Monday) ||- (iterator.DayOfWeek == DayOfWeek.Tuesday && !model.Tuesday) ||- (iterator.DayOfWeek == DayOfWeek.Wednesday && !model.Wednesday) ||- (iterator.DayOfWeek == DayOfWeek.Thursday && !model.Thursday) ||- (iterator.DayOfWeek == DayOfWeek.Friday && !model.Friday) ||- (iterator.DayOfWeek == DayOfWeek.Saturday && !model.Saturday) ||- (iterator.DayOfWeek == DayOfWeek.Sunday && !model.Sunday))- {- continue;- }-- for (var i = 0; i < model.Quantity; i++)+ catch{- dates.Add(iterator);- try- {- var insert = true;- if ((IntervalUnit)model.IntervalUnit == IntervalUnit.Day)- {- if (reservations.Any(x => x.Resource == model.Resource && x.Date == iterator))- insert = false;- }-- if (insert)- {- if (counter++ > 1000)- break;-- await _productReservationService.InsertProductReservation(new ProductReservation {- OrderId = "",- Date = iterator,- ProductId = model.ProductId,- Resource = model.Resource,- Parameter = model.Parameter,- Duration = model.Interval + " " +- ((IntervalUnit)model.IntervalUnit).GetTranslationEnum(_translationService,- _workContext)- });- }- }- catch- {- // ignored- }+ // ignored}}-- return Json(new { success = true });}- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> ClearCalendar(string productId)- {- var product = await _productService.GetProductById(productId);- if (product == null || product.VendorId != _workContext.CurrentVendor.Id)- throw new ArgumentException("No product found with the specified id");+ return Json(new { success = true });+ }- var toDelete = await _productReservationService.GetProductReservationsByProductId(productId, true, null);- foreach (var record in toDelete)- {- await _productReservationService.DeleteProductReservation(record);- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> ClearCalendar(string productId)+ {+ var product = await _productService.GetProductById(productId);+ if (product == null || product.VendorId != _workContext.CurrentVendor.Id)+ throw new ArgumentException("No product found with the specified id");- return Json("");- }+ var toDelete = await _productReservationService.GetProductReservationsByProductId(productId, true, null);+ foreach (var record in toDelete) await _productReservationService.DeleteProductReservation(record);- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> ClearOld(string productId)- {- var product = await _productService.GetProductById(productId);- if (product == null || product.VendorId != _workContext.CurrentVendor.Id)- throw new ArgumentException("No product found with the specified id");+ return Json("");+ }- var toDelete =- (await _productReservationService.GetProductReservationsByProductId(productId, true, null)).Where(x =>- x.Date < DateTime.UtcNow);- foreach (var record in toDelete)- {- await _productReservationService.DeleteProductReservation(record);- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> ClearOld(string productId)+ {+ var product = await _productService.GetProductById(productId);+ if (product == null || product.VendorId != _workContext.CurrentVendor.Id)+ throw new ArgumentException("No product found with the specified id");- return Json("");- }+ var toDelete =+ (await _productReservationService.GetProductReservationsByProductId(productId, true, null)).Where(x =>+ x.Date < DateTime.UtcNow);+ foreach (var record in toDelete) await _productReservationService.DeleteProductReservation(record);- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> ProductReservationDelete(ProductModel.ReservationModel model)- {- var product = await _productService.GetProductById(model.ProductId);- if (product == null || product.VendorId != _workContext.CurrentVendor.Id)- throw new ArgumentException("No product found with the specified id");+ return Json("");+ }- var toDelete = await _productReservationService.GetProductReservation(model.ReservationId);- if (toDelete != null)- {- if (string.IsNullOrEmpty(toDelete.OrderId))- await _productReservationService.DeleteProductReservation(toDelete);- else- return Json(new DataSourceResult {- Errors = _translationService.GetResource(- "Vendor.Catalog.ProductReservations.CantDeleteWithOrder")- });- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> ProductReservationDelete(ProductModel.ReservationModel model)+ {+ var product = await _productService.GetProductById(model.ProductId);+ if (product == null || product.VendorId != _workContext.CurrentVendor.Id)+ throw new ArgumentException("No product found with the specified id");- return Json("");+ var toDelete = await _productReservationService.GetProductReservation(model.ReservationId);+ if (toDelete != null)+ {+ if (string.IsNullOrEmpty(toDelete.OrderId))+ await _productReservationService.DeleteProductReservation(toDelete);+ else+ return Json(new DataSourceResult {+ Errors = _translationService.GetResource(+ "Vendor.Catalog.ProductReservations.CantDeleteWithOrder")+ });}- #endregion+ return Json("");+ }- #region Bids+ #endregion- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> ListBids(DataSourceRequest command, string productId)- {- var product = await _productService.GetProductById(productId);- if (product == null || product.VendorId != _workContext.CurrentVendor.Id)- throw new ArgumentException("No product found with the specified id");+ #region Bids- var (bidModels, totalCount) =- await _productViewModelService.PrepareBidMode(productId, command.Page, command.PageSize);- var gridModel = new DataSourceResult {- Data = bidModels.ToList(),- Total = totalCount- };- return Json(gridModel);- }+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> ListBids(DataSourceRequest command, string productId)+ {+ var product = await _productService.GetProductById(productId);+ if (product == null || product.VendorId != _workContext.CurrentVendor.Id)+ throw new ArgumentException("No product found with the specified id");++ var (bidModels, totalCount) =+ await _productViewModelService.PrepareBidMode(productId, command.Page, command.PageSize);+ var gridModel = new DataSourceResult {+ Data = bidModels.ToList(),+ Total = totalCount+ };+ return Json(gridModel);+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> BidDelete(ProductModel.BidModel model)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> BidDelete(ProductModel.BidModel model)+ {+ var product = await _productService.GetProductById(model.ProductId);+ if (product == null || product.VendorId != _workContext.CurrentVendor.Id)+ throw new ArgumentException("No product found with the specified id");++ var toDelete = await _auctionService.GetBid(model.BidId);+ if (toDelete != null){- var product = await _productService.GetProductById(model.ProductId);- if (product == null || product.VendorId != _workContext.CurrentVendor.Id)- throw new ArgumentException("No product found with the specified id");-- var toDelete = await _auctionService.GetBid(model.BidId);- if (toDelete != null)+ if (string.IsNullOrEmpty(toDelete.OrderId)){- if (string.IsNullOrEmpty(toDelete.OrderId))- {- //delete bid- await _auctionService.DeleteBid(toDelete);- return Json("");- }-- return Json(new DataSourceResult- { Errors = _translationService.GetResource("Vendor.Catalog.Products.Bids.CantDeleteWithOrder") });+ //delete bid+ await _auctionService.DeleteBid(toDelete);+ return Json("");}- return Json(new DataSourceResult { Errors = "Bid not exists" });+ return Json(new DataSourceResult+ { Errors = _translationService.GetResource("Vendor.Catalog.Products.Bids.CantDeleteWithOrder") });}- #endregion-- #endregion+ return Json(new DataSourceResult { Errors = "Bid not exists" });}++ #endregion++ #endregion}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Controllers/ReportsController.cs b/src/Web/Grand.Web.Vendor/Controllers/ReportsController.csindex 2984fdfa0..b80898884 100644--- a/src/Web/Grand.Web.Vendor/Controllers/ReportsController.cs+++ b/src/Web/Grand.Web.Vendor/Controllers/ReportsController.cs@@ -1,12 +1,12 @@-using Grand.Business.Core.Interfaces.Catalog.Prices;+using Grand.Business.Core.Extensions;+using Grand.Business.Core.Interfaces.Catalog.Prices;using Grand.Business.Core.Interfaces.Catalog.Products;using Grand.Business.Core.Interfaces.Checkout.Orders;-using Grand.Business.Core.Extensions;using Grand.Business.Core.Interfaces.Common.Directory;using Grand.Business.Core.Interfaces.Common.Localization;-using Grand.Business.Core.Utilities.Common.Security;using Grand.Business.Core.Interfaces.Customers;using Grand.Business.Core.Interfaces.System.Reports;+using Grand.Business.Core.Utilities.Common.Security;using Grand.Domain.Payments;using Grand.Infrastructure;using Grand.Web.Common.DataSource;@@ -16,351 +16,378 @@ using Grand.Web.Vendor.Models.Report;using Microsoft.AspNetCore.Mvc;using Microsoft.AspNetCore.Mvc.Rendering;-namespace Grand.Web.Vendor.Controllers+namespace Grand.Web.Vendor.Controllers;++[PermissionAuthorize(PermissionSystemName.Reports)]+public class ReportsController : BaseVendorController{- [PermissionAuthorize(PermissionSystemName.Reports)]- public class ReportsController : BaseVendorController+ private readonly ICountryService _countryService;+ private readonly ICurrencyService _currencyService;+ private readonly ICustomerReportService _customerReportService;+ private readonly ICustomerService _customerService;+ private readonly IDateTimeService _dateTimeService;+ private readonly IOrderReportService _orderReportService;+ private readonly IOrderStatusService _orderStatusService;+ private readonly IPriceFormatter _priceFormatter;+ private readonly IProductAttributeFormatter _productAttributeFormatter;+ private readonly IProductService _productService;+ private readonly IProductsReportService _productsReportService;+ private readonly IStockQuantityService _stockQuantityService;+ private readonly ITranslationService _translationService;+ private readonly IWorkContext _workContext;++ public ReportsController(IOrderReportService orderReportService,+ IProductsReportService productsReportService,+ ICustomerReportService customerReportService,+ IWorkContext workContext,+ IPriceFormatter priceFormatter,+ IProductService productService,+ IProductAttributeFormatter productAttributeFormatter,+ IStockQuantityService stockQuantityService,+ ITranslationService translationService,+ ICountryService countryService,+ IDateTimeService dateTimeService,+ IOrderStatusService orderStatusService,+ ICurrencyService currencyService,+ ICustomerService customerService){- private readonly ICustomerService _customerService;- private readonly IOrderReportService _orderReportService;- private readonly IProductsReportService _productsReportService;- private readonly ICustomerReportService _customerReportService;- private readonly IWorkContext _workContext;- private readonly IPriceFormatter _priceFormatter;- private readonly IProductService _productService;- private readonly IProductAttributeFormatter _productAttributeFormatter;- private readonly IStockQuantityService _stockQuantityService;- private readonly ITranslationService _translationService;- private readonly ICountryService _countryService;- private readonly IDateTimeService _dateTimeService;- private readonly IOrderStatusService _orderStatusService;- private readonly ICurrencyService _currencyService;-- public ReportsController(IOrderReportService orderReportService,- IProductsReportService productsReportService,- ICustomerReportService customerReportService,- IWorkContext workContext,- IPriceFormatter priceFormatter,- IProductService productService,- IProductAttributeFormatter productAttributeFormatter,- IStockQuantityService stockQuantityService,- ITranslationService translationService,- ICountryService countryService,- IDateTimeService dateTimeService,- IOrderStatusService orderStatusService,- ICurrencyService currencyService,- ICustomerService customerService)- {- _orderReportService = orderReportService;- _productsReportService = productsReportService;- _customerReportService = customerReportService;- _workContext = workContext;- _priceFormatter = priceFormatter;- _productService = productService;- _productAttributeFormatter = productAttributeFormatter;- _stockQuantityService = stockQuantityService;- _translationService = translationService;- _countryService = countryService;- _dateTimeService = dateTimeService;- _orderStatusService = orderStatusService;- _currencyService = currencyService;- _customerService = customerService;- }+ _orderReportService = orderReportService;+ _productsReportService = productsReportService;+ _customerReportService = customerReportService;+ _workContext = workContext;+ _priceFormatter = priceFormatter;+ _productService = productService;+ _productAttributeFormatter = productAttributeFormatter;+ _stockQuantityService = stockQuantityService;+ _translationService = translationService;+ _countryService = countryService;+ _dateTimeService = dateTimeService;+ _orderStatusService = orderStatusService;+ _currencyService = currencyService;+ _customerService = customerService;+ }- [NonAction]- private async Task<DataSourceResult> GetBestsellersBriefReportModel(int pageIndex,- int pageSize, int orderBy)+ [NonAction]+ private async Task<DataSourceResult> GetBestsellersBriefReportModel(int pageIndex,+ int pageSize, int orderBy)+ {+ var items = await _orderReportService.BestSellersReport(+ vendorId: _workContext.CurrentVendor.Id,+ orderBy: orderBy,+ pageIndex: pageIndex,+ pageSize: pageSize,+ showHidden: true);+ var result = new List<BestsellersReportLineModel>();+ foreach (var x in items){- var items = await _orderReportService.BestSellersReport(- vendorId: _workContext.CurrentVendor.Id,- orderBy: orderBy,- pageIndex: pageIndex,- pageSize: pageSize,- showHidden: true);- var result = new List<BestsellersReportLineModel>();- foreach (var x in items)- {- var m = new BestsellersReportLineModel {- ProductId = x.ProductId,- TotalAmount = _priceFormatter.FormatPrice(x.TotalAmount, await _currencyService.GetPrimaryStoreCurrency()),- TotalQuantity = x.TotalQuantity- };- var product = await _productService.GetProductById(x.ProductId);- if (product != null)- m.ProductName = product.Name;- result.Add(m);- }-- var gridModel = new DataSourceResult {- Data = result,- Total = items.TotalCount+ var m = new BestsellersReportLineModel {+ ProductId = x.ProductId,+ TotalAmount =+ _priceFormatter.FormatPrice(x.TotalAmount, await _currencyService.GetPrimaryStoreCurrency()),+ TotalQuantity = x.TotalQuantity};- return gridModel;+ var product = await _productService.GetProductById(x.ProductId);+ if (product != null)+ m.ProductName = product.Name;+ result.Add(m);}- [HttpPost]- public async Task<IActionResult> BestsellersBriefReportByQuantityList(DataSourceRequest command)- {- var gridModel = await GetBestsellersBriefReportModel(command.Page - 1,- command.PageSize, 1);-- return Json(gridModel);- }+ var gridModel = new DataSourceResult {+ Data = result,+ Total = items.TotalCount+ };+ return gridModel;+ }- [HttpPost]- public async Task<IActionResult> BestsellersBriefReportByAmountList(DataSourceRequest command)- {- var gridModel = await GetBestsellersBriefReportModel(command.Page - 1,- command.PageSize, 2);+ [HttpPost]+ public async Task<IActionResult> BestsellersBriefReportByQuantityList(DataSourceRequest command)+ {+ var gridModel = await GetBestsellersBriefReportModel(command.Page - 1,+ command.PageSize, 1);- return Json(gridModel);- }+ return Json(gridModel);+ }- public async Task<IActionResult> BestsellersReport()- {- var model = new BestsellersReportModel {- //payment statuses- AvailablePaymentStatuses = PaymentStatus.Pending.ToSelectList(HttpContext, false).ToList()- };- model.AvailablePaymentStatuses.Insert(0, new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = "" });+ [HttpPost]+ public async Task<IActionResult> BestsellersBriefReportByAmountList(DataSourceRequest command)+ {+ var gridModel = await GetBestsellersBriefReportModel(command.Page - 1,+ command.PageSize, 2);- //billing countries- foreach (var c in await _countryService.GetAllCountriesForBilling(showHidden: true))- {- model.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id });- }- model.AvailableCountries.Insert(0, new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = "" });+ return Json(gridModel);+ }- return View(model);- }+ public async Task<IActionResult> BestsellersReport()+ {+ var model = new BestsellersReportModel {+ //payment statuses+ AvailablePaymentStatuses = PaymentStatus.Pending.ToSelectList(HttpContext, false).ToList()+ };+ model.AvailablePaymentStatuses.Insert(0,+ new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = "" });++ //billing countries+ foreach (var c in await _countryService.GetAllCountriesForBilling(showHidden: true))+ model.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id });+ model.AvailableCountries.Insert(0,+ new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = "" });++ return View(model);+ }- [HttpPost]- public async Task<IActionResult> BestsellersReportList(DataSourceRequest command, BestsellersReportModel model)+ [HttpPost]+ public async Task<IActionResult> BestsellersReportList(DataSourceRequest command, BestsellersReportModel model)+ {+ DateTime? startDateValue = model.StartDate == null+ ? null+ : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);++ DateTime? endDateValue = model.EndDate == null+ ? null+ : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);++ var paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)model.PaymentStatusId : null;++ var items = await _orderReportService.BestSellersReport(+ createdFromUtc: startDateValue,+ createdToUtc: endDateValue,+ ps: paymentStatus,+ billingCountryId: model.BillingCountryId,+ orderBy: 2,+ vendorId: _workContext.CurrentVendor.Id,+ pageIndex: command.Page - 1,+ pageSize: command.PageSize,+ showHidden: true,+ storeId: model.StoreId);++ var result = new List<BestsellersReportLineModel>();+ foreach (var x in items){- DateTime? startDateValue = model.StartDate == null ? null- : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);-- DateTime? endDateValue = model.EndDate == null ? null- : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);-- PaymentStatus? paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)model.PaymentStatusId : null;-- var items = await _orderReportService.BestSellersReport(- createdFromUtc: startDateValue,- createdToUtc: endDateValue,- ps: paymentStatus,- billingCountryId: model.BillingCountryId,- orderBy: 2,- vendorId: _workContext.CurrentVendor.Id,- pageIndex: command.Page - 1,- pageSize: command.PageSize,- showHidden: true,- storeId: model.StoreId);-- var result = new List<BestsellersReportLineModel>();- foreach (var x in items)+ var m = new BestsellersReportLineModel {+ ProductId = x.ProductId,+ TotalAmount =+ _priceFormatter.FormatPrice(x.TotalAmount, await _currencyService.GetPrimaryStoreCurrency()),+ TotalQuantity = x.TotalQuantity+ };+ var product = await _productService.GetProductById(x.ProductId);+ if (product != null)+ m.ProductName = product.Name;+ if (_workContext.CurrentVendor != null){- var m = new BestsellersReportLineModel {- ProductId = x.ProductId,- TotalAmount = _priceFormatter.FormatPrice(x.TotalAmount, await _currencyService.GetPrimaryStoreCurrency()),- TotalQuantity = x.TotalQuantity- };- var product = await _productService.GetProductById(x.ProductId);- if (product != null)- m.ProductName = product.Name;- if (_workContext.CurrentVendor != null)- {- if (product?.VendorId == _workContext.CurrentVendor.Id)- result.Add(m);- }- else+ if (product?.VendorId == _workContext.CurrentVendor.Id)result.Add(m);}- var gridModel = new DataSourceResult {- Data = result,- Total = items.TotalCount- };-- return Json(gridModel);+ else+ {+ result.Add(m);+ }}- public IActionResult NeverSoldReport()- {- var model = new NeverSoldReportModel();- return View(model);- }+ var gridModel = new DataSourceResult {+ Data = result,+ Total = items.TotalCount+ };- [HttpPost]- public async Task<IActionResult> NeverSoldReportList(DataSourceRequest command, NeverSoldReportModel model)- {- DateTime? startDateValue = model.StartDate == null ? null- : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);-- DateTime? endDateValue = model.EndDate == null ? null- : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);--- var items = await _orderReportService.ProductsNeverSold("", _workContext.CurrentVendor.Id,- startDateValue, endDateValue,- command.Page - 1, command.PageSize, true);- var gridModel = new DataSourceResult {- Data = items.Select(x =>- new NeverSoldReportLineModel {- ProductId = x.Id,- ProductName = x.Name- }),- Total = items.TotalCount- };+ return Json(gridModel);+ }- return Json(gridModel);- }-- public IActionResult CountryReport()- {- var model = new CountryReportModel {- //payment statuses- AvailablePaymentStatuses = PaymentStatus.Pending.ToSelectList(HttpContext, false).ToList()- };+ public IActionResult NeverSoldReport()+ {+ var model = new NeverSoldReportModel();+ return View(model);+ }++ [HttpPost]+ public async Task<IActionResult> NeverSoldReportList(DataSourceRequest command, NeverSoldReportModel model)+ {+ DateTime? startDateValue = model.StartDate == null+ ? null+ : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);++ DateTime? endDateValue = model.EndDate == null+ ? null+ : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);+++ var items = await _orderReportService.ProductsNeverSold("", _workContext.CurrentVendor.Id,+ startDateValue, endDateValue,+ command.Page - 1, command.PageSize, true);+ var gridModel = new DataSourceResult {+ Data = items.Select(x =>+ new NeverSoldReportLineModel {+ ProductId = x.Id,+ ProductName = x.Name+ }),+ Total = items.TotalCount+ };++ return Json(gridModel);+ }- model.AvailablePaymentStatuses.Insert(0, new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = "" });+ public IActionResult CountryReport()+ {+ var model = new CountryReportModel {+ //payment statuses+ AvailablePaymentStatuses = PaymentStatus.Pending.ToSelectList(HttpContext, false).ToList()+ };- return View(model);- }+ model.AvailablePaymentStatuses.Insert(0,+ new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = "" });- [HttpPost]- public async Task<IActionResult> CountryReportList(CountryReportModel model)+ return View(model);+ }++ [HttpPost]+ public async Task<IActionResult> CountryReportList(CountryReportModel model)+ {+ DateTime? startDateValue = model.StartDate == null+ ? null+ : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);++ DateTime? endDateValue = model.EndDate == null+ ? null+ : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);++ var paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)model.PaymentStatusId : null;++ var items = await _orderReportService.GetCountryReport(+ vendorId: _workContext.CurrentVendor.Id,+ ps: paymentStatus,+ startTimeUtc: startDateValue,+ endTimeUtc: endDateValue);+ var result = new List<CountryReportLineModel>();+ foreach (var x in items){- DateTime? startDateValue = model.StartDate == null ? null- : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);-- DateTime? endDateValue = model.EndDate == null ? null- : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);-- PaymentStatus? paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)model.PaymentStatusId : null;-- var items = await _orderReportService.GetCountryReport(- vendorId: _workContext.CurrentVendor.Id,- ps: paymentStatus,- startTimeUtc: startDateValue,- endTimeUtc: endDateValue);- var result = new List<CountryReportLineModel>();- foreach (var x in items)- {- var country = await _countryService.GetCountryById(!string.IsNullOrEmpty(x.CountryId) ? x.CountryId : "");- var m = new CountryReportLineModel {- CountryName = country != null ? country.Name : "Unknown",- SumOrders = _priceFormatter.FormatPrice(x.SumOrders, await _currencyService.GetPrimaryStoreCurrency()),- TotalOrders = x.TotalOrders- };- result.Add(m);- }- var gridModel = new DataSourceResult {- Data = result,- Total = items.Count+ var country = await _countryService.GetCountryById(!string.IsNullOrEmpty(x.CountryId) ? x.CountryId : "");+ var m = new CountryReportLineModel {+ CountryName = country != null ? country.Name : "Unknown",+ SumOrders = _priceFormatter.FormatPrice(x.SumOrders, await _currencyService.GetPrimaryStoreCurrency()),+ TotalOrders = x.TotalOrders};-- return Json(gridModel);+ result.Add(m);}- #region Low stock reports+ var gridModel = new DataSourceResult {+ Data = result,+ Total = items.Count+ };++ return Json(gridModel);+ }++ #region Low stock reports- public IActionResult LowStockReport()+ public IActionResult LowStockReport()+ {+ return View();+ }++ [HttpPost]+ public async Task<IActionResult> LowStockReportList(DataSourceRequest command)+ {+ var lowStockProducts = await _productsReportService.LowStockProducts(_workContext.CurrentVendor.Id);++ var models = new List<LowStockProductModel>();+ //products+ foreach (var product in lowStockProducts.products){- return View();+ var lowStockModel = new LowStockProductModel {+ Id = product.Id,+ Name = product.Name,+ ManageInventoryMethod =+ product.ManageInventoryMethodId.GetTranslationEnum(_translationService,+ _workContext.WorkingLanguage.Id),+ StockQuantity = _stockQuantityService.GetTotalStockQuantity(product, total: true),+ Published = product.Published+ };+ models.Add(lowStockModel);}- [HttpPost]- public async Task<IActionResult> LowStockReportList(DataSourceRequest command)+ //combinations+ foreach (var combination in lowStockProducts.combinations){- var lowStockProducts = await _productsReportService.LowStockProducts(vendorId: _workContext.CurrentVendor.Id);-- var models = new List<LowStockProductModel>();- //products- foreach (var product in lowStockProducts.products)- {- var lowStockModel = new LowStockProductModel {- Id = product.Id,- Name = product.Name,- ManageInventoryMethod = product.ManageInventoryMethodId.GetTranslationEnum(_translationService, _workContext.WorkingLanguage.Id),- StockQuantity = _stockQuantityService.GetTotalStockQuantity(product, total: true),- Published = product.Published- };- models.Add(lowStockModel);- }- //combinations- foreach (var combination in lowStockProducts.combinations)- {- var product = await _productService.GetProductById(combination.ProductId);- var lowStockModel = new LowStockProductModel {- Id = product.Id,- Name = product.Name,- Attributes = await _productAttributeFormatter.FormatAttributes(product, combination.Attributes, _workContext.CurrentCustomer, "<br />", true, true, true, false),- ManageInventoryMethod = product.ManageInventoryMethodId.GetTranslationEnum(_translationService, _workContext.WorkingLanguage.Id),- StockQuantity = combination.StockQuantity,- Published = product.Published- };- models.Add(lowStockModel);- }- var gridModel = new DataSourceResult {- Data = models.PagedForCommand(command),- Total = models.Count+ var product = await _productService.GetProductById(combination.ProductId);+ var lowStockModel = new LowStockProductModel {+ Id = product.Id,+ Name = product.Name,+ Attributes = await _productAttributeFormatter.FormatAttributes(product, combination.Attributes,+ _workContext.CurrentCustomer, "<br />", true, true, true, false),+ ManageInventoryMethod =+ product.ManageInventoryMethodId.GetTranslationEnum(_translationService,+ _workContext.WorkingLanguage.Id),+ StockQuantity = combination.StockQuantity,+ Published = product.Published};-- return Json(gridModel);+ models.Add(lowStockModel);}- #endregion+ var gridModel = new DataSourceResult {+ Data = models.PagedForCommand(command),+ Total = models.Count+ };- #region Customer Reports+ return Json(gridModel);+ }- public async Task<IActionResult> Customer()- {- var model = new CustomerReportsModel();- var status = await _orderStatusService.GetAll();+ #endregion- model.AvailablePaymentStatuses = PaymentStatus.Pending.ToSelectList(_translationService, _workContext, false).ToList();- model.AvailablePaymentStatuses.Insert(0, new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = "" });+ #region Customer Reports- return View(model);- }+ public async Task<IActionResult> Customer()+ {+ var model = new CustomerReportsModel();+ var status = await _orderStatusService.GetAll();- [HttpPost]- public async Task<IActionResult> ReportBestCustomersByOrderTotalList(DataSourceRequest command, BestCustomersReportModel model)- {- DateTime? startDateValue = model.StartDate == null ? null- : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);+ model.AvailablePaymentStatuses =+ PaymentStatus.Pending.ToSelectList(_translationService, _workContext, false).ToList();+ model.AvailablePaymentStatuses.Insert(0,+ new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = "" });- DateTime? endDateValue = model.EndDate == null ? null- : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);+ return View(model);+ }- PaymentStatus? paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)model.PaymentStatusId : null;+ [HttpPost]+ public async Task<IActionResult> ReportBestCustomersByOrderTotalList(DataSourceRequest command,+ BestCustomersReportModel model)+ {+ DateTime? startDateValue = model.StartDate == null+ ? null+ : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);- var items = _customerReportService.GetBestCustomersReport("", _workContext.CurrentVendor.Id,startDateValue, endDateValue,- null, paymentStatus, null, 2, command.Page - 1, command.PageSize);+ DateTime? endDateValue = model.EndDate == null+ ? null+ : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);- var report = new List<BestCustomerReportLineModel>();- foreach (var x in items)- {- var m = new BestCustomerReportLineModel {- CustomerId = x.CustomerId,- OrderTotal = _priceFormatter.FormatPrice(x.OrderTotal, await _currencyService.GetPrimaryStoreCurrency()),- OrderCount = x.OrderCount- };- var customer = await _customerService.GetCustomerById(x.CustomerId);- if (customer != null)- {- m.CustomerName = !string.IsNullOrEmpty(customer.Email) ? customer.Email : _translationService.GetResource("Vendor.Customers.Guest");- }- report.Add(m);- }- var gridModel = new DataSourceResult {- Data = report,- Total = items.TotalCount- };+ var paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)model.PaymentStatusId : null;- return Json(gridModel);+ var items = _customerReportService.GetBestCustomersReport("", _workContext.CurrentVendor.Id, startDateValue,+ endDateValue,+ null, paymentStatus, null, 2, command.Page - 1, command.PageSize);++ var report = new List<BestCustomerReportLineModel>();+ foreach (var x in items)+ {+ var m = new BestCustomerReportLineModel {+ CustomerId = x.CustomerId,+ OrderTotal =+ _priceFormatter.FormatPrice(x.OrderTotal, await _currencyService.GetPrimaryStoreCurrency()),+ OrderCount = x.OrderCount+ };+ var customer = await _customerService.GetCustomerById(x.CustomerId);+ if (customer != null)+ m.CustomerName = !string.IsNullOrEmpty(customer.Email)+ ? customer.Email+ : _translationService.GetResource("Vendor.Customers.Guest");+ report.Add(m);}- #endregion+ var gridModel = new DataSourceResult {+ Data = report,+ Total = items.TotalCount+ };++ return Json(gridModel);}++ #endregion}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Controllers/SearchController.cs b/src/Web/Grand.Web.Vendor/Controllers/SearchController.csindex fbc414d8a..1214d9279 100644--- a/src/Web/Grand.Web.Vendor/Controllers/SearchController.cs+++ b/src/Web/Grand.Web.Vendor/Controllers/SearchController.cs@@ -1,137 +1,131 @@-using Grand.Business.Core.Interfaces.Catalog.Categories;+using Grand.Business.Core.Interfaces.Catalog.Brands;+using Grand.Business.Core.Interfaces.Catalog.Categories;using Grand.Business.Core.Interfaces.Catalog.Collections;-using Microsoft.AspNetCore.Mvc;-using Grand.Web.Common.DataSource;-using Grand.Domain.Catalog;-using Grand.Business.Core.Interfaces.Catalog.Brands;using Grand.Domain.Admin;+using Grand.Domain.Catalog;+using Grand.Web.Common.DataSource;using Grand.Web.Vendor.Models.Common;+using Microsoft.AspNetCore.Mvc;-namespace Grand.Web.Vendor.Controllers+namespace Grand.Web.Vendor.Controllers;++public class SearchController : BaseVendorController{- public class SearchController : BaseVendorController+ private readonly AdminSearchSettings _adminSearchSettings;+ private readonly IBrandService _brandService;+ private readonly ICategoryService _categoryService;+ private readonly ICollectionService _collectionService;++ public SearchController(ICategoryService categoryService,+ IBrandService brandService, ICollectionService collectionService,+ AdminSearchSettings adminSearchSettings){- private readonly ICategoryService _categoryService;- private readonly ICollectionService _collectionService;- private readonly AdminSearchSettings _adminSearchSettings;- private readonly IBrandService _brandService;-- public SearchController(ICategoryService categoryService,- IBrandService brandService, ICollectionService collectionService,- AdminSearchSettings adminSearchSettings)- {- _categoryService = categoryService;- _brandService = brandService;- _collectionService = collectionService;- _adminSearchSettings = adminSearchSettings;- }+ _categoryService = categoryService;+ _brandService = brandService;+ _collectionService = collectionService;+ _adminSearchSettings = adminSearchSettings;+ }- [HttpGet]- public async Task<IActionResult> Category(string categoryId)- {- var value = HttpContext.Request.Query["filter[filters][0][value]"].ToString();+ [HttpGet]+ public async Task<IActionResult> Category(string categoryId)+ {+ var value = HttpContext.Request.Query["filter[filters][0][value]"].ToString();- async Task<IList<SearchModel>> PrepareModel(IEnumerable<Category> categories)+ async Task<IList<SearchModel>> PrepareModel(IEnumerable<Category> categories)+ {+ var model = new List<SearchModel>();+ if (!string.IsNullOrEmpty(categoryId)){- var model = new List<SearchModel>();- if (!string.IsNullOrEmpty(categoryId))- {- var currentCategory = await _categoryService.GetCategoryById(categoryId);- if (currentCategory != null)- {- model.Add(new SearchModel {- Id = currentCategory.Id,- Name = await _categoryService.GetFormattedBreadCrumb(currentCategory)- });- }- }- foreach (var item in categories)- {- if (item.Id != categoryId)- model.Add(new SearchModel {- Id = item.Id,- Name = await _categoryService.GetFormattedBreadCrumb(item)- });- }- return model;+ var currentCategory = await _categoryService.GetCategoryById(categoryId);+ if (currentCategory != null)+ model.Add(new SearchModel {+ Id = currentCategory.Id,+ Name = await _categoryService.GetFormattedBreadCrumb(currentCategory)+ });}- var categories = await _categoryService.GetAllCategories(- categoryName: value,- pageSize: _adminSearchSettings.CategorySizeLimit);- var gridModel = new DataSourceResult- {- Data = await PrepareModel(categories)- };- return Json(gridModel);+ foreach (var item in categories)+ if (item.Id != categoryId)+ model.Add(new SearchModel {+ Id = item.Id,+ Name = await _categoryService.GetFormattedBreadCrumb(item)+ });+ return model;}- [HttpGet]- public async Task<IActionResult> Collection(string collectionId)- {- var value = HttpContext.Request.Query["filter[filters][0][value]"].ToString();+ var categories = await _categoryService.GetAllCategories(+ categoryName: value,+ pageSize: _adminSearchSettings.CategorySizeLimit);+ var gridModel = new DataSourceResult {+ Data = await PrepareModel(categories)+ };+ return Json(gridModel);+ }++ [HttpGet]+ public async Task<IActionResult> Collection(string collectionId)+ {+ var value = HttpContext.Request.Query["filter[filters][0][value]"].ToString();- async Task<IList<SearchModel>> PrepareModel(IEnumerable<Collection> collections)+ async Task<IList<SearchModel>> PrepareModel(IEnumerable<Collection> collections)+ {+ var model = new List<SearchModel>();+ if (!string.IsNullOrEmpty(collectionId)){- var model = new List<SearchModel>();- if (!string.IsNullOrEmpty(collectionId))- {- var currentCollection = await _collectionService.GetCollectionById(collectionId);- if (currentCollection != null)- {- model.Add(new SearchModel {- Id = currentCollection.Id,- Name = currentCollection.Name- });- }- }-- model.AddRange(from item in collections where item.Id != collectionId select new SearchModel { Id = item.Id, Name = item.Name });- return model;+ var currentCollection = await _collectionService.GetCollectionById(collectionId);+ if (currentCollection != null)+ model.Add(new SearchModel {+ Id = currentCollection.Id,+ Name = currentCollection.Name+ });}- var collections = await _collectionService.GetAllCollections(- collectionName: value,- pageSize: _adminSearchSettings.CollectionSizeLimit);-- var gridModel = new DataSourceResult- {- Data = await PrepareModel(collections)- };- return Json(gridModel);+ model.AddRange(from item in collections+ where item.Id != collectionId+ select new SearchModel { Id = item.Id, Name = item.Name });+ return model;}-- [HttpGet]- public async Task<IActionResult> Brand(string brandId)- {- var value = HttpContext.Request.Query["filter[filters][0][value]"].ToString();- async Task<IList<SearchModel>> PrepareModel(IEnumerable<Brand> brands)+ var collections = await _collectionService.GetAllCollections(+ value,+ pageSize: _adminSearchSettings.CollectionSizeLimit);++ var gridModel = new DataSourceResult {+ Data = await PrepareModel(collections)+ };+ return Json(gridModel);+ }++ [HttpGet]+ public async Task<IActionResult> Brand(string brandId)+ {+ var value = HttpContext.Request.Query["filter[filters][0][value]"].ToString();++ async Task<IList<SearchModel>> PrepareModel(IEnumerable<Brand> brands)+ {+ var model = new List<SearchModel>();+ if (!string.IsNullOrEmpty(brandId)){- var model = new List<SearchModel>();- if (!string.IsNullOrEmpty(brandId))- {- var currentBrand = await _brandService.GetBrandById(brandId);- if (currentBrand != null)- {- model.Add(new SearchModel {- Id = currentBrand.Id,- Name = currentBrand.Name- });- }- }-- model.AddRange(from item in brands where item.Id != brandId select new SearchModel { Id = item.Id, Name = item.Name });- return model;+ var currentBrand = await _brandService.GetBrandById(brandId);+ if (currentBrand != null)+ model.Add(new SearchModel {+ Id = currentBrand.Id,+ Name = currentBrand.Name+ });}- var brands = await _brandService.GetAllBrands(- brandName: value,- pageSize: _adminSearchSettings.BrandSizeLimit);- var gridModel = new DataSourceResult- {- Data = await PrepareModel(brands)- };- return Json(gridModel);++ model.AddRange(from item in brands+ where item.Id != brandId+ select new SearchModel { Id = item.Id, Name = item.Name });+ return model;}++ var brands = await _brandService.GetAllBrands(+ value,+ pageSize: _adminSearchSettings.BrandSizeLimit);+ var gridModel = new DataSourceResult {+ Data = await PrepareModel(brands)+ };+ return Json(gridModel);}}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Controllers/ShipmentController.cs b/src/Web/Grand.Web.Vendor/Controllers/ShipmentController.csindex 8f3126379..674431d06 100644--- a/src/Web/Grand.Web.Vendor/Controllers/ShipmentController.cs+++ b/src/Web/Grand.Web.Vendor/Controllers/ShipmentController.cs@@ -8,548 +8,535 @@ using Grand.Business.Core.Utilities.Common.Security;using Grand.Domain.Orders;using Grand.Domain.Shipping;using Grand.Infrastructure;-using Grand.Web.Vendor.Extensions;-using Grand.Web.Vendor.Interfaces;using Grand.Web.Common.DataSource;using Grand.Web.Common.Extensions;using Grand.Web.Common.Filters;using Grand.Web.Common.Security.Authorization;+using Grand.Web.Vendor.Extensions;+using Grand.Web.Vendor.Interfaces;using Grand.Web.Vendor.Models.Shipment;using MediatR;using Microsoft.AspNetCore.Mvc;-namespace Grand.Web.Vendor.Controllers+namespace Grand.Web.Vendor.Controllers;++[PermissionAuthorize(PermissionSystemName.Shipments)]+public class ShipmentController : BaseVendorController{- [PermissionAuthorize(PermissionSystemName.Shipments)]- public class ShipmentController : BaseVendorController+ public ShipmentController(+ IShipmentViewModelService shipmentViewModelService,+ IOrderService orderService,+ ITranslationService translationService,+ IWorkContext workContext,+ IPdfService pdfService,+ IShipmentService shipmentService,+ IDateTimeService dateTimeService,+ IMediator mediator){- #region Fields-- private readonly IShipmentViewModelService _shipmentViewModelService;- private readonly IOrderService _orderService;- private readonly ITranslationService _translationService;- private readonly IWorkContext _workContext;- private readonly IPdfService _pdfService;- private readonly IShipmentService _shipmentService;- private readonly IDateTimeService _dateTimeService;- private readonly IMediator _mediator;-- #endregion-- public ShipmentController(- IShipmentViewModelService shipmentViewModelService,- IOrderService orderService,- ITranslationService translationService,- IWorkContext workContext,- IPdfService pdfService,- IShipmentService shipmentService,- IDateTimeService dateTimeService,- IMediator mediator)- {- _shipmentViewModelService = shipmentViewModelService;- _orderService = orderService;- _translationService = translationService;- _workContext = workContext;- _pdfService = pdfService;- _shipmentService = shipmentService;- _dateTimeService = dateTimeService;- _mediator = mediator;- }+ _shipmentViewModelService = shipmentViewModelService;+ _orderService = orderService;+ _translationService = translationService;+ _workContext = workContext;+ _pdfService = pdfService;+ _shipmentService = shipmentService;+ _dateTimeService = dateTimeService;+ _mediator = mediator;+ }- #region Shipments+ #region Fields- public async Task<IActionResult> List()- {- var model = await _shipmentViewModelService.PrepareShipmentListModel();- return View(model);- }+ private readonly IShipmentViewModelService _shipmentViewModelService;+ private readonly IOrderService _orderService;+ private readonly ITranslationService _translationService;+ private readonly IWorkContext _workContext;+ private readonly IPdfService _pdfService;+ private readonly IShipmentService _shipmentService;+ private readonly IDateTimeService _dateTimeService;+ private readonly IMediator _mediator;- [PermissionAuthorizeAction(PermissionActionName.List)]- [HttpPost]- public async Task<IActionResult> ShipmentListSelect(DataSourceRequest command, ShipmentListModel model)- {- var shipments = await _shipmentViewModelService.PrepareShipments(model, command.Page, command.PageSize);- var items = new List<ShipmentModel>();- foreach (var item in shipments.shipments)- {- items.Add(await _shipmentViewModelService.PrepareShipmentModel(item, false));- }+ #endregion- var gridModel = new DataSourceResult {- Data = items,- Total = shipments.totalCount- };- return Json(gridModel);- }+ #region Shipments++ public async Task<IActionResult> List()+ {+ var model = await _shipmentViewModelService.PrepareShipmentListModel();+ return View(model);+ }++ [PermissionAuthorizeAction(PermissionActionName.List)]+ [HttpPost]+ public async Task<IActionResult> ShipmentListSelect(DataSourceRequest command, ShipmentListModel model)+ {+ var shipments = await _shipmentViewModelService.PrepareShipments(model, command.Page, command.PageSize);+ var items = new List<ShipmentModel>();+ foreach (var item in shipments.shipments)+ items.Add(await _shipmentViewModelService.PrepareShipmentModel(item, false));++ var gridModel = new DataSourceResult {+ Data = items,+ Total = shipments.totalCount+ };+ return Json(gridModel);+ }++ [PermissionAuthorizeAction(PermissionActionName.List)]+ [HttpPost]+ public async Task<IActionResult> ShipmentsByOrder(string orderId)+ {+ var order = await _orderService.GetOrderById(orderId);+ if (order == null || order.Deleted || !_workContext.HasAccessToOrder(order))+ throw new ArgumentException("No order found with the specified id");- [PermissionAuthorizeAction(PermissionActionName.List)]- [HttpPost]- public async Task<IActionResult> ShipmentsByOrder(string orderId)+ //shipments+ var shipmentModels = new List<ShipmentModel>();+ var shipments = (await _shipmentService.GetShipmentsByOrder(orderId))+ //a vendor should have access only to his products+ .Where(s => _workContext.HasAccessToShipment(s))+ .OrderBy(s => s.CreatedOnUtc)+ .ToList();++ foreach (var shipment in shipments)+ shipmentModels.Add(await _shipmentViewModelService.PrepareShipmentModel(shipment, false));++ var gridModel = new DataSourceResult {+ Data = shipmentModels,+ Total = shipmentModels.Count+ };+ return Json(gridModel);+ }++ [PermissionAuthorizeAction(PermissionActionName.List)]+ [HttpPost]+ public async Task<IActionResult> ShipmentsItemsByShipmentId(string shipmentId)+ {+ var shipment = await _shipmentService.GetShipmentById(shipmentId);+ if (shipment == null || !_workContext.HasAccessToShipment(shipment))+ throw new ArgumentException("No shipment found with the specified id");++ //shipments+ var shipmentModel = await _shipmentViewModelService.PrepareShipmentModel(shipment, true);+ var gridModel = new DataSourceResult {+ Data = shipmentModel.Items,+ Total = shipmentModel.Items.Count+ };++ return Json(gridModel);+ }++ [PermissionAuthorizeAction(PermissionActionName.Create)]+ public async Task<IActionResult> AddShipment(string orderId)+ {+ var order = await _orderService.GetOrderById(orderId);+ if (order == null || order.Deleted || !_workContext.HasAccessToOrder(order))+ //No order found with the specified id+ return RedirectToAction("List");++ var model = await _shipmentViewModelService.PrepareShipmentModel(order);+ return View(model);+ }++ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ [ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]+ public async Task<IActionResult> AddShipment(AddShipmentModel model, bool continueEditing)+ {+ if (!ModelState.IsValid)+ return RedirectToAction("AddShipment", new { orderId = model.OrderId });++ var order = await _orderService.GetOrderById(model.OrderId);+ if (order == null || order.Deleted || !_workContext.HasAccessToOrder(order))+ //No order found with the specified id+ return RedirectToAction("List");++ //a vendor should have access only to his products+ var orderItems = order.OrderItems.Where(_workContext.HasAccessToOrderItem).ToList();++ var (shipment, totalWeight) =+ await _shipmentViewModelService.PrepareShipment(order, orderItems.ToList(), model);+ if (!shipment.ShipmentItems.Any()){- var order = await _orderService.GetOrderById(orderId);- if (order == null || order.Deleted || !_workContext.HasAccessToOrder(order))- throw new ArgumentException("No order found with the specified id");-- //shipments- var shipmentModels = new List<ShipmentModel>();- var shipments = (await _shipmentService.GetShipmentsByOrder(orderId))- //a vendor should have access only to his products- .Where(s => _workContext.HasAccessToShipment(s))- .OrderBy(s => s.CreatedOnUtc)- .ToList();-- foreach (var shipment in shipments)- shipmentModels.Add(await _shipmentViewModelService.PrepareShipmentModel(shipment, false));-- var gridModel = new DataSourceResult {- Data = shipmentModels,- Total = shipmentModels.Count- };- return Json(gridModel);+ Error(_translationService.GetResource("Admin.Orders.Shipments.NoProductsSelected"));+ return RedirectToAction("AddShipment", new { orderId = model.OrderId });}- [PermissionAuthorizeAction(PermissionActionName.List)]- [HttpPost]- public async Task<IActionResult> ShipmentsItemsByShipmentId(string shipmentId)+ //check stock+ var (valid, message) = await _shipmentViewModelService.ValidStockShipment(shipment);+ if (!valid){- var shipment = await _shipmentService.GetShipmentById(shipmentId);- if (shipment == null || !_workContext.HasAccessToShipment(shipment))- throw new ArgumentException("No shipment found with the specified id");-- //shipments- var shipmentModel = await _shipmentViewModelService.PrepareShipmentModel(shipment, true);- var gridModel = new DataSourceResult {- Data = shipmentModel.Items,- Total = shipmentModel.Items.Count- };-- return Json(gridModel);+ Error(message);+ return RedirectToAction("AddShipment", new { orderId = model.OrderId });}- [PermissionAuthorizeAction(PermissionActionName.Create)]- public async Task<IActionResult> AddShipment(string orderId)- {- var order = await _orderService.GetOrderById(orderId);- if (order == null || order.Deleted || !_workContext.HasAccessToOrder(order))- //No order found with the specified id- return RedirectToAction("List");+ shipment.TotalWeight = totalWeight;+ await _shipmentService.InsertShipment(shipment);++ //add a note+ await _orderService.InsertOrderNote(new OrderNote {+ Note = $"A shipment #{shipment.ShipmentNumber} has been added",+ DisplayToCustomer = false,+ OrderId = order.Id+ });+ Success(_translationService.GetResource("Admin.Orders.Shipments.Added"));+ return continueEditing+ ? RedirectToAction("ShipmentDetails", new { id = shipment.Id })+ : RedirectToAction("List", new { id = shipment.Id });+ }- var model = await _shipmentViewModelService.PrepareShipmentModel(order);- return View(model);- }+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ public async Task<IActionResult> ShipmentDetails(string id)+ {+ var shipment = await _shipmentService.GetShipmentById(id);+ if (shipment == null || !_workContext.HasAccessToShipment(shipment))+ //No shipment found with the specified id+ return RedirectToAction("List");- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost, ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]- public async Task<IActionResult> AddShipment(AddShipmentModel model, bool continueEditing)- {- if (!ModelState.IsValid)- return RedirectToAction("AddShipment", new { orderId = model.OrderId });-- var order = await _orderService.GetOrderById(model.OrderId);- if (order == null || order.Deleted || !_workContext.HasAccessToOrder(order))- //No order found with the specified id- return RedirectToAction("List");-- //a vendor should have access only to his products- var orderItems = order.OrderItems.Where(_workContext.HasAccessToOrderItem).ToList();+ var model = await _shipmentViewModelService.PrepareShipmentModel(shipment, true, true);+ return View(model);+ }- var (shipment, totalWeight) = await _shipmentViewModelService.PrepareShipment(order, orderItems.ToList(), model);- if (!shipment.ShipmentItems.Any())- {- Error(_translationService.GetResource("Admin.Orders.Shipments.NoProductsSelected"));- return RedirectToAction("AddShipment", new { orderId = model.OrderId });- }+ [PermissionAuthorizeAction(PermissionActionName.Delete)]+ [HttpPost]+ public async Task<IActionResult> DeleteShipment(string id)+ {+ var shipment = await _shipmentService.GetShipmentById(id);+ if (shipment == null || !_workContext.HasAccessToShipment(shipment))+ //No shipment found with the specified id+ return RedirectToAction("List");++ await _shipmentService.DeleteShipment(shipment);++ //add a note+ await _orderService.InsertOrderNote(new OrderNote {+ Note = $"A shipment #{shipment.ShipmentNumber} has been deleted",+ DisplayToCustomer = false,+ OrderId = shipment.OrderId+ });+ Success(_translationService.GetResource("Admin.Orders.Shipments.Deleted"));++ return RedirectToAction("Edit", "Order", new { Id = shipment.OrderId });+ }- //check stock- var (valid, message) = await _shipmentViewModelService.ValidStockShipment(shipment);- if (!valid)- {- Error(message);- return RedirectToAction("AddShipment", new { orderId = model.OrderId });- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> SetTrackingNumber(ShipmentTrackingModel model)+ {+ if (!ModelState.IsValid)+ return RedirectToAction("ShipmentDetails", new { id = model.Id });- shipment.TotalWeight = totalWeight;- await _shipmentService.InsertShipment(shipment);-- //add a note- await _orderService.InsertOrderNote(new OrderNote {- Note = $"A shipment #{shipment.ShipmentNumber} has been added",- DisplayToCustomer = false,- OrderId = order.Id- });- Success(_translationService.GetResource("Admin.Orders.Shipments.Added"));- return continueEditing- ? RedirectToAction("ShipmentDetails", new { id = shipment.Id })- : RedirectToAction("List", new { id = shipment.Id });- }+ var shipment = await _shipmentService.GetShipmentById(model.Id);+ if (shipment == null || !_workContext.HasAccessToShipment(shipment))+ //No shipment found with the specified id+ return RedirectToAction("List");- [PermissionAuthorizeAction(PermissionActionName.Preview)]- public async Task<IActionResult> ShipmentDetails(string id)- {- var shipment = await _shipmentService.GetShipmentById(id);- if (shipment == null || !_workContext.HasAccessToShipment(shipment))- //No shipment found with the specified id- return RedirectToAction("List");+ shipment.TrackingNumber = model.TrackingNumber;+ await _shipmentService.UpdateShipment(shipment);- var model = await _shipmentViewModelService.PrepareShipmentModel(shipment, true, true);- return View(model);- }+ return RedirectToAction("ShipmentDetails", new { id = shipment.Id });+ }++ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> SetShipmentAdminComment(ShipmentAdminCommentModel model)+ {+ if (!ModelState.IsValid)+ return RedirectToAction("ShipmentDetails", new { id = model.Id });++ var shipment = await _shipmentService.GetShipmentById(model.Id);+ if (shipment == null || !_workContext.HasAccessToShipment(shipment))+ //No shipment found with the specified id+ return RedirectToAction("List");++ shipment.AdminComment = model.AdminComment;+ await _shipmentService.UpdateShipment(shipment);- [PermissionAuthorizeAction(PermissionActionName.Delete)]- [HttpPost]- public async Task<IActionResult> DeleteShipment(string id)+ return RedirectToAction("ShipmentDetails", new { id = shipment.Id });+ }++ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> SetAsShipped(string id)+ {+ var shipment = await _shipmentService.GetShipmentById(id);+ if (shipment == null || !_workContext.HasAccessToShipment(shipment))+ //No shipment found with the specified id+ return RedirectToAction("List");++ try{- var shipment = await _shipmentService.GetShipmentById(id);- if (shipment == null || !_workContext.HasAccessToShipment(shipment))- //No shipment found with the specified id- return RedirectToAction("List");-- await _shipmentService.DeleteShipment(shipment);-- //add a note- await _orderService.InsertOrderNote(new OrderNote {- Note = $"A shipment #{shipment.ShipmentNumber} has been deleted",- DisplayToCustomer = false,- OrderId = shipment.OrderId- });- Success(_translationService.GetResource("Admin.Orders.Shipments.Deleted"));-- return RedirectToAction("Edit", "Order", new { Id = shipment.OrderId });+ await _mediator.Send(new ShipCommand { Shipment = shipment, NotifyCustomer = true });+ return RedirectToAction("ShipmentDetails", new { id = shipment.Id });}-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> SetTrackingNumber(ShipmentTrackingModel model)+ catch (Exception exc){- if (!ModelState.IsValid)- return RedirectToAction("ShipmentDetails", new { id = model.Id });-- var shipment = await _shipmentService.GetShipmentById(model.Id);- if (shipment == null || !_workContext.HasAccessToShipment(shipment))- //No shipment found with the specified id- return RedirectToAction("List");-- shipment.TrackingNumber = model.TrackingNumber;- await _shipmentService.UpdateShipment(shipment);-+ //error+ Error(exc);return RedirectToAction("ShipmentDetails", new { id = shipment.Id });}+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> SetShipmentAdminComment(ShipmentAdminCommentModel model)- {- if (!ModelState.IsValid)- return RedirectToAction("ShipmentDetails", new { id = model.Id });+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> EditShippedDate(ShipmentShippedDateModel model)+ {+ if (!ModelState.IsValid)+ return RedirectToAction("ShipmentDetails", new { id = model.Id });- var shipment = await _shipmentService.GetShipmentById(model.Id);- if (shipment == null || !_workContext.HasAccessToShipment(shipment))- //No shipment found with the specified id- return RedirectToAction("List");+ var shipment = await _shipmentService.GetShipmentById(model.Id);+ if (shipment == null || !_workContext.HasAccessToShipment(shipment))+ //No shipment found with the specified id+ return RedirectToAction("List");- shipment.AdminComment = model.AdminComment;- await _shipmentService.UpdateShipment(shipment);+ try+ {+ if (!model.ShippedDate.HasValue) throw new Exception("Enter shipped date");+ shipment.ShippedDateUtc = model.ShippedDate.ConvertToUtcTime(_dateTimeService);+ await _shipmentService.UpdateShipment(shipment);return RedirectToAction("ShipmentDetails", new { id = shipment.Id });}-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> SetAsShipped(string id)+ catch (Exception exc){- var shipment = await _shipmentService.GetShipmentById(id);- if (shipment == null || !_workContext.HasAccessToShipment(shipment))- //No shipment found with the specified id- return RedirectToAction("List");-- try- {- await _mediator.Send(new ShipCommand { Shipment = shipment, NotifyCustomer = true });- return RedirectToAction("ShipmentDetails", new { id = shipment.Id });- }- catch (Exception exc)- {- //error- Error(exc);- return RedirectToAction("ShipmentDetails", new { id = shipment.Id });- }+ //error+ Error(exc);+ return RedirectToAction("ShipmentDetails", new { id = shipment.Id });}+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> EditShippedDate(ShipmentShippedDateModel model)+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> SetAsDelivered(string id)+ {+ var shipment = await _shipmentService.GetShipmentById(id);+ if (shipment == null || !_workContext.HasAccessToShipment(shipment))+ //No shipment found with the specified id+ return RedirectToAction("List");++ try{- if (!ModelState.IsValid)- return RedirectToAction("ShipmentDetails", new { id = model.Id });+ await _mediator.Send(new DeliveryCommand { Shipment = shipment, NotifyCustomer = true });+ return RedirectToAction("ShipmentDetails", new { id = shipment.Id });+ }+ catch (Exception exc)+ {+ //error+ Error(exc);+ return RedirectToAction("ShipmentDetails", new { id = shipment.Id });+ }+ }- var shipment = await _shipmentService.GetShipmentById(model.Id);- if (shipment == null || !_workContext.HasAccessToShipment(shipment))- //No shipment found with the specified id- return RedirectToAction("List");- try- {- if (!model.ShippedDate.HasValue)- {- throw new Exception("Enter shipped date");- }-- shipment.ShippedDateUtc = model.ShippedDate.ConvertToUtcTime(_dateTimeService);- await _shipmentService.UpdateShipment(shipment);- return RedirectToAction("ShipmentDetails", new { id = shipment.Id });- }- catch (Exception exc)- {- //error- Error(exc);- return RedirectToAction("ShipmentDetails", new { id = shipment.Id });- }- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> EditDeliveryDate(ShipmentDeliveryDateModel model)+ {+ if (!ModelState.IsValid)+ return RedirectToAction("ShipmentDetails", new { id = model.Id });- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> SetAsDelivered(string id)+ var shipment = await _shipmentService.GetShipmentById(model.Id);+ if (shipment == null || !_workContext.HasAccessToShipment(shipment))+ //No shipment found with the specified id+ return RedirectToAction("List");++ try{- var shipment = await _shipmentService.GetShipmentById(id);- if (shipment == null || !_workContext.HasAccessToShipment(shipment))- //No shipment found with the specified id- return RedirectToAction("List");+ if (!model.DeliveryDate.HasValue) throw new Exception("Enter delivery date");- try- {- await _mediator.Send(new DeliveryCommand { Shipment = shipment, NotifyCustomer = true });- return RedirectToAction("ShipmentDetails", new { id = shipment.Id });- }- catch (Exception exc)- {- //error- Error(exc);- return RedirectToAction("ShipmentDetails", new { id = shipment.Id });- }+ shipment.DeliveryDateUtc = model.DeliveryDate.ConvertToUtcTime(_dateTimeService);+ await _shipmentService.UpdateShipment(shipment);+ return RedirectToAction("ShipmentDetails", new { id = shipment.Id });}--- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> EditDeliveryDate(ShipmentDeliveryDateModel model)+ catch (Exception exc){- if (!ModelState.IsValid)- return RedirectToAction("ShipmentDetails", new { id = model.Id });+ //error+ Error(exc);+ return RedirectToAction("ShipmentDetails", new { id = shipment.Id });+ }+ }- var shipment = await _shipmentService.GetShipmentById(model.Id);- if (shipment == null || !_workContext.HasAccessToShipment(shipment))- //No shipment found with the specified id- return RedirectToAction("List");+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ public async Task<IActionResult> PdfPackagingSlip(string shipmentId)+ {+ var shipment = await _shipmentService.GetShipmentById(shipmentId);+ if (shipment == null || !_workContext.HasAccessToShipment(shipment))+ //no shipment found with the specified id+ return RedirectToAction("List");- try- {- if (!model.DeliveryDate.HasValue)- {- throw new Exception("Enter delivery date");- }-- shipment.DeliveryDateUtc = model.DeliveryDate.ConvertToUtcTime(_dateTimeService);- await _shipmentService.UpdateShipment(shipment);- return RedirectToAction("ShipmentDetails", new { id = shipment.Id });- }- catch (Exception exc)- {- //error- Error(exc);- return RedirectToAction("ShipmentDetails", new { id = shipment.Id });- }- }+ var shipments = new List<Shipment> {+ shipment+ };- [PermissionAuthorizeAction(PermissionActionName.Preview)]- public async Task<IActionResult> PdfPackagingSlip(string shipmentId)+ byte[] bytes;+ using (var stream = new MemoryStream()){- var shipment = await _shipmentService.GetShipmentById(shipmentId);- if (shipment == null || !_workContext.HasAccessToShipment(shipment))- //no shipment found with the specified id- return RedirectToAction("List");+ await _pdfService.PrintPackagingSlipsToPdf(stream, shipments, _workContext.WorkingLanguage.Id);+ bytes = stream.ToArray();+ }- var shipments = new List<Shipment> {- shipment- };+ return File(bytes, "application/pdf", $"packagingslip_{shipment.Id}.pdf");+ }- byte[] bytes;- using (var stream = new MemoryStream())- {- await _pdfService.PrintPackagingSlipsToPdf(stream, shipments, _workContext.WorkingLanguage.Id);- bytes = stream.ToArray();- }+ [PermissionAuthorizeAction(PermissionActionName.Export)]+ [HttpPost]+ public async Task<IActionResult> PdfPackagingSlipAll(ShipmentListModel model)+ {+ //load shipments+ var shipments = await _shipmentViewModelService.PrepareShipments(model, 1, 100);- return File(bytes, "application/pdf", $"packagingslip_{shipment.Id}.pdf");+ //ensure that we at least one shipment selected+ if (shipments.totalCount == 0)+ {+ Error(_translationService.GetResource("Admin.Orders.Shipments.NoShipmentsSelected"));+ return RedirectToAction("List");}- [PermissionAuthorizeAction(PermissionActionName.Export)]- [HttpPost]- public async Task<IActionResult> PdfPackagingSlipAll(ShipmentListModel model)+ byte[] bytes;+ using (var stream = new MemoryStream()){- //load shipments- var shipments = await _shipmentViewModelService.PrepareShipments(model, 1, 100);+ await _pdfService.PrintPackagingSlipsToPdf(stream, shipments.shipments.ToList(),+ _workContext.WorkingLanguage.Id);+ bytes = stream.ToArray();+ }- //ensure that we at least one shipment selected- if (shipments.totalCount == 0)- {- Error(_translationService.GetResource("Admin.Orders.Shipments.NoShipmentsSelected"));- return RedirectToAction("List");- }+ return File(bytes, "application/pdf", "packagingslips.pdf");+ }- byte[] bytes;- using (var stream = new MemoryStream())- {- await _pdfService.PrintPackagingSlipsToPdf(stream, shipments.shipments.ToList(),- _workContext.WorkingLanguage.Id);- bytes = stream.ToArray();- }+ [PermissionAuthorizeAction(PermissionActionName.Export)]+ [HttpPost]+ public async Task<IActionResult> PdfPackagingSlipSelected(string selectedIds)+ {+ var shipments = new List<Shipment>();+ if (selectedIds != null)+ {+ var ids = selectedIds+ .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)+ .Select(x => x)+ .ToArray();+ shipments.AddRange(await _shipmentService.GetShipmentsByIds(ids));+ }++ //a vendor should have access only to his shipments+ var shipmentsAccess =+ (from item in shipments+ where _workContext.HasAccessToShipment(item)+ select item).ToList();- return File(bytes, "application/pdf", "packagingslips.pdf");+ //ensure that we at least one shipment selected+ if (shipments.Count == 0)+ {+ Error(_translationService.GetResource("Vendor.Orders.Shipments.NoShipmentsSelected"));+ return RedirectToAction("List");}- [PermissionAuthorizeAction(PermissionActionName.Export)]- [HttpPost]- public async Task<IActionResult> PdfPackagingSlipSelected(string selectedIds)+ byte[] bytes;+ using (var stream = new MemoryStream()){- var shipments = new List<Shipment>();- if (selectedIds != null)- {- var ids = selectedIds- .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)- .Select(x => x)- .ToArray();- shipments.AddRange(await _shipmentService.GetShipmentsByIds(ids));- }+ await _pdfService.PrintPackagingSlipsToPdf(stream, shipmentsAccess, _workContext.WorkingLanguage.Id);+ bytes = stream.ToArray();+ }- //a vendor should have access only to his shipments- var shipmentsAccess =- (from item in shipments- where _workContext.HasAccessToShipment(item) select item).ToList();+ return File(bytes, "application/pdf", "packagingslips.pdf");+ }- //ensure that we at least one shipment selected- if (shipments.Count == 0)- {- Error(_translationService.GetResource("Vendor.Orders.Shipments.NoShipmentsSelected"));- return RedirectToAction("List");- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> SetAsShippedSelected(ICollection<string> selectedIds)+ {+ var shipments = new List<Shipment>();+ var shipmentsAccess = new List<Shipment>();+ if (selectedIds != null) shipments.AddRange(await _shipmentService.GetShipmentsByIds(selectedIds.ToArray()));++ //a vendor should have access only to his shipments+ shipmentsAccess.AddRange(from item in shipments+ where _workContext.HasAccessToShipment(item)+ select item);- byte[] bytes;- using (var stream = new MemoryStream())+ foreach (var shipment in shipmentsAccess)+ try{- await _pdfService.PrintPackagingSlipsToPdf(stream, shipmentsAccess, _workContext.WorkingLanguage.Id);- bytes = stream.ToArray();+ await _mediator.Send(new ShipCommand { Shipment = shipment, NotifyCustomer = true });}-- return File(bytes, "application/pdf", "packagingslips.pdf");- }-- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> SetAsShippedSelected(ICollection<string> selectedIds)- {- var shipments = new List<Shipment>();- var shipmentsAccess = new List<Shipment>();- if (selectedIds != null)+ catch{- shipments.AddRange(await _shipmentService.GetShipmentsByIds(selectedIds.ToArray()));+ //ignore any exception}- //a vendor should have access only to his shipments- shipmentsAccess.AddRange(from item in shipments- where _workContext.HasAccessToShipment(item) select item);+ return Json(new { Result = true });+ }- foreach (var shipment in shipmentsAccess)- {- try- {- await _mediator.Send(new ShipCommand { Shipment = shipment, NotifyCustomer = true });- }- catch- {- //ignore any exception- }- }- return Json(new { Result = true });- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ public async Task<IActionResult> SetAsDeliveredSelected(ICollection<string> selectedIds)+ {+ var shipments = new List<Shipment>();+ var shipmentsAccess = new List<Shipment>();+ if (selectedIds != null) shipments.AddRange(await _shipmentService.GetShipmentsByIds(selectedIds.ToArray()));- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost]- public async Task<IActionResult> SetAsDeliveredSelected(ICollection<string> selectedIds)- {- var shipments = new List<Shipment>();- var shipmentsAccess = new List<Shipment>();- if (selectedIds != null)+ //a vendor should have access only to his shipments+ shipmentsAccess.AddRange(+ from item in shipments+ where _workContext.HasAccessToShipment(item)+ select item);++ foreach (var shipment in shipmentsAccess)+ try{- shipments.AddRange(await _shipmentService.GetShipmentsByIds(selectedIds.ToArray()));+ await _mediator.Send(new DeliveryCommand { Shipment = shipment, NotifyCustomer = true });}-- //a vendor should have access only to his shipments- shipmentsAccess.AddRange(- from item in shipments- where _workContext.HasAccessToShipment(item) select item);-- foreach (var shipment in shipmentsAccess)+ catch{- try- {- await _mediator.Send(new DeliveryCommand { Shipment = shipment, NotifyCustomer = true });- }- catch- {- //ignore any exception- }+ //ignore any exception}- return Json(new { Result = true });- }+ return Json(new { Result = true });+ }- #region Shipment notes+ #region Shipment notes- [PermissionAuthorizeAction(PermissionActionName.Preview)]- [HttpPost]- public async Task<IActionResult> ShipmentNotesSelect(string shipmentId)- {- var shipment = await _shipmentService.GetShipmentById(shipmentId);- if (shipment == null || !_workContext.HasAccessToShipment(shipment))- throw new ArgumentException("No shipment found with the specified id");-- //shipment notes- var shipmentNoteModels = await _shipmentViewModelService.PrepareShipmentNotes(shipment);- var gridModel = new DataSourceResult {- Data = shipmentNoteModels,- Total = shipmentNoteModels.Count- };- return Json(gridModel);- }+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ [HttpPost]+ public async Task<IActionResult> ShipmentNotesSelect(string shipmentId)+ {+ var shipment = await _shipmentService.GetShipmentById(shipmentId);+ if (shipment == null || !_workContext.HasAccessToShipment(shipment))+ throw new ArgumentException("No shipment found with the specified id");++ //shipment notes+ var shipmentNoteModels = await _shipmentViewModelService.PrepareShipmentNotes(shipment);+ var gridModel = new DataSourceResult {+ Data = shipmentNoteModels,+ Total = shipmentNoteModels.Count+ };+ return Json(gridModel);+ }- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> ShipmentNoteAdd(string shipmentId, bool displayToCustomer,- string message)- {- var shipment = await _shipmentService.GetShipmentById(shipmentId);- if (shipment == null || !_workContext.HasAccessToShipment(shipment))- return Json(new { Result = false });+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> ShipmentNoteAdd(string shipmentId, bool displayToCustomer,+ string message)+ {+ var shipment = await _shipmentService.GetShipmentById(shipmentId);+ if (shipment == null || !_workContext.HasAccessToShipment(shipment))+ return Json(new { Result = false });- await _shipmentViewModelService.InsertShipmentNote(shipment, displayToCustomer, message);+ await _shipmentViewModelService.InsertShipmentNote(shipment, displayToCustomer, message);- return Json(new { Result = true });- }+ return Json(new { Result = true });+ }- [PermissionAuthorizeAction(PermissionActionName.Delete)]- [HttpPost]- public async Task<IActionResult> ShipmentNoteDelete(string id, string shipmentId)- {- var shipment = await _shipmentService.GetShipmentById(shipmentId);- if (shipment == null || !_workContext.HasAccessToShipment(shipment))- throw new ArgumentException("No shipment found with the specified id");+ [PermissionAuthorizeAction(PermissionActionName.Delete)]+ [HttpPost]+ public async Task<IActionResult> ShipmentNoteDelete(string id, string shipmentId)+ {+ var shipment = await _shipmentService.GetShipmentById(shipmentId);+ if (shipment == null || !_workContext.HasAccessToShipment(shipment))+ throw new ArgumentException("No shipment found with the specified id");- await _shipmentViewModelService.DeleteShipmentNote(shipment, id);+ await _shipmentViewModelService.DeleteShipmentNote(shipment, id);- return new JsonResult("");- }+ return new JsonResult("");+ }- #endregion+ #endregion- #endregion- }+ #endregion}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Controllers/VendorInfoController.cs b/src/Web/Grand.Web.Vendor/Controllers/VendorInfoController.csindex 02cd5d0e4..b3b6f9cdc 100644--- a/src/Web/Grand.Web.Vendor/Controllers/VendorInfoController.cs+++ b/src/Web/Grand.Web.Vendor/Controllers/VendorInfoController.cs@@ -1,6 +1,6 @@using Grand.Business.Core.Extensions;-using Grand.Business.Core.Interfaces.Common.Localization;using Grand.Business.Core.Interfaces.Common.Directory;+using Grand.Business.Core.Interfaces.Common.Localization;using Grand.Business.Core.Interfaces.Common.Seo;using Grand.Business.Core.Interfaces.Customers;using Grand.Domain.Directory;@@ -9,165 +9,172 @@ using Grand.Domain.Vendors;using Grand.Infrastructure;using Grand.Web.Common.Extensions;using Grand.Web.Vendor.Extensions;+using Grand.Web.Vendor.Models.Common;using Grand.Web.Vendor.Models.Vendor;using Microsoft.AspNetCore.Mvc;using Microsoft.AspNetCore.Mvc.Rendering;-namespace Grand.Web.Vendor.Controllers+namespace Grand.Web.Vendor.Controllers;++public class VendorInfoController : BaseVendorController{- public class VendorInfoController : BaseVendorController+ #region Constructors++ public VendorInfoController(+ ITranslationService translationService,+ IVendorService vendorService,+ ILanguageService languageService,+ IWorkContext workContext,+ ICountryService countryService,+ ISlugService slugService,+ SeoSettings seoSettings,+ VendorSettings vendorSettings){- #region Fields-- private readonly IWorkContext _workContext;- private readonly ITranslationService _translationService;- private readonly IVendorService _vendorService;- private readonly ILanguageService _languageService;- private readonly ICountryService _countryService;- private readonly ISlugService _slugService;-- private readonly SeoSettings _seoSettings;- private readonly VendorSettings _vendorSettings;- #endregion-- #region Constructors-- public VendorInfoController(- ITranslationService translationService,- IVendorService vendorService,- ILanguageService languageService,- IWorkContext workContext,- ICountryService countryService,- ISlugService slugService,- SeoSettings seoSettings,- VendorSettings vendorSettings)- {-- _translationService = translationService;- _vendorService = vendorService;- _languageService = languageService;- _workContext = workContext;- _countryService = countryService;- _slugService = slugService;- _seoSettings = seoSettings;- _vendorSettings = vendorSettings;- }+ _translationService = translationService;+ _vendorService = vendorService;+ _languageService = languageService;+ _workContext = workContext;+ _countryService = countryService;+ _slugService = slugService;+ _seoSettings = seoSettings;+ _vendorSettings = vendorSettings;+ }- #endregion+ #endregion- #region Private methods+ #region Fields- private async Task PrepareVendorAddressModel(VendorModel model, Domain.Vendors.Vendor vendor)- {- model.Address ??= new Models.Common.AddressModel();-- model.Address.FirstNameEnabled = false;- model.Address.FirstNameRequired = false;- model.Address.LastNameEnabled = false;- model.Address.LastNameRequired = false;- model.Address.EmailEnabled = false;- model.Address.EmailRequired = false;- model.Address.CompanyEnabled = _vendorSettings.AddressSettings.CompanyEnabled;- model.Address.CountryEnabled = _vendorSettings.AddressSettings.CountryEnabled;- model.Address.StateProvinceEnabled = _vendorSettings.AddressSettings.StateProvinceEnabled;- model.Address.CityEnabled = _vendorSettings.AddressSettings.CityEnabled;- model.Address.CityRequired = _vendorSettings.AddressSettings.CityRequired;- model.Address.StreetAddressEnabled = _vendorSettings.AddressSettings.StreetAddressEnabled;- model.Address.StreetAddressRequired = _vendorSettings.AddressSettings.StreetAddressRequired;- model.Address.StreetAddress2Enabled = _vendorSettings.AddressSettings.StreetAddress2Enabled;- model.Address.ZipPostalCodeEnabled = _vendorSettings.AddressSettings.ZipPostalCodeEnabled;- model.Address.ZipPostalCodeRequired = _vendorSettings.AddressSettings.ZipPostalCodeRequired;- model.Address.PhoneEnabled = _vendorSettings.AddressSettings.PhoneEnabled;- model.Address.PhoneRequired = _vendorSettings.AddressSettings.PhoneRequired;- model.Address.FaxEnabled = _vendorSettings.AddressSettings.FaxEnabled;- model.Address.FaxRequired = _vendorSettings.AddressSettings.FaxRequired;- model.Address.NoteEnabled = _vendorSettings.AddressSettings.NoteEnabled;- model.Address.AddressTypeEnabled = false;-- //address- model.Address.AvailableCountries.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Address.SelectCountry"), Value = "" });- foreach (var c in await _countryService.GetAllCountries(showHidden: true))- model.Address.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id, Selected = vendor != null && c.Id == vendor.Address.CountryId });-- var states = !string.IsNullOrEmpty(model.Address.CountryId) ? (await _countryService.GetCountryById(model.Address.CountryId))?.StateProvinces : new List<StateProvince>();- if (states?.Count > 0)- {- foreach (var s in states)- model.Address.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id, Selected = vendor != null && s.Id == vendor.Address.StateProvinceId });- }- }-- private async Task UpdateVendorModel(Domain.Vendors.Vendor vendor, VendorModel model)- {- vendor = model.ToEntity(vendor);- vendor.Locales = await model.Locales.ToTranslationProperty(vendor, x => x.Name, _seoSettings, _slugService, _languageService);- model.SeName = await vendor.ValidateSeName(model.SeName, vendor.Name, true, _seoSettings, _slugService, _languageService);- vendor.Address = model.Address.ToEntity();- vendor.SeName = model.SeName;-- await _vendorService.UpdateVendor(vendor);-- //search engine name- await _slugService.SaveSlug(vendor, model.SeName, "");- }+ private readonly IWorkContext _workContext;+ private readonly ITranslationService _translationService;+ private readonly IVendorService _vendorService;+ private readonly ILanguageService _languageService;+ private readonly ICountryService _countryService;+ private readonly ISlugService _slugService;++ private readonly SeoSettings _seoSettings;+ private readonly VendorSettings _vendorSettings;++ #endregion- #endregion-- #region Methods+ #region Private methods- //edit- public async Task<IActionResult> Edit()+ private async Task PrepareVendorAddressModel(VendorModel model, Domain.Vendors.Vendor vendor)+ {+ model.Address ??= new AddressModel();++ model.Address.FirstNameEnabled = false;+ model.Address.FirstNameRequired = false;+ model.Address.LastNameEnabled = false;+ model.Address.LastNameRequired = false;+ model.Address.EmailEnabled = false;+ model.Address.EmailRequired = false;+ model.Address.CompanyEnabled = _vendorSettings.AddressSettings.CompanyEnabled;+ model.Address.CountryEnabled = _vendorSettings.AddressSettings.CountryEnabled;+ model.Address.StateProvinceEnabled = _vendorSettings.AddressSettings.StateProvinceEnabled;+ model.Address.CityEnabled = _vendorSettings.AddressSettings.CityEnabled;+ model.Address.CityRequired = _vendorSettings.AddressSettings.CityRequired;+ model.Address.StreetAddressEnabled = _vendorSettings.AddressSettings.StreetAddressEnabled;+ model.Address.StreetAddressRequired = _vendorSettings.AddressSettings.StreetAddressRequired;+ model.Address.StreetAddress2Enabled = _vendorSettings.AddressSettings.StreetAddress2Enabled;+ model.Address.ZipPostalCodeEnabled = _vendorSettings.AddressSettings.ZipPostalCodeEnabled;+ model.Address.ZipPostalCodeRequired = _vendorSettings.AddressSettings.ZipPostalCodeRequired;+ model.Address.PhoneEnabled = _vendorSettings.AddressSettings.PhoneEnabled;+ model.Address.PhoneRequired = _vendorSettings.AddressSettings.PhoneRequired;+ model.Address.FaxEnabled = _vendorSettings.AddressSettings.FaxEnabled;+ model.Address.FaxRequired = _vendorSettings.AddressSettings.FaxRequired;+ model.Address.NoteEnabled = _vendorSettings.AddressSettings.NoteEnabled;+ model.Address.AddressTypeEnabled = false;++ //address+ model.Address.AvailableCountries.Add(new SelectListItem+ { Text = _translationService.GetResource("Admin.Address.SelectCountry"), Value = "" });+ foreach (var c in await _countryService.GetAllCountries(showHidden: true))+ model.Address.AvailableCountries.Add(new SelectListItem+ { Text = c.Name, Value = c.Id, Selected = vendor != null && c.Id == vendor.Address.CountryId });++ var states = !string.IsNullOrEmpty(model.Address.CountryId)+ ? (await _countryService.GetCountryById(model.Address.CountryId))?.StateProvinces+ : new List<StateProvince>();+ if (states?.Count > 0)+ foreach (var s in states)+ model.Address.AvailableStates.Add(new SelectListItem {+ Text = s.Name, Value = s.Id, Selected = vendor != null && s.Id == vendor.Address.StateProvinceId+ });+ }++ private async Task UpdateVendorModel(Domain.Vendors.Vendor vendor, VendorModel model)+ {+ vendor = model.ToEntity(vendor);+ vendor.Locales =+ await model.Locales.ToTranslationProperty(vendor, x => x.Name, _seoSettings, _slugService,+ _languageService);+ model.SeName = await vendor.ValidateSeName(model.SeName, vendor.Name, true, _seoSettings, _slugService,+ _languageService);+ vendor.Address = model.Address.ToEntity();+ vendor.SeName = model.SeName;++ await _vendorService.UpdateVendor(vendor);++ //search engine name+ await _slugService.SaveSlug(vendor, model.SeName, "");+ }++ #endregion++ #region Methods++ //edit+ public async Task<IActionResult> Edit()+ {+ if (!_vendorSettings.AllowVendorsToEditInfo)+ throw new Exception("Vendor can't edit info");++ var vendor = await _vendorService.GetVendorById(_workContext.CurrentVendor.Id);+ if (vendor == null || vendor.Deleted)+ throw new ArgumentNullException(nameof(vendor));++ var model = vendor.ToModel();++ //locales+ await AddLocales(_languageService, model.Locales, (locale, languageId) =>{- if(!_vendorSettings.AllowVendorsToEditInfo)- throw new Exception("Vendor can't edit info");-- var vendor = await _vendorService.GetVendorById(_workContext.CurrentVendor.Id);- if (vendor == null || vendor.Deleted)- throw new ArgumentNullException(nameof(vendor));-- var model = vendor.ToModel();-- //locales- await AddLocales(_languageService, model.Locales, (locale, languageId) =>- {- locale.Name = vendor.GetTranslation(x => x.Name, languageId, false);- locale.Description = vendor.GetTranslation(x => x.Description, languageId, false);- locale.MetaKeywords = vendor.GetTranslation(x => x.MetaKeywords, languageId, false);- locale.MetaDescription = vendor.GetTranslation(x => x.MetaDescription, languageId, false);- locale.MetaTitle = vendor.GetTranslation(x => x.MetaTitle, languageId, false);- locale.SeName = vendor.GetSeName(languageId, false);- });-- //prepare address model- await PrepareVendorAddressModel(model, vendor);-- return View(model);- }+ locale.Name = vendor.GetTranslation(x => x.Name, languageId, false);+ locale.Description = vendor.GetTranslation(x => x.Description, languageId, false);+ locale.MetaKeywords = vendor.GetTranslation(x => x.MetaKeywords, languageId, false);+ locale.MetaDescription = vendor.GetTranslation(x => x.MetaDescription, languageId, false);+ locale.MetaTitle = vendor.GetTranslation(x => x.MetaTitle, languageId, false);+ locale.SeName = vendor.GetSeName(languageId, false);+ });++ //prepare address model+ await PrepareVendorAddressModel(model, vendor);++ return View(model);+ }++ [HttpPost]+ public async Task<IActionResult> Edit(VendorModel model)+ {+ if (!_vendorSettings.AllowVendorsToEditInfo)+ throw new Exception("Vendor can't edit info");- [HttpPost]- public async Task<IActionResult> Edit(VendorModel model)+ var vendor = await _vendorService.GetVendorById(model.Id);+ if (vendor == null || vendor.Deleted || vendor.Id != _workContext.CurrentVendor.Id)+ throw new ArgumentNullException(nameof(vendor));++ if (ModelState.IsValid){- if(!_vendorSettings.AllowVendorsToEditInfo)- throw new Exception("Vendor can't edit info");-- var vendor = await _vendorService.GetVendorById(model.Id);- if (vendor == null || vendor.Deleted || vendor.Id != _workContext.CurrentVendor.Id)- throw new ArgumentNullException(nameof(vendor));-- if (ModelState.IsValid)- {- await UpdateVendorModel(vendor, model);-- Success(_translationService.GetResource("Vendor.Updated"));- return RedirectToAction("Edit");- }- //If we got this far, something failed, redisplay form- //prepare address model- await PrepareVendorAddressModel(model, vendor);- return View(model);+ await UpdateVendorModel(vendor, model);++ Success(_translationService.GetResource("Vendor.Updated"));+ return RedirectToAction("Edit");}-- #endregion+ //If we got this far, something failed, redisplay form+ //prepare address model+ await PrepareVendorAddressModel(model, vendor);+ return View(model);}-}++ #endregion+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Controllers/VendorReviewController.cs b/src/Web/Grand.Web.Vendor/Controllers/VendorReviewController.csindex 040b50eb3..418da2a59 100644--- a/src/Web/Grand.Web.Vendor/Controllers/VendorReviewController.cs+++ b/src/Web/Grand.Web.Vendor/Controllers/VendorReviewController.cs@@ -1,156 +1,150 @@using Grand.Business.Core.Interfaces.Common.Localization;-using Grand.Business.Core.Utilities.Common.Security;using Grand.Business.Core.Interfaces.Customers;+using Grand.Business.Core.Utilities.Common.Security;using Grand.Infrastructure;-using Grand.Web.Vendor.Interfaces;-using Grand.Web.Vendor.Models.VendorReview;using Grand.Web.Common.DataSource;using Grand.Web.Common.Filters;using Grand.Web.Common.Security.Authorization;+using Grand.Web.Vendor.Interfaces;+using Grand.Web.Vendor.Models.VendorReview;using Microsoft.AspNetCore.Mvc;-namespace Grand.Web.Vendor.Controllers+namespace Grand.Web.Vendor.Controllers;++[PermissionAuthorize(PermissionSystemName.VendorReviews)]+public class VendorReviewController : BaseVendorController{- [PermissionAuthorize(PermissionSystemName.VendorReviews)]- public class VendorReviewController : BaseVendorController+ #region Constructors++ public VendorReviewController(+ IVendorReviewViewModelService vendorReviewViewModelService,+ IVendorService vendorService,+ ITranslationService translationService,+ IWorkContext workContext){- #region Fields+ _vendorReviewViewModelService = vendorReviewViewModelService;+ _vendorService = vendorService;+ _translationService = translationService;+ _workContext = workContext;+ }- private readonly IVendorReviewViewModelService _vendorReviewViewModelService;- private readonly IVendorService _vendorService;- private readonly ITranslationService _translationService;- private readonly IWorkContext _workContext;+ #endregion- #endregion Fields+ #region Fields- #region Constructors+ private readonly IVendorReviewViewModelService _vendorReviewViewModelService;+ private readonly IVendorService _vendorService;+ private readonly ITranslationService _translationService;+ private readonly IWorkContext _workContext;- public VendorReviewController(- IVendorReviewViewModelService vendorReviewViewModelService,- IVendorService vendorService,- ITranslationService translationService,- IWorkContext workContext)- {- _vendorReviewViewModelService = vendorReviewViewModelService;- _vendorService = vendorService;- _translationService = translationService;- _workContext = workContext;- }+ #endregion Fields- #endregion+ #region Methods- #region Methods+ //list+ public IActionResult Index()+ {+ return RedirectToAction("List");+ }- //list- public IActionResult Index()- {- return RedirectToAction("List");- }+ public IActionResult List()+ {+ var model = new VendorReviewListModel();+ return View(model);+ }- public IActionResult List()- {- var model = new VendorReviewListModel();- return View(model);- }+ [PermissionAuthorizeAction(PermissionActionName.List)]+ [HttpPost]+ public async Task<IActionResult> List(DataSourceRequest command, VendorReviewListModel model)+ {+ var (vendorReviewModels, totalCount) =+ await _vendorReviewViewModelService.PrepareVendorReviewModel(model, command.Page, command.PageSize);+ var gridModel = new DataSourceResult {+ Data = vendorReviewModels.ToList(),+ Total = totalCount+ };++ return Json(gridModel);+ }- [PermissionAuthorizeAction(PermissionActionName.List)]- [HttpPost]- public async Task<IActionResult> List(DataSourceRequest command, VendorReviewListModel model)- {- var (vendorReviewModels, totalCount) =- await _vendorReviewViewModelService.PrepareVendorReviewModel(model, command.Page, command.PageSize);- var gridModel = new DataSourceResult {- Data = vendorReviewModels.ToList(),- Total = totalCount- };-- return Json(gridModel);- }+ //edit+ [PermissionAuthorizeAction(PermissionActionName.Preview)]+ public async Task<IActionResult> Edit(string id)+ {+ var vendorReview = await _vendorService.GetVendorReviewById(id);- //edit- [PermissionAuthorizeAction(PermissionActionName.Preview)]- public async Task<IActionResult> Edit(string id)- {- var vendorReview = await _vendorService.GetVendorReviewById(id);+ if (vendorReview == null || vendorReview.VendorId != _workContext.CurrentVendor.Id)+ //No vendor review found with the specified id+ return RedirectToAction("List");- if (vendorReview == null || vendorReview.VendorId != _workContext.CurrentVendor.Id)- //No vendor review found with the specified id- return RedirectToAction("List");+ var model = new VendorReviewModel();+ await _vendorReviewViewModelService.PrepareVendorReviewModel(model, vendorReview, false, false);+ return View(model);+ }- var model = new VendorReviewModel();- await _vendorReviewViewModelService.PrepareVendorReviewModel(model, vendorReview, false, false);- return View(model);- }+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ [HttpPost]+ [ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]+ public async Task<IActionResult> Edit(VendorReviewModel model, bool continueEditing)+ {+ var vendorReview = await _vendorService.GetVendorReviewById(model.Id);+ if (vendorReview == null || vendorReview.VendorId != _workContext.CurrentVendor.Id)+ //No vendor review found with the specified id+ return RedirectToAction("List");- [PermissionAuthorizeAction(PermissionActionName.Edit)]- [HttpPost, ArgumentNameFilter(KeyName = "save-continue", Argument = "continueEditing")]- public async Task<IActionResult> Edit(VendorReviewModel model, bool continueEditing)+ if (ModelState.IsValid){- var vendorReview = await _vendorService.GetVendorReviewById(model.Id);- if (vendorReview == null || vendorReview.VendorId != _workContext.CurrentVendor.Id)- //No vendor review found with the specified id- return RedirectToAction("List");-- if (ModelState.IsValid)- {- vendorReview = await _vendorReviewViewModelService.UpdateVendorReviewModel(vendorReview, model);- Success(_translationService.GetResource("Admin.VendorReviews.Updated"));- return continueEditing- ? RedirectToAction("Edit", new { id = vendorReview.Id, vendorReview.VendorId })- : RedirectToAction("List");- }-- //If we got this far, something failed, redisplay form- await _vendorReviewViewModelService.PrepareVendorReviewModel(model, vendorReview, true, false);- return View(model);+ vendorReview = await _vendorReviewViewModelService.UpdateVendorReviewModel(vendorReview, model);+ Success(_translationService.GetResource("Admin.VendorReviews.Updated"));+ return continueEditing+ ? RedirectToAction("Edit", new { id = vendorReview.Id, vendorReview.VendorId })+ : RedirectToAction("List");}- //delete- [PermissionAuthorizeAction(PermissionActionName.Delete)]- [HttpPost]- public async Task<IActionResult> Delete(string id)- {- var vendorReview = await _vendorService.GetVendorReviewById(id);- if (vendorReview == null || vendorReview.VendorId != _workContext.CurrentVendor.Id)- //No vendor review found with the specified id- return RedirectToAction("List");+ //If we got this far, something failed, redisplay form+ await _vendorReviewViewModelService.PrepareVendorReviewModel(model, vendorReview, true, false);+ return View(model);+ }- if (ModelState.IsValid)- {- await _vendorReviewViewModelService.DeleteVendorReview(vendorReview);+ //delete+ [PermissionAuthorizeAction(PermissionActionName.Delete)]+ [HttpPost]+ public async Task<IActionResult> Delete(string id)+ {+ var vendorReview = await _vendorService.GetVendorReviewById(id);+ if (vendorReview == null || vendorReview.VendorId != _workContext.CurrentVendor.Id)+ //No vendor review found with the specified id+ return RedirectToAction("List");- Success(_translationService.GetResource("Admin.VendorReviews.Deleted"));- return RedirectToAction("List");- }+ if (ModelState.IsValid)+ {+ await _vendorReviewViewModelService.DeleteVendorReview(vendorReview);- Error(ModelState);- return RedirectToAction("Edit", new { id });+ Success(_translationService.GetResource("Admin.VendorReviews.Deleted"));+ return RedirectToAction("List");}- [HttpPost]- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> ApproveSelected(ICollection<string> selectedIds)- {- if (selectedIds != null)- {- await _vendorReviewViewModelService.ApproveVendorReviews(selectedIds.ToList());- }+ Error(ModelState);+ return RedirectToAction("Edit", new { id });+ }- return Json(new { Result = true });- }+ [HttpPost]+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> ApproveSelected(ICollection<string> selectedIds)+ {+ if (selectedIds != null) await _vendorReviewViewModelService.ApproveVendorReviews(selectedIds.ToList());- [HttpPost]- [PermissionAuthorizeAction(PermissionActionName.Edit)]- public async Task<IActionResult> DisapproveSelected(ICollection<string> selectedIds)- {- if (selectedIds != null)- {- await _vendorReviewViewModelService.DisapproveVendorReviews(selectedIds.ToList());- }+ return Json(new { Result = true });+ }- return Json(new { Result = true });- }+ [HttpPost]+ [PermissionAuthorizeAction(PermissionActionName.Edit)]+ public async Task<IActionResult> DisapproveSelected(ICollection<string> selectedIds)+ {+ if (selectedIds != null) await _vendorReviewViewModelService.DisapproveVendorReviews(selectedIds.ToList());- #endregion+ return Json(new { Result = true });}++ #endregion}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Endpoints/EndpointProvider.cs b/src/Web/Grand.Web.Vendor/Endpoints/EndpointProvider.csindex 8d8572c31..ab952011d 100644--- a/src/Web/Grand.Web.Vendor/Endpoints/EndpointProvider.cs+++ b/src/Web/Grand.Web.Vendor/Endpoints/EndpointProvider.cs@@ -3,26 +3,26 @@ using Grand.Web.Vendor.Extensions;using Microsoft.AspNetCore.Builder;using Microsoft.AspNetCore.Routing;-namespace Grand.Web.Vendor.Endpoints+namespace Grand.Web.Vendor.Endpoints;++public class EndpointProvider : IEndpointProvider{- public class EndpointProvider : IEndpointProvider+ public void RegisterEndpoint(IEndpointRouteBuilder endpointRouteBuilder){- public void RegisterEndpoint(IEndpointRouteBuilder endpointRouteBuilder)- {- //area vendor- endpointRouteBuilder.MapAreaControllerRoute(- name: "vendorareas",- areaName: Constants.AreaVendor,- pattern: $"{Constants.AreaVendor}/{{controller=Home}}/{{action=Index}}/{{id?}}");-- //vendor index- endpointRouteBuilder.MapControllerRoute("VendorIndex", "vendor/", new { controller = "Home", action = "Index", area = Constants.AreaVendor });+ //area vendor+ endpointRouteBuilder.MapAreaControllerRoute(+ "vendorareas",+ Constants.AreaVendor,+ $"{Constants.AreaVendor}/{{controller=Home}}/{{action=Index}}/{{id?}}");- //vendor login- endpointRouteBuilder.MapControllerRoute("VendorLogin", "vendor/login/", new { controller = "Login", action = "Index", area = Constants.AreaVendor });-- }- public int Priority => 10;+ //vendor index+ endpointRouteBuilder.MapControllerRoute("VendorIndex", "vendor/",+ new { controller = "Home", action = "Index", area = Constants.AreaVendor });+ //vendor login+ endpointRouteBuilder.MapControllerRoute("VendorLogin", "vendor/login/",+ new { controller = "Login", action = "Index", area = Constants.AreaVendor });}-}++ public int Priority => 10;+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Extensions/AddressMappingExtensions.cs b/src/Web/Grand.Web.Vendor/Extensions/AddressMappingExtensions.csindex 9e7afaacc..94d13fa35 100644--- a/src/Web/Grand.Web.Vendor/Extensions/AddressMappingExtensions.cs+++ b/src/Web/Grand.Web.Vendor/Extensions/AddressMappingExtensions.cs@@ -5,199 +5,183 @@ using Grand.Domain.Common;using Grand.Infrastructure.Mapper;using Grand.Web.Vendor.Models.Common;-namespace Grand.Web.Vendor.Extensions+namespace Grand.Web.Vendor.Extensions;++public static class AddressMappingExtensions{- public static class AddressMappingExtensions+ public static async Task<AddressModel> ToModel(this Address entity, ICountryService countryService){- public static async Task<AddressModel> ToModel(this Address entity, ICountryService countryService)- {- var address = entity.MapTo<Address, AddressModel>();- var country = await countryService.GetCountryById(address.CountryId);- if (country != null && !string.IsNullOrEmpty(address.CountryId))- {- address.CountryName = country?.Name;- }+ var address = entity.MapTo<Address, AddressModel>();+ var country = await countryService.GetCountryById(address.CountryId);+ if (country != null && !string.IsNullOrEmpty(address.CountryId)) address.CountryName = country?.Name;- if (country != null && !string.IsNullOrEmpty(address.StateProvinceId))- {- address.StateProvinceName =- country?.StateProvinces.FirstOrDefault(x => x.Id == address.StateProvinceId)?.Name;- }+ if (country != null && !string.IsNullOrEmpty(address.StateProvinceId))+ address.StateProvinceName =+ country?.StateProvinces.FirstOrDefault(x => x.Id == address.StateProvinceId)?.Name;- return address;- }+ return address;+ }- public static Address ToEntity(this AddressModel model)- {- return model.MapTo<AddressModel, Address>();- }-- public static async Task PrepareCustomAddressAttributes(this AddressModel model,- Address address,- IAddressAttributeService addressAttributeService,- IAddressAttributeParser addressAttributeParser)+ public static Address ToEntity(this AddressModel model)+ {+ return model.MapTo<AddressModel, Address>();+ }++ public static async Task PrepareCustomAddressAttributes(this AddressModel model,+ Address address,+ IAddressAttributeService addressAttributeService,+ IAddressAttributeParser addressAttributeParser)+ {+ ArgumentNullException.ThrowIfNull(addressAttributeService);+ ArgumentNullException.ThrowIfNull(addressAttributeParser);++ var attributes = await addressAttributeService.GetAllAddressAttributes();+ foreach (var attribute in attributes){- ArgumentNullException.ThrowIfNull(addressAttributeService);- ArgumentNullException.ThrowIfNull(addressAttributeParser);+ var attributeModel = new AddressModel.AddressAttributeModel {+ Id = attribute.Id,+ Name = attribute.Name,+ IsRequired = attribute.IsRequired,+ AttributeControlType = attribute.AttributeControlType+ };- var attributes = await addressAttributeService.GetAllAddressAttributes();- foreach (var attribute in attributes)+ if (attribute.ShouldHaveValues()){- var attributeModel = new AddressModel.AddressAttributeModel {- Id = attribute.Id,- Name = attribute.Name,- IsRequired = attribute.IsRequired,- AttributeControlType = attribute.AttributeControlType- };-- if (attribute.ShouldHaveValues())+ //values+ var attributeValues = attribute.AddressAttributeValues;+ foreach (var attributeValue in attributeValues){- //values- var attributeValues = attribute.AddressAttributeValues;- foreach (var attributeValue in attributeValues)- {- var attributeValueModel = new AddressModel.AddressAttributeValueModel {- Id = attributeValue.Id,- Name = attributeValue.Name,- IsPreSelected = attributeValue.IsPreSelected- };- attributeModel.Values.Add(attributeValueModel);- }+ var attributeValueModel = new AddressModel.AddressAttributeValueModel {+ Id = attributeValue.Id,+ Name = attributeValue.Name,+ IsPreSelected = attributeValue.IsPreSelected+ };+ attributeModel.Values.Add(attributeValueModel);}+ }- //set already selected attributes- var selectedAddressAttributes = address != null ? address.Attributes : new List<CustomAttribute>();- switch (attribute.AttributeControlType)+ //set already selected attributes+ var selectedAddressAttributes = address != null ? address.Attributes : new List<CustomAttribute>();+ switch (attribute.AttributeControlType)+ {+ case AttributeControlType.DropdownList:+ case AttributeControlType.RadioList:+ case AttributeControlType.Checkboxes:{- case AttributeControlType.DropdownList:- case AttributeControlType.RadioList:- case AttributeControlType.Checkboxes:+ if (selectedAddressAttributes.Any()){- if (selectedAddressAttributes.Any())- {- //clear default selection- foreach (var item in attributeModel.Values)- item.IsPreSelected = false;+ //clear default selection+ foreach (var item in attributeModel.Values)+ item.IsPreSelected = false;- //select new values- var selectedValues =- await addressAttributeParser.ParseAddressAttributeValues(selectedAddressAttributes);- foreach (var attributeValue in selectedValues)- if (attributeModel.Id == attributeValue.AddressAttributeId)- foreach (var item in attributeModel.Values)- if (attributeValue.Id == item.Id)- item.IsPreSelected = true;- }- }- break;- case AttributeControlType.ReadonlyCheckboxes:- {- //do nothing- //values are already pre-set+ //select new values+ var selectedValues =+ await addressAttributeParser.ParseAddressAttributeValues(selectedAddressAttributes);+ foreach (var attributeValue in selectedValues)+ if (attributeModel.Id == attributeValue.AddressAttributeId)+ foreach (var item in attributeModel.Values)+ if (attributeValue.Id == item.Id)+ item.IsPreSelected = true;}- break;- case AttributeControlType.TextBox:- case AttributeControlType.MultilineTextbox:+ }+ break;+ case AttributeControlType.ReadonlyCheckboxes:+ {+ //do nothing+ //values are already pre-set+ }+ break;+ case AttributeControlType.TextBox:+ case AttributeControlType.MultilineTextbox:+ {+ if (selectedAddressAttributes.Any()){- if (selectedAddressAttributes.Any())- {- var enteredText = selectedAddressAttributes.Where(x => x.Key == attribute.Id)- .Select(x => x.Value).ToList();- if (enteredText.Count > 0)- attributeModel.DefaultValue = enteredText[0];- }+ var enteredText = selectedAddressAttributes.Where(x => x.Key == attribute.Id)+ .Select(x => x.Value).ToList();+ if (enteredText.Count > 0)+ attributeModel.DefaultValue = enteredText[0];}- break;- case AttributeControlType.ColorSquares:- case AttributeControlType.Datepicker:- case AttributeControlType.FileUpload:- case AttributeControlType.ImageSquares:- default:- //not supported attribute control types- break;}-- model.CustomAddressAttributes.Add(attributeModel);+ break;+ case AttributeControlType.ColorSquares:+ case AttributeControlType.Datepicker:+ case AttributeControlType.FileUpload:+ case AttributeControlType.ImageSquares:+ default:+ //not supported attribute control types+ break;}++ model.CustomAddressAttributes.Add(attributeModel);}+ }- public static async Task<List<CustomAttribute>> ParseCustomAddressAttributes(this AddressModel address,- IAddressAttributeParser addressAttributeParser,- IAddressAttributeService addressAttributeService)- {- ArgumentNullException.ThrowIfNull(address);+ public static async Task<List<CustomAttribute>> ParseCustomAddressAttributes(this AddressModel address,+ IAddressAttributeParser addressAttributeParser,+ IAddressAttributeService addressAttributeService)+ {+ ArgumentNullException.ThrowIfNull(address);- var customAttributes = new List<CustomAttribute>();- var attributes = await addressAttributeService.GetAllAddressAttributes();- foreach (var attribute in attributes)+ var customAttributes = new List<CustomAttribute>();+ var attributes = await addressAttributeService.GetAllAddressAttributes();+ foreach (var attribute in attributes)+ switch (attribute.AttributeControlType){- switch (attribute.AttributeControlType)+ case AttributeControlType.DropdownList:+ case AttributeControlType.RadioList:{- case AttributeControlType.DropdownList:- case AttributeControlType.RadioList:- {- var ctrlAttributes = address.SelectedAttributes.FirstOrDefault(x => x.Key == attribute.Id)- ?.Value;- if (!string.IsNullOrEmpty(ctrlAttributes))- {- customAttributes = addressAttributeParser.AddAddressAttribute(customAttributes,- attribute, ctrlAttributes).ToList();- }- }- break;- case AttributeControlType.Checkboxes:- {- var cblAttributes = address.SelectedAttributes.FirstOrDefault(x => x.Key == attribute.Id)- ?.Value;- if (!string.IsNullOrEmpty(cblAttributes))- {- foreach (var item in cblAttributes.Split(','))- {- if (!string.IsNullOrEmpty(item))- customAttributes = addressAttributeParser.AddAddressAttribute(customAttributes,- attribute, item).ToList();- }- }- }- break;- case AttributeControlType.ReadonlyCheckboxes:- {- //load read-only (already server-side selected) values- var attributeValues = attribute.AddressAttributeValues;- foreach (var selectedAttributeId in attributeValues- .Where(v => v.IsPreSelected)- .Select(v => v.Id)- .ToList())- {- customAttributes = addressAttributeParser.AddAddressAttribute(customAttributes,- attribute, selectedAttributeId).ToList();- }- }- break;- case AttributeControlType.TextBox:- case AttributeControlType.MultilineTextbox:+ var ctrlAttributes = address.SelectedAttributes.FirstOrDefault(x => x.Key == attribute.Id)+ ?.Value;+ if (!string.IsNullOrEmpty(ctrlAttributes))+ customAttributes = addressAttributeParser.AddAddressAttribute(customAttributes,+ attribute, ctrlAttributes).ToList();+ }+ break;+ case AttributeControlType.Checkboxes:+ {+ var cblAttributes = address.SelectedAttributes.FirstOrDefault(x => x.Key == attribute.Id)+ ?.Value;+ if (!string.IsNullOrEmpty(cblAttributes))+ foreach (var item in cblAttributes.Split(','))+ if (!string.IsNullOrEmpty(item))+ customAttributes = addressAttributeParser.AddAddressAttribute(customAttributes,+ attribute, item).ToList();+ }+ break;+ case AttributeControlType.ReadonlyCheckboxes:+ {+ //load read-only (already server-side selected) values+ var attributeValues = attribute.AddressAttributeValues;+ foreach (var selectedAttributeId in attributeValues+ .Where(v => v.IsPreSelected)+ .Select(v => v.Id)+ .ToList())+ customAttributes = addressAttributeParser.AddAddressAttribute(customAttributes,+ attribute, selectedAttributeId).ToList();+ }+ break;+ case AttributeControlType.TextBox:+ case AttributeControlType.MultilineTextbox:+ {+ var ctrlAttributes = address.SelectedAttributes.FirstOrDefault(x => x.Key == attribute.Id)+ ?.Value;+ if (!string.IsNullOrEmpty(ctrlAttributes)){- var ctrlAttributes = address.SelectedAttributes.FirstOrDefault(x => x.Key == attribute.Id)- ?.Value;- if (!string.IsNullOrEmpty(ctrlAttributes))- {- var enteredText = ctrlAttributes.Trim();- customAttributes = addressAttributeParser.AddAddressAttribute(customAttributes,- attribute, enteredText).ToList();- }+ var enteredText = ctrlAttributes.Trim();+ customAttributes = addressAttributeParser.AddAddressAttribute(customAttributes,+ attribute, enteredText).ToList();}- break;- case AttributeControlType.Datepicker:- case AttributeControlType.ColorSquares:- case AttributeControlType.ImageSquares:- case AttributeControlType.FileUpload:- //not supported address attributes- default:- break;}+ break;+ case AttributeControlType.Datepicker:+ case AttributeControlType.ColorSquares:+ case AttributeControlType.ImageSquares:+ case AttributeControlType.FileUpload:+ //not supported address attributes+ default:+ break;}- return customAttributes;- }+ return customAttributes;}}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Extensions/Constants.cs b/src/Web/Grand.Web.Vendor/Extensions/Constants.csindex fcab1988b..fa73cec34 100644--- a/src/Web/Grand.Web.Vendor/Extensions/Constants.cs+++ b/src/Web/Grand.Web.Vendor/Extensions/Constants.cs@@ -1,9 +1,8 @@-namespace Grand.Web.Vendor.Extensions+namespace Grand.Web.Vendor.Extensions;++public static class Constants{- public static class Constants- {- public const string AreaVendor = "Vendor";- public static string LayoutVendor => $"~/Areas/{AreaVendor}/Views/Shared/_VendorLayout.cshtml";- public static string LayoutVendorLogin => $"~/Areas/{AreaVendor}/Views/Shared/_VendorLoginLayout.cshtml";- }-}+ public const string AreaVendor = "Vendor";+ public static string LayoutVendor => $"~/Areas/{AreaVendor}/Views/Shared/_VendorLayout.cshtml";+ public static string LayoutVendorLogin => $"~/Areas/{AreaVendor}/Views/Shared/_VendorLoginLayout.cshtml";+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Extensions/FileExtensions.cs b/src/Web/Grand.Web.Vendor/Extensions/FileExtensions.csindex 60eedf57a..a89cfbbe4 100644--- a/src/Web/Grand.Web.Vendor/Extensions/FileExtensions.cs+++ b/src/Web/Grand.Web.Vendor/Extensions/FileExtensions.cs@@ -4,8 +4,8 @@ public static class FileExtensions{public static IList<string> GetAllowedMediaFileTypes(string allowedFileTypes){- return string.IsNullOrEmpty(allowedFileTypes) ? [".gif", ".jpg", ".jpeg", ".png", ".bmp", ".webp"]- :- allowedFileTypes.Split(',').Select(x => x.Trim().ToLowerInvariant()).ToList();+ return string.IsNullOrEmpty(allowedFileTypes)+ ? [".gif", ".jpg", ".jpeg", ".png", ".bmp", ".webp"]+ : allowedFileTypes.Split(',').Select(x => x.Trim().ToLowerInvariant()).ToList();}}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Extensions/HasAccess.cs b/src/Web/Grand.Web.Vendor/Extensions/HasAccess.csindex 52dad6735..290997687 100644--- a/src/Web/Grand.Web.Vendor/Extensions/HasAccess.cs+++ b/src/Web/Grand.Web.Vendor/Extensions/HasAccess.cs@@ -1,38 +1,38 @@-using Grand.Infrastructure;-using Grand.Domain.Catalog;+using Grand.Domain.Catalog;using Grand.Domain.Orders;using Grand.Domain.Shipping;+using Grand.Infrastructure;-namespace Grand.Web.Vendor.Extensions+namespace Grand.Web.Vendor.Extensions;++public static class HasAccess{- public static class HasAccess+ public static bool HasAccessToProduct(this IWorkContext workContext, Product product){- public static bool HasAccessToProduct(this IWorkContext workContext, Product product)- {- ArgumentNullException.ThrowIfNull(product);+ ArgumentNullException.ThrowIfNull(product);++ return product.VendorId == workContext.CurrentVendor.Id;+ }- return product.VendorId == workContext.CurrentVendor.Id;- }+ public static bool HasAccessToOrder(this IWorkContext workContext, Order order)+ {+ ArgumentNullException.ThrowIfNull(order);- public static bool HasAccessToOrder(this IWorkContext workContext, Order order)- {- ArgumentNullException.ThrowIfNull(order);+ var hasVendorProducts = order.OrderItems.Any(orderItem => orderItem.VendorId == workContext.CurrentVendor.Id);+ return hasVendorProducts;+ }- var hasVendorProducts = order.OrderItems.Any(orderItem => orderItem.VendorId == workContext.CurrentVendor.Id);- return hasVendorProducts;- }+ public static bool HasAccessToOrderItem(this IWorkContext workContext, OrderItem orderItem)+ {+ ArgumentNullException.ThrowIfNull(orderItem);- public static bool HasAccessToOrderItem(this IWorkContext workContext, OrderItem orderItem)- {- ArgumentNullException.ThrowIfNull(orderItem);+ return orderItem.VendorId == workContext.CurrentVendor.Id;+ }- return orderItem.VendorId == workContext.CurrentVendor.Id;- }- public static bool HasAccessToShipment(this IWorkContext workContext, Shipment shipment)- {- ArgumentNullException.ThrowIfNull(shipment);+ public static bool HasAccessToShipment(this IWorkContext workContext, Shipment shipment)+ {+ ArgumentNullException.ThrowIfNull(shipment);- return shipment.VendorId == workContext.CurrentVendor.Id;- }+ return shipment.VendorId == workContext.CurrentVendor.Id;}-}+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Extensions/ProductExtensions.cs b/src/Web/Grand.Web.Vendor/Extensions/ProductExtensions.csindex 6f430afcc..b41b76a19 100644--- a/src/Web/Grand.Web.Vendor/Extensions/ProductExtensions.cs+++ b/src/Web/Grand.Web.Vendor/Extensions/ProductExtensions.cs@@ -4,74 +4,67 @@ using Grand.Domain.Catalog;using Grand.Domain.Common;using Grand.Domain.Media;-namespace Grand.Web.Vendor.Extensions+namespace Grand.Web.Vendor.Extensions;++public static class ProductExtensions{- public static class ProductExtensions+ /// <summary>+ /// Get product picture (for shopping cart and order details pages)+ /// </summary>+ /// <param name="product">Product</param>+ /// <param name="attributes">Attributes</param>+ /// <param name="productService">Product service</param>+ /// <param name="pictureService">Picture service</param>+ /// <returns>Picture</returns>+ public static async Task<Picture> GetProductPicture(this Product product, IList<CustomAttribute> attributes,+ IProductService productService, IPictureService pictureService){- /// <summary>- /// Get product picture (for shopping cart and order details pages)- /// </summary>- /// <param name="product">Product</param>- /// <param name="attributes">Attributes</param>- /// <param name="productService">Product service</param>- /// <param name="pictureService">Picture service</param>- /// <returns>Picture</returns>- public static async Task<Picture> GetProductPicture(this Product product, IList<CustomAttribute> attributes,- IProductService productService, IPictureService pictureService)- {- ArgumentNullException.ThrowIfNull(product);- ArgumentNullException.ThrowIfNull(pictureService);-- Picture picture = null;+ ArgumentNullException.ThrowIfNull(product);+ ArgumentNullException.ThrowIfNull(pictureService);- if (attributes != null && attributes.Any())- {+ Picture picture = null;- var comb = product.FindProductAttributeCombination(attributes);- if (comb != null)+ if (attributes != null && attributes.Any())+ {+ var comb = product.FindProductAttributeCombination(attributes);+ if (comb != null)+ if (!string.IsNullOrEmpty(comb.PictureId)){- if (!string.IsNullOrEmpty(comb.PictureId))- {- var combPicture = await pictureService.GetPictureById(comb.PictureId);- if (combPicture != null)- {- picture = combPicture;- }- }+ var combPicture = await pictureService.GetPictureById(comb.PictureId);+ if (combPicture != null) picture = combPicture;}- if (picture == null)++ if (picture == null)+ {+ var attributeValues = product.ParseProductAttributeValues(attributes);+ foreach (var attributeValue in attributeValues){- var attributeValues = product.ParseProductAttributeValues(attributes);- foreach (var attributeValue in attributeValues)+ var attributePicture = await pictureService.GetPictureById(attributeValue.PictureId);+ if (attributePicture != null){- var attributePicture = await pictureService.GetPictureById(attributeValue.PictureId);- if (attributePicture != null)- {- picture = attributePicture;- break;- }+ picture = attributePicture;+ break;}}}- if (picture == null)- {- var pp = product.ProductPictures.MinBy(x => x.DisplayOrder);- if (pp != null)- picture = await pictureService.GetPictureById(pp.PictureId);- }-- if (picture == null && !product.VisibleIndividually && !string.IsNullOrEmpty(product.ParentGroupedProductId))- {- var parentProduct = await productService.GetProductById(product.ParentGroupedProductId);- if (parentProduct != null)- if (parentProduct.ProductPictures.Any())- {- picture = await pictureService.GetPictureById(parentProduct.ProductPictures.FirstOrDefault()!.PictureId);+ }- }- }+ if (picture == null)+ {+ var pp = product.ProductPictures.MinBy(x => x.DisplayOrder);+ if (pp != null)+ picture = await pictureService.GetPictureById(pp.PictureId);+ }- return picture;+ if (picture == null && !product.VisibleIndividually && !string.IsNullOrEmpty(product.ParentGroupedProductId))+ {+ var parentProduct = await productService.GetProductById(product.ParentGroupedProductId);+ if (parentProduct != null)+ if (parentProduct.ProductPictures.Any())+ picture = await pictureService.GetPictureById(parentProduct.ProductPictures.FirstOrDefault()!+ .PictureId);}++ return picture;}-}+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Extensions/ProductsMappingExtensions.cs b/src/Web/Grand.Web.Vendor/Extensions/ProductsMappingExtensions.csindex 702c7dbd2..1b9f70725 100644--- a/src/Web/Grand.Web.Vendor/Extensions/ProductsMappingExtensions.cs+++ b/src/Web/Grand.Web.Vendor/Extensions/ProductsMappingExtensions.cs@@ -1,112 +1,118 @@using Grand.Business.Core.Interfaces.Common.Directory;using Grand.Domain.Catalog;using Grand.Infrastructure.Mapper;-using Grand.Web.Vendor.Models.Catalog;using Grand.Web.Common.Extensions;+using Grand.Web.Vendor.Models.Catalog;-namespace Grand.Web.Vendor.Extensions+namespace Grand.Web.Vendor.Extensions;++public static class ProductsMappingExtensions{- public static class ProductsMappingExtensions+ public static ProductModel ToModel(this Product entity, IDateTimeService dateTimeService){- public static ProductModel ToModel(this Product entity, IDateTimeService dateTimeService)- {- var product = entity.MapTo<Product, ProductModel>();- product.MarkAsNewStartDateTime = entity.MarkAsNewStartDateTimeUtc.ConvertToUserTime(dateTimeService);- product.MarkAsNewEndDateTime = entity.MarkAsNewEndDateTimeUtc.ConvertToUserTime(dateTimeService);- product.AvailableStartDateTime = entity.AvailableStartDateTimeUtc.ConvertToUserTime(dateTimeService);- product.AvailableEndDateTime = entity.AvailableEndDateTimeUtc.ConvertToUserTime(dateTimeService);- product.PreOrderDateTime = entity.PreOrderDateTimeUtc.ConvertToUserTime(dateTimeService);- return product;+ var product = entity.MapTo<Product, ProductModel>();+ product.MarkAsNewStartDateTime = entity.MarkAsNewStartDateTimeUtc.ConvertToUserTime(dateTimeService);+ product.MarkAsNewEndDateTime = entity.MarkAsNewEndDateTimeUtc.ConvertToUserTime(dateTimeService);+ product.AvailableStartDateTime = entity.AvailableStartDateTimeUtc.ConvertToUserTime(dateTimeService);+ product.AvailableEndDateTime = entity.AvailableEndDateTimeUtc.ConvertToUserTime(dateTimeService);+ product.PreOrderDateTime = entity.PreOrderDateTimeUtc.ConvertToUserTime(dateTimeService);+ return product;+ }- }+ public static Product ToEntity(this ProductModel model, IDateTimeService dateTimeService)+ {+ var product = model.MapTo<ProductModel, Product>();+ product.MarkAsNewStartDateTimeUtc = model.MarkAsNewStartDateTime.ConvertToUtcTime(dateTimeService);+ product.MarkAsNewEndDateTimeUtc = model.MarkAsNewEndDateTime.ConvertToUtcTime(dateTimeService);+ product.AvailableStartDateTimeUtc = model.AvailableStartDateTime.ConvertToUtcTime(dateTimeService);+ product.AvailableEndDateTimeUtc = model.AvailableEndDateTime.ConvertToUtcTime(dateTimeService);+ product.PreOrderDateTimeUtc = model.PreOrderDateTime.ConvertToUtcTime(dateTimeService);- public static Product ToEntity(this ProductModel model, IDateTimeService dateTimeService)- {- var product = model.MapTo<ProductModel, Product>();- product.MarkAsNewStartDateTimeUtc = model.MarkAsNewStartDateTime.ConvertToUtcTime(dateTimeService);- product.MarkAsNewEndDateTimeUtc = model.MarkAsNewEndDateTime.ConvertToUtcTime(dateTimeService);- product.AvailableStartDateTimeUtc = model.AvailableStartDateTime.ConvertToUtcTime(dateTimeService);- product.AvailableEndDateTimeUtc = model.AvailableEndDateTime.ConvertToUtcTime(dateTimeService);- product.PreOrderDateTimeUtc = model.PreOrderDateTime.ConvertToUtcTime(dateTimeService);-- return product;- }+ return product;+ }- public static Product ToEntity(this ProductModel model, Product destination, IDateTimeService dateTimeService)- {- var product = model.MapTo(destination);- product.MarkAsNewStartDateTimeUtc = model.MarkAsNewStartDateTime.ConvertToUtcTime(dateTimeService);- product.MarkAsNewEndDateTimeUtc = model.MarkAsNewEndDateTime.ConvertToUtcTime(dateTimeService);- product.AvailableStartDateTimeUtc = model.AvailableStartDateTime.ConvertToUtcTime(dateTimeService);- product.AvailableEndDateTimeUtc = model.AvailableEndDateTime.ConvertToUtcTime(dateTimeService);- product.PreOrderDateTimeUtc = model.PreOrderDateTime.ConvertToUtcTime(dateTimeService);- return product;- }- public static ProductModel.ProductAttributeMappingModel ToModel(this ProductAttributeMapping entity)- {- return entity.MapTo<ProductAttributeMapping, ProductModel.ProductAttributeMappingModel>();- }+ public static Product ToEntity(this ProductModel model, Product destination, IDateTimeService dateTimeService)+ {+ var product = model.MapTo(destination);+ product.MarkAsNewStartDateTimeUtc = model.MarkAsNewStartDateTime.ConvertToUtcTime(dateTimeService);+ product.MarkAsNewEndDateTimeUtc = model.MarkAsNewEndDateTime.ConvertToUtcTime(dateTimeService);+ product.AvailableStartDateTimeUtc = model.AvailableStartDateTime.ConvertToUtcTime(dateTimeService);+ product.AvailableEndDateTimeUtc = model.AvailableEndDateTime.ConvertToUtcTime(dateTimeService);+ product.PreOrderDateTimeUtc = model.PreOrderDateTime.ConvertToUtcTime(dateTimeService);+ return product;+ }- public static ProductAttributeMapping ToEntity(this ProductModel.ProductAttributeMappingModel model)- {- return model.MapTo<ProductModel.ProductAttributeMappingModel, ProductAttributeMapping>();- }+ public static ProductModel.ProductAttributeMappingModel ToModel(this ProductAttributeMapping entity)+ {+ return entity.MapTo<ProductAttributeMapping, ProductModel.ProductAttributeMappingModel>();+ }- public static ProductAttributeMapping ToEntity(this ProductModel.ProductAttributeMappingModel model, ProductAttributeMapping destination)- {- return model.MapTo(destination);- }- public static ProductAttributeCombinationModel ToModel(this ProductAttributeCombination entity)- {- return entity.MapTo<ProductAttributeCombination, ProductAttributeCombinationModel>();- }+ public static ProductAttributeMapping ToEntity(this ProductModel.ProductAttributeMappingModel model)+ {+ return model.MapTo<ProductModel.ProductAttributeMappingModel, ProductAttributeMapping>();+ }- public static ProductModel.AddProductSpecificationAttributeModel ToModel(this ProductSpecificationAttribute entity)- {- return entity.MapTo<ProductSpecificationAttribute, ProductModel.AddProductSpecificationAttributeModel>();- }- public static ProductSpecificationAttribute ToEntity(this ProductModel.AddProductSpecificationAttributeModel model)- {- return model.MapTo<ProductModel.AddProductSpecificationAttributeModel, ProductSpecificationAttribute>();- }+ public static ProductAttributeMapping ToEntity(this ProductModel.ProductAttributeMappingModel model,+ ProductAttributeMapping destination)+ {+ return model.MapTo(destination);+ }- public static ProductSpecificationAttribute ToEntity(this ProductModel.AddProductSpecificationAttributeModel model, ProductSpecificationAttribute destination)- {- if(model.AttributeTypeId != SpecificationAttributeType.Option)- {- model.SpecificationAttributeId = "";- model.SpecificationAttributeOptionId = "";- model.AllowFiltering = false;- }- return model.MapTo(destination);- }- public static ProductAttributeValue ToEntity(this PredefinedProductAttributeValue model)- {- return model.MapTo<PredefinedProductAttributeValue, ProductAttributeValue>();- }-- public static ProductModel.TierPriceModel ToModel(this TierPrice entity, IDateTimeService dateTimeService)- {- var tierprice = entity.MapTo<TierPrice, ProductModel.TierPriceModel>();- tierprice.StartDateTime = entity.StartDateTimeUtc.ConvertToUserTime(dateTimeService);- tierprice.EndDateTime = entity.EndDateTimeUtc.ConvertToUserTime(dateTimeService);- return tierprice;- }+ public static ProductAttributeCombinationModel ToModel(this ProductAttributeCombination entity)+ {+ return entity.MapTo<ProductAttributeCombination, ProductAttributeCombinationModel>();+ }- public static TierPrice ToEntity(this ProductModel.TierPriceModel model, IDateTimeService dateTimeService)- {- var tierprice = model.MapTo<ProductModel.TierPriceModel, TierPrice>();- tierprice.StartDateTimeUtc = model.StartDateTime.ConvertToUtcTime(dateTimeService);- tierprice.EndDateTimeUtc = model.EndDateTime.ConvertToUtcTime(dateTimeService);- return tierprice;- }+ public static ProductModel.AddProductSpecificationAttributeModel ToModel(this ProductSpecificationAttribute entity)+ {+ return entity.MapTo<ProductSpecificationAttribute, ProductModel.AddProductSpecificationAttributeModel>();+ }++ public static ProductSpecificationAttribute ToEntity(this ProductModel.AddProductSpecificationAttributeModel model)+ {+ return model.MapTo<ProductModel.AddProductSpecificationAttributeModel, ProductSpecificationAttribute>();+ }- public static TierPrice ToEntity(this ProductModel.TierPriceModel model, TierPrice destination, IDateTimeService dateTimeService)+ public static ProductSpecificationAttribute ToEntity(this ProductModel.AddProductSpecificationAttributeModel model,+ ProductSpecificationAttribute destination)+ {+ if (model.AttributeTypeId != SpecificationAttributeType.Option){- var tierprice = model.MapTo(destination);- tierprice.StartDateTimeUtc = model.StartDateTime.ConvertToUtcTime(dateTimeService);- tierprice.EndDateTimeUtc = model.EndDateTime.ConvertToUtcTime(dateTimeService);- return tierprice;+ model.SpecificationAttributeId = "";+ model.SpecificationAttributeOptionId = "";+ model.AllowFiltering = false;}++ return model.MapTo(destination);+ }++ public static ProductAttributeValue ToEntity(this PredefinedProductAttributeValue model)+ {+ return model.MapTo<PredefinedProductAttributeValue, ProductAttributeValue>();+ }++ public static ProductModel.TierPriceModel ToModel(this TierPrice entity, IDateTimeService dateTimeService)+ {+ var tierprice = entity.MapTo<TierPrice, ProductModel.TierPriceModel>();+ tierprice.StartDateTime = entity.StartDateTimeUtc.ConvertToUserTime(dateTimeService);+ tierprice.EndDateTime = entity.EndDateTimeUtc.ConvertToUserTime(dateTimeService);+ return tierprice;+ }++ public static TierPrice ToEntity(this ProductModel.TierPriceModel model, IDateTimeService dateTimeService)+ {+ var tierprice = model.MapTo<ProductModel.TierPriceModel, TierPrice>();+ tierprice.StartDateTimeUtc = model.StartDateTime.ConvertToUtcTime(dateTimeService);+ tierprice.EndDateTimeUtc = model.EndDateTime.ConvertToUtcTime(dateTimeService);+ return tierprice;+ }++ public static TierPrice ToEntity(this ProductModel.TierPriceModel model, TierPrice destination,+ IDateTimeService dateTimeService)+ {+ var tierprice = model.MapTo(destination);+ tierprice.StartDateTimeUtc = model.StartDateTime.ConvertToUtcTime(dateTimeService);+ tierprice.EndDateTimeUtc = model.EndDateTime.ConvertToUtcTime(dateTimeService);+ return tierprice;}}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Extensions/VendorMappingExtensions.cs b/src/Web/Grand.Web.Vendor/Extensions/VendorMappingExtensions.csindex a78953e05..acfcf139f 100644--- a/src/Web/Grand.Web.Vendor/Extensions/VendorMappingExtensions.cs+++ b/src/Web/Grand.Web.Vendor/Extensions/VendorMappingExtensions.cs@@ -1,21 +1,19 @@using Grand.Infrastructure.Mapper;using Grand.Web.Vendor.Models.Vendor;-namespace Grand.Web.Vendor.Extensions+namespace Grand.Web.Vendor.Extensions;++public static class VendorMappingExtensions{- public static class VendorMappingExtensions+ public static VendorModel ToModel(this Domain.Vendors.Vendor entity){- public static VendorModel ToModel(this Domain.Vendors.Vendor entity)- {- var vendor = entity.MapTo<Domain.Vendors.Vendor, VendorModel>();- return vendor;+ var vendor = entity.MapTo<Domain.Vendors.Vendor, VendorModel>();+ return vendor;+ }- }-- public static Domain.Vendors.Vendor ToEntity(this VendorModel model, Domain.Vendors.Vendor destination)- {- var product = model.MapTo(destination);- return product;- }- }+ public static Domain.Vendors.Vendor ToEntity(this VendorModel model, Domain.Vendors.Vendor destination)+ {+ var product = model.MapTo(destination);+ return product;+ }}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Interfaces/IMerchandiseReturnViewModelService.cs b/src/Web/Grand.Web.Vendor/Interfaces/IMerchandiseReturnViewModelService.csindex 7d1ff7d06..40d38551a 100644--- a/src/Web/Grand.Web.Vendor/Interfaces/IMerchandiseReturnViewModelService.cs+++ b/src/Web/Grand.Web.Vendor/Interfaces/IMerchandiseReturnViewModelService.cs@@ -2,19 +2,29 @@using Grand.Domain.Orders;using Grand.Web.Vendor.Models.MerchandiseReturn;-namespace Grand.Web.Vendor.Interfaces+namespace Grand.Web.Vendor.Interfaces;++public interface IMerchandiseReturnViewModelService{- public interface IMerchandiseReturnViewModelService- {- Task<MerchandiseReturnModel> PrepareMerchandiseReturnModel(MerchandiseReturnModel model,- MerchandiseReturn merchandiseReturn, bool excludeProperties);- Task<(IList<MerchandiseReturnModel> merchandiseReturnModels, int totalCount)> PrepareMerchandiseReturnModel(MerchandiseReturnListModel model, int pageIndex, int pageSize);- MerchandiseReturnListModel PrepareReturnRequestListModel();- Task<IList<MerchandiseReturnModel.MerchandiseReturnItemModel>> PrepareMerchandiseReturnItemModel(string merchandiseReturnId);- Task<MerchandiseReturn> UpdateMerchandiseReturnModel(MerchandiseReturn merchandiseReturn, MerchandiseReturnModel model, List<CustomAttribute> customAddressAttributes);- Task DeleteMerchandiseReturn(MerchandiseReturn merchandiseReturn);- Task<IList<MerchandiseReturnModel.MerchandiseReturnNote>> PrepareMerchandiseReturnNotes(MerchandiseReturn merchandiseReturn);- Task InsertMerchandiseReturnNote(MerchandiseReturn merchandiseReturn, bool displayToCustomer, string message);- Task DeleteMerchandiseReturnNote(MerchandiseReturn merchandiseReturn, string id);- }-}+ Task<MerchandiseReturnModel> PrepareMerchandiseReturnModel(MerchandiseReturnModel model,+ MerchandiseReturn merchandiseReturn, bool excludeProperties);++ Task<(IList<MerchandiseReturnModel> merchandiseReturnModels, int totalCount)> PrepareMerchandiseReturnModel(+ MerchandiseReturnListModel model, int pageIndex, int pageSize);++ MerchandiseReturnListModel PrepareReturnRequestListModel();++ Task<IList<MerchandiseReturnModel.MerchandiseReturnItemModel>> PrepareMerchandiseReturnItemModel(+ string merchandiseReturnId);++ Task<MerchandiseReturn> UpdateMerchandiseReturnModel(MerchandiseReturn merchandiseReturn,+ MerchandiseReturnModel model, List<CustomAttribute> customAddressAttributes);++ Task DeleteMerchandiseReturn(MerchandiseReturn merchandiseReturn);++ Task<IList<MerchandiseReturnModel.MerchandiseReturnNote>> PrepareMerchandiseReturnNotes(+ MerchandiseReturn merchandiseReturn);++ Task InsertMerchandiseReturnNote(MerchandiseReturn merchandiseReturn, bool displayToCustomer, string message);+ Task DeleteMerchandiseReturnNote(MerchandiseReturn merchandiseReturn, string id);+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Interfaces/IOrderViewModelService.cs b/src/Web/Grand.Web.Vendor/Interfaces/IOrderViewModelService.csindex 7d75cc24d..a1fb5d64a 100644--- a/src/Web/Grand.Web.Vendor/Interfaces/IOrderViewModelService.cs+++ b/src/Web/Grand.Web.Vendor/Interfaces/IOrderViewModelService.cs@@ -1,14 +1,16 @@using Grand.Domain.Orders;using Grand.Web.Vendor.Models.Orders;-namespace Grand.Web.Vendor.Interfaces+namespace Grand.Web.Vendor.Interfaces;++public interface IOrderViewModelService{- public interface IOrderViewModelService- {- Task<OrderListModel> PrepareOrderListModel(int? orderStatusId = null, int? paymentStatusId = null, int? shippingStatusId = null, DateTime? startDate = null, string code = null);- Task<(IEnumerable<OrderModel> orderModels, int totalCount)> PrepareOrderModel(OrderListModel model, int pageIndex, int pageSize);- Task PrepareOrderDetailsModel(OrderModel model, Order order);- Task<IList<Order>> PrepareOrders(OrderListModel model);-- }-}+ Task<OrderListModel> PrepareOrderListModel(int? orderStatusId = null, int? paymentStatusId = null,+ int? shippingStatusId = null, DateTime? startDate = null, string code = null);++ Task<(IEnumerable<OrderModel> orderModels, int totalCount)> PrepareOrderModel(OrderListModel model, int pageIndex,+ int pageSize);++ Task PrepareOrderDetailsModel(OrderModel model, Order order);+ Task<IList<Order>> PrepareOrders(OrderListModel model);+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Interfaces/IProductViewModelService.cs b/src/Web/Grand.Web.Vendor/Interfaces/IProductViewModelService.csindex 97933e8bb..e73029d98 100644--- a/src/Web/Grand.Web.Vendor/Interfaces/IProductViewModelService.cs+++ b/src/Web/Grand.Web.Vendor/Interfaces/IProductViewModelService.cs@@ -2,101 +2,164 @@using Grand.Domain.Media;using Grand.Web.Vendor.Models.Catalog;-namespace Grand.Web.Vendor.Interfaces+namespace Grand.Web.Vendor.Interfaces;++public interface IProductViewModelService{- public interface IProductViewModelService- {- Task PrepareProductModel(ProductModel model, Product product, bool setPredefinedValues);- Task PrepareProductReviewModel(ProductReviewModel model, ProductReview productReview, bool excludeProperties, bool formatReviewText);- Task OutOfStockNotifications(Product product, int prevStockQuantity, List<ProductWarehouseInventory> prevMultiWarehouseStock);- Task OutOfStockNotifications(Product product, ProductAttributeCombination combination, ProductAttributeCombination prevcombination);- Task PrepareAddProductAttributeCombinationModel(ProductAttributeCombinationModel model, Product product);- Task SaveProductWarehouseInventory(Product product, IList<ProductModel.ProductWarehouseInventoryModel> model);- Task PrepareTierPriceModel(ProductModel.TierPriceModel model);- Task PrepareProductAttributeValueModel(Product product, ProductModel.ProductAttributeValueModel model);- Task<ProductListModel> PrepareProductListModel();- Task<(IEnumerable<ProductModel> productModels, int totalCount)> PrepareProductsModel(ProductListModel model, int pageIndex, int pageSize);- Task<IList<Product>> PrepareProducts(ProductListModel model);- Task<Product> InsertProductModel(ProductModel model);- Task<Product> UpdateProductModel(Product product, ProductModel model);- Task DeleteProduct(Product product);- Task DeleteSelected(IEnumerable<string> selectedIds);- Task<ProductModel.AddRequiredProductModel> PrepareAddRequiredProductModel();- Task<(IList<ProductModel> products, int totalCount)> PrepareProductModel(ProductModel.AddProductModel model, int pageIndex, int pageSize);- Task<IList<ProductModel.ProductCategoryModel>> PrepareProductCategoryModel(Product product);- Task InsertProductCategoryModel(ProductModel.ProductCategoryModel model);- Task UpdateProductCategoryModel(ProductModel.ProductCategoryModel model);- Task DeleteProductCategory(string id, string productId);- Task<IList<ProductModel.ProductCollectionModel>> PrepareProductCollectionModel(Product product);- Task InsertProductCollection(ProductModel.ProductCollectionModel model);- Task UpdateProductCollection(ProductModel.ProductCollectionModel model);- Task DeleteProductCollection(string id, string productId);- Task InsertRelatedProductModel(ProductModel.AddRelatedProductModel model);- Task UpdateRelatedProductModel(ProductModel.RelatedProductModel model);- Task DeleteRelatedProductModel(ProductModel.RelatedProductModel model);- Task InsertSimilarProductModel(ProductModel.AddSimilarProductModel model);- Task UpdateSimilarProductModel(ProductModel.SimilarProductModel model);- Task DeleteSimilarProductModel(ProductModel.SimilarProductModel model);- Task InsertBundleProductModel(ProductModel.AddBundleProductModel model);- Task UpdateBundleProductModel(ProductModel.BundleProductModel model);- Task DeleteBundleProductModel(ProductModel.BundleProductModel model);- Task InsertCrossSellProductModel(ProductModel.AddCrossSellProductModel model);- Task DeleteCrossSellProduct(string productId, string crossSellProductId);- Task InsertRecommendedProductModel(ProductModel.AddRecommendedProductModel model);- Task DeleteRecommendedProduct(string productId, string recommendedProductId);- Task InsertAssociatedProductModel(ProductModel.AddAssociatedProductModel model);- Task DeleteAssociatedProduct(Product product);- Task<ProductModel.AddRelatedProductModel> PrepareRelatedProductModel();- Task<ProductModel.AddSimilarProductModel> PrepareSimilarProductModel();- Task<ProductModel.AddBundleProductModel> PrepareBundleProductModel();- Task<ProductModel.AddCrossSellProductModel> PrepareCrossSellProductModel();- Task<ProductModel.AddRecommendedProductModel> PrepareRecommendedProductModel();- Task<ProductModel.AddAssociatedProductModel> PrepareAssociatedProductModel();- Task<BulkEditListModel> PrepareBulkEditListModel();- Task<(IEnumerable<BulkEditProductModel> bulkEditProductModels, int totalCount)> PrepareBulkEditProductModel(BulkEditListModel model, int pageIndex, int pageSize);- Task UpdateBulkEdit(IEnumerable<BulkEditProductModel> products);- Task DeleteBulkEdit(IEnumerable<BulkEditProductModel> products);- //tier-prices- Task<IList<ProductModel.TierPriceModel>> PrepareTierPriceModel(Product product);- Task<(IEnumerable<ProductModel.BidModel> bidModels, int totalCount)> PrepareBidMode(string productId, int pageIndex, int pageSize);- Task<ProductModel.ProductAttributeMappingModel> PrepareProductAttributeMappingModel(Product product);- Task<ProductModel.ProductAttributeMappingModel> PrepareProductAttributeMappingModel(ProductModel.ProductAttributeMappingModel model);- Task<IList<ProductModel.ProductAttributeMappingModel>> PrepareProductAttributeMappingModels(Product product);- Task InsertProductAttributeMappingModel(ProductModel.ProductAttributeMappingModel model);- Task UpdateProductAttributeMappingModel(ProductModel.ProductAttributeMappingModel model);- Task<ProductModel.ProductAttributeMappingModel> PrepareProductAttributeMappingModel(ProductAttributeMapping productAttributeMapping);- Task UpdateProductAttributeValidationRulesModel(ProductAttributeMapping productAttributeMapping, ProductModel.ProductAttributeMappingModel model);- Task<ProductAttributeConditionModel> PrepareProductAttributeConditionModel(Product product, ProductAttributeMapping productAttributeMapping);- Task UpdateProductAttributeConditionModel(Product product, ProductAttributeMapping productAttributeMapping, ProductAttributeConditionModel model);- Task<ProductModel.ProductAttributeValueModel> PrepareProductAttributeValueModel(Product product, ProductAttributeMapping productAttributeMapping);- Task<IList<ProductModel.ProductAttributeValueModel>> PrepareProductAttributeValueModels(Product product, ProductAttributeMapping productAttributeMapping);- Task<ProductModel.ProductAttributeValueModel> PrepareProductAttributeValueModel(ProductAttributeMapping pa, ProductAttributeValue pav);- Task InsertProductAttributeValueModel(ProductModel.ProductAttributeValueModel model);- Task UpdateProductAttributeValueModel(ProductAttributeValue pav, ProductModel.ProductAttributeValueModel model);- Task<ProductModel.ProductAttributeValueModel.AssociateProductToAttributeValueModel> PrepareAssociateProductToAttributeValueModel();- Task<IList<ProductModel.ProductAttributeCombinationModel>> PrepareProductAttributeCombinationModel(Product product);- Task<ProductAttributeCombinationModel> PrepareProductAttributeCombinationModel(Product product, string combinationId);- Task<IList<string>> InsertOrUpdateProductAttributeCombinationPopup(Product product, ProductAttributeCombinationModel model);- Task GenerateAllAttributeCombinations(Product product);-- Task ClearAllAttributeCombinations(Product product);-- Task<IList<ProductModel.ProductAttributeCombinationTierPricesModel>> PrepareProductAttributeCombinationTierPricesModel(Product product, string productAttributeCombinationId);- Task InsertProductAttributeCombinationTierPricesModel(Product product, ProductAttributeCombination productAttributeCombination, ProductModel.ProductAttributeCombinationTierPricesModel model);- Task UpdateProductAttributeCombinationTierPricesModel(Product product, ProductAttributeCombination productAttributeCombination, ProductModel.ProductAttributeCombinationTierPricesModel model);- Task DeleteProductAttributeCombinationTierPrices(Product product, ProductAttributeCombination productAttributeCombination, ProductCombinationTierPrices tierPrice);-- //Pictures- Task<IList<ProductModel.ProductPictureModel>> PrepareProductPicturesModel(Product product);- Task<(ProductModel.ProductPictureModel model, Picture Picture)> PrepareProductPictureModel(Product product, ProductPicture productPicture);- Task InsertProductPicture(Product product, Picture picture, int displayOrder);- Task UpdateProductPicture(ProductModel.ProductPictureModel model);- Task DeleteProductPicture(ProductModel.ProductPictureModel model);-- //Product specification- Task<IList<ProductSpecificationAttributeModel>> PrepareProductSpecificationAttributeModel(Product product);- Task InsertProductSpecificationAttributeModel(ProductModel.AddProductSpecificationAttributeModel model, Product product);- Task UpdateProductSpecificationAttributeModel(ProductSpecificationAttribute psa, ProductModel.AddProductSpecificationAttributeModel model);- Task DeleteProductSpecificationAttribute(Product product, ProductSpecificationAttribute psa);- }-}+ Task PrepareProductModel(ProductModel model, Product product, bool setPredefinedValues);++ Task PrepareProductReviewModel(ProductReviewModel model, ProductReview productReview, bool excludeProperties,+ bool formatReviewText);++ Task OutOfStockNotifications(Product product, int prevStockQuantity,+ List<ProductWarehouseInventory> prevMultiWarehouseStock);++ Task OutOfStockNotifications(Product product, ProductAttributeCombination combination,+ ProductAttributeCombination prevcombination);++ Task PrepareAddProductAttributeCombinationModel(ProductAttributeCombinationModel model, Product product);+ Task SaveProductWarehouseInventory(Product product, IList<ProductModel.ProductWarehouseInventoryModel> model);+ Task PrepareTierPriceModel(ProductModel.TierPriceModel model);+ Task PrepareProductAttributeValueModel(Product product, ProductModel.ProductAttributeValueModel model);+ Task<ProductListModel> PrepareProductListModel();++ Task<(IEnumerable<ProductModel> productModels, int totalCount)> PrepareProductsModel(ProductListModel model,+ int pageIndex, int pageSize);++ Task<IList<Product>> PrepareProducts(ProductListModel model);+ Task<Product> InsertProductModel(ProductModel model);+ Task<Product> UpdateProductModel(Product product, ProductModel model);+ Task DeleteProduct(Product product);+ Task DeleteSelected(IEnumerable<string> selectedIds);+ Task<ProductModel.AddRequiredProductModel> PrepareAddRequiredProductModel();++ Task<(IList<ProductModel> products, int totalCount)> PrepareProductModel(ProductModel.AddProductModel model,+ int pageIndex, int pageSize);++ Task<IList<ProductModel.ProductCategoryModel>> PrepareProductCategoryModel(Product product);+ Task InsertProductCategoryModel(ProductModel.ProductCategoryModel model);+ Task UpdateProductCategoryModel(ProductModel.ProductCategoryModel model);+ Task DeleteProductCategory(string id, string productId);+ Task<IList<ProductModel.ProductCollectionModel>> PrepareProductCollectionModel(Product product);+ Task InsertProductCollection(ProductModel.ProductCollectionModel model);+ Task UpdateProductCollection(ProductModel.ProductCollectionModel model);+ Task DeleteProductCollection(string id, string productId);+ Task InsertRelatedProductModel(ProductModel.AddRelatedProductModel model);+ Task UpdateRelatedProductModel(ProductModel.RelatedProductModel model);+ Task DeleteRelatedProductModel(ProductModel.RelatedProductModel model);+ Task InsertSimilarProductModel(ProductModel.AddSimilarProductModel model);+ Task UpdateSimilarProductModel(ProductModel.SimilarProductModel model);+ Task DeleteSimilarProductModel(ProductModel.SimilarProductModel model);+ Task InsertBundleProductModel(ProductModel.AddBundleProductModel model);+ Task UpdateBundleProductModel(ProductModel.BundleProductModel model);+ Task DeleteBundleProductModel(ProductModel.BundleProductModel model);+ Task InsertCrossSellProductModel(ProductModel.AddCrossSellProductModel model);+ Task DeleteCrossSellProduct(string productId, string crossSellProductId);+ Task InsertRecommendedProductModel(ProductModel.AddRecommendedProductModel model);+ Task DeleteRecommendedProduct(string productId, string recommendedProductId);+ Task InsertAssociatedProductModel(ProductModel.AddAssociatedProductModel model);+ Task DeleteAssociatedProduct(Product product);+ Task<ProductModel.AddRelatedProductModel> PrepareRelatedProductModel();+ Task<ProductModel.AddSimilarProductModel> PrepareSimilarProductModel();+ Task<ProductModel.AddBundleProductModel> PrepareBundleProductModel();+ Task<ProductModel.AddCrossSellProductModel> PrepareCrossSellProductModel();+ Task<ProductModel.AddRecommendedProductModel> PrepareRecommendedProductModel();+ Task<ProductModel.AddAssociatedProductModel> PrepareAssociatedProductModel();+ Task<BulkEditListModel> PrepareBulkEditListModel();++ Task<(IEnumerable<BulkEditProductModel> bulkEditProductModels, int totalCount)> PrepareBulkEditProductModel(+ BulkEditListModel model, int pageIndex, int pageSize);++ Task UpdateBulkEdit(IEnumerable<BulkEditProductModel> products);++ Task DeleteBulkEdit(IEnumerable<BulkEditProductModel> products);++ //tier-prices+ Task<IList<ProductModel.TierPriceModel>> PrepareTierPriceModel(Product product);++ Task<(IEnumerable<ProductModel.BidModel> bidModels, int totalCount)> PrepareBidMode(string productId, int pageIndex,+ int pageSize);++ Task<ProductModel.ProductAttributeMappingModel> PrepareProductAttributeMappingModel(Product product);++ Task<ProductModel.ProductAttributeMappingModel> PrepareProductAttributeMappingModel(+ ProductModel.ProductAttributeMappingModel model);++ Task<IList<ProductModel.ProductAttributeMappingModel>> PrepareProductAttributeMappingModels(Product product);+ Task InsertProductAttributeMappingModel(ProductModel.ProductAttributeMappingModel model);+ Task UpdateProductAttributeMappingModel(ProductModel.ProductAttributeMappingModel model);++ Task<ProductModel.ProductAttributeMappingModel> PrepareProductAttributeMappingModel(+ ProductAttributeMapping productAttributeMapping);++ Task UpdateProductAttributeValidationRulesModel(ProductAttributeMapping productAttributeMapping,+ ProductModel.ProductAttributeMappingModel model);++ Task<ProductAttributeConditionModel> PrepareProductAttributeConditionModel(Product product,+ ProductAttributeMapping productAttributeMapping);++ Task UpdateProductAttributeConditionModel(Product product, ProductAttributeMapping productAttributeMapping,+ ProductAttributeConditionModel model);++ Task<ProductModel.ProductAttributeValueModel> PrepareProductAttributeValueModel(Product product,+ ProductAttributeMapping productAttributeMapping);++ Task<IList<ProductModel.ProductAttributeValueModel>> PrepareProductAttributeValueModels(Product product,+ ProductAttributeMapping productAttributeMapping);++ Task<ProductModel.ProductAttributeValueModel> PrepareProductAttributeValueModel(ProductAttributeMapping pa,+ ProductAttributeValue pav);++ Task InsertProductAttributeValueModel(ProductModel.ProductAttributeValueModel model);+ Task UpdateProductAttributeValueModel(ProductAttributeValue pav, ProductModel.ProductAttributeValueModel model);++ Task<ProductModel.ProductAttributeValueModel.AssociateProductToAttributeValueModel>+ PrepareAssociateProductToAttributeValueModel();++ Task<IList<ProductModel.ProductAttributeCombinationModel>> PrepareProductAttributeCombinationModel(Product product);++ Task<ProductAttributeCombinationModel> PrepareProductAttributeCombinationModel(Product product,+ string combinationId);++ Task<IList<string>> InsertOrUpdateProductAttributeCombinationPopup(Product product,+ ProductAttributeCombinationModel model);++ Task GenerateAllAttributeCombinations(Product product);++ Task ClearAllAttributeCombinations(Product product);++ Task<IList<ProductModel.ProductAttributeCombinationTierPricesModel>>+ PrepareProductAttributeCombinationTierPricesModel(Product product, string productAttributeCombinationId);++ Task InsertProductAttributeCombinationTierPricesModel(Product product,+ ProductAttributeCombination productAttributeCombination,+ ProductModel.ProductAttributeCombinationTierPricesModel model);++ Task UpdateProductAttributeCombinationTierPricesModel(Product product,+ ProductAttributeCombination productAttributeCombination,+ ProductModel.ProductAttributeCombinationTierPricesModel model);++ Task DeleteProductAttributeCombinationTierPrices(Product product,+ ProductAttributeCombination productAttributeCombination, ProductCombinationTierPrices tierPrice);++ //Pictures+ Task<IList<ProductModel.ProductPictureModel>> PrepareProductPicturesModel(Product product);++ Task<(ProductModel.ProductPictureModel model, Picture Picture)> PrepareProductPictureModel(Product product,+ ProductPicture productPicture);++ Task InsertProductPicture(Product product, Picture picture, int displayOrder);+ Task UpdateProductPicture(ProductModel.ProductPictureModel model);+ Task DeleteProductPicture(ProductModel.ProductPictureModel model);++ //Product specification+ Task<IList<ProductSpecificationAttributeModel>> PrepareProductSpecificationAttributeModel(Product product);++ Task InsertProductSpecificationAttributeModel(ProductModel.AddProductSpecificationAttributeModel model,+ Product product);++ Task UpdateProductSpecificationAttributeModel(ProductSpecificationAttribute psa,+ ProductModel.AddProductSpecificationAttributeModel model);++ Task DeleteProductSpecificationAttribute(Product product, ProductSpecificationAttribute psa);+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Interfaces/IShipmentViewModelService.cs b/src/Web/Grand.Web.Vendor/Interfaces/IShipmentViewModelService.csindex e01548a53..6c24adf6a 100644--- a/src/Web/Grand.Web.Vendor/Interfaces/IShipmentViewModelService.cs+++ b/src/Web/Grand.Web.Vendor/Interfaces/IShipmentViewModelService.cs@@ -3,20 +3,26 @@ using Grand.Domain.Orders;using Grand.Domain.Shipping;using Grand.Web.Vendor.Models.Shipment;-namespace Grand.Web.Vendor.Interfaces+namespace Grand.Web.Vendor.Interfaces;++public interface IShipmentViewModelService{- public interface IShipmentViewModelService- {- Task<ShipmentModel> PrepareShipmentModel(Shipment shipment, bool prepareProducts, bool prepareShipmentEvent = false);- Task<int> GetStockQty(Product product, string warehouseId);- Task<int> GetReservedQty(Product product, string warehouseId);- Task<IList<ShipmentModel.ShipmentNote>> PrepareShipmentNotes(Shipment shipment);- Task InsertShipmentNote(Shipment shipment, bool displayToCustomer, string message);- Task DeleteShipmentNote(Shipment shipment, string id);- Task<ShipmentListModel> PrepareShipmentListModel();- Task<ShipmentModel> PrepareShipmentModel(Order order);- Task<(Shipment shipment, double? totalWeight)> PrepareShipment(Order order, IEnumerable<OrderItem> orderItems, AddShipmentModel model);- Task<(bool valid, string message)> ValidStockShipment(Shipment shipment);- Task<(IEnumerable<Shipment> shipments, int totalCount)> PrepareShipments(ShipmentListModel model, int pageIndex, int pageSize);- }-}+ Task<ShipmentModel> PrepareShipmentModel(Shipment shipment, bool prepareProducts,+ bool prepareShipmentEvent = false);++ Task<int> GetStockQty(Product product, string warehouseId);+ Task<int> GetReservedQty(Product product, string warehouseId);+ Task<IList<ShipmentModel.ShipmentNote>> PrepareShipmentNotes(Shipment shipment);+ Task InsertShipmentNote(Shipment shipment, bool displayToCustomer, string message);+ Task DeleteShipmentNote(Shipment shipment, string id);+ Task<ShipmentListModel> PrepareShipmentListModel();+ Task<ShipmentModel> PrepareShipmentModel(Order order);++ Task<(Shipment shipment, double? totalWeight)> PrepareShipment(Order order, IEnumerable<OrderItem> orderItems,+ AddShipmentModel model);++ Task<(bool valid, string message)> ValidStockShipment(Shipment shipment);++ Task<(IEnumerable<Shipment> shipments, int totalCount)> PrepareShipments(ShipmentListModel model, int pageIndex,+ int pageSize);+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Interfaces/IVendorReviewViewModelService.cs b/src/Web/Grand.Web.Vendor/Interfaces/IVendorReviewViewModelService.csindex 5ea924c5f..084d3e965 100644--- a/src/Web/Grand.Web.Vendor/Interfaces/IVendorReviewViewModelService.cs+++ b/src/Web/Grand.Web.Vendor/Interfaces/IVendorReviewViewModelService.cs@@ -1,16 +1,18 @@using Grand.Domain.Vendors;using Grand.Web.Vendor.Models.VendorReview;-namespace Grand.Web.Vendor.Interfaces+namespace Grand.Web.Vendor.Interfaces;++public interface IVendorReviewViewModelService{- public interface IVendorReviewViewModelService- {- Task PrepareVendorReviewModel(VendorReviewModel model,- VendorReview vendorReview, bool excludeProperties, bool formatReviewText);- Task<(IEnumerable<VendorReviewModel> vendorReviewModels, int totalCount)> PrepareVendorReviewModel(VendorReviewListModel model, int pageIndex, int pageSize);- Task<VendorReview> UpdateVendorReviewModel(VendorReview vendorReview, VendorReviewModel model);- Task DeleteVendorReview(VendorReview vendorReview);- Task ApproveVendorReviews(IEnumerable<string> selectedIds);- Task DisapproveVendorReviews(IEnumerable<string> selectedIds);- }-}+ Task PrepareVendorReviewModel(VendorReviewModel model,+ VendorReview vendorReview, bool excludeProperties, bool formatReviewText);++ Task<(IEnumerable<VendorReviewModel> vendorReviewModels, int totalCount)> PrepareVendorReviewModel(+ VendorReviewListModel model, int pageIndex, int pageSize);++ Task<VendorReview> UpdateVendorReviewModel(VendorReview vendorReview, VendorReviewModel model);+ Task DeleteVendorReview(VendorReview vendorReview);+ Task ApproveVendorReviews(IEnumerable<string> selectedIds);+ Task DisapproveVendorReviews(IEnumerable<string> selectedIds);+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Mapper/AddressProfile.cs b/src/Web/Grand.Web.Vendor/Mapper/AddressProfile.csindex ff220da78..67bf47ae3 100644--- a/src/Web/Grand.Web.Vendor/Mapper/AddressProfile.cs+++ b/src/Web/Grand.Web.Vendor/Mapper/AddressProfile.cs@@ -3,49 +3,47 @@ using Grand.Domain.Common;using Grand.Infrastructure.Mapper;using Grand.Web.Vendor.Models.Common;-namespace Grand.Web.Vendor.Mapper+namespace Grand.Web.Vendor.Mapper;++public class AddressProfile : Profile, IAutoMapperProfile{- public class AddressProfile : Profile, IAutoMapperProfile+ public AddressProfile(){- public AddressProfile()- {- CreateMap<Address, AddressModel>()- .ForMember(dest => dest.AddressHtml, mo => mo.Ignore())- .ForMember(dest => dest.CustomAddressAttributes, mo => mo.Ignore())- .ForMember(dest => dest.FormattedCustomAddressAttributes, mo => mo.Ignore())- .ForMember(dest => dest.AvailableCountries, mo => mo.Ignore())- .ForMember(dest => dest.AvailableStates, mo => mo.Ignore())- .ForMember(dest => dest.NameEnabled, mo => mo.Ignore())- .ForMember(dest => dest.FirstNameEnabled, mo => mo.Ignore())- .ForMember(dest => dest.FirstNameRequired, mo => mo.Ignore())- .ForMember(dest => dest.LastNameEnabled, mo => mo.Ignore())- .ForMember(dest => dest.LastNameRequired, mo => mo.Ignore())- .ForMember(dest => dest.EmailEnabled, mo => mo.Ignore())- .ForMember(dest => dest.EmailRequired, mo => mo.Ignore())- .ForMember(dest => dest.CompanyEnabled, mo => mo.Ignore())- .ForMember(dest => dest.CompanyRequired, mo => mo.Ignore())- .ForMember(dest => dest.CountryEnabled, mo => mo.Ignore())- .ForMember(dest => dest.StateProvinceEnabled, mo => mo.Ignore())- .ForMember(dest => dest.CityEnabled, mo => mo.Ignore())- .ForMember(dest => dest.CityRequired, mo => mo.Ignore())- .ForMember(dest => dest.StreetAddressEnabled, mo => mo.Ignore())- .ForMember(dest => dest.StreetAddressRequired, mo => mo.Ignore())- .ForMember(dest => dest.StreetAddress2Enabled, mo => mo.Ignore())- .ForMember(dest => dest.StreetAddress2Required, mo => mo.Ignore())- .ForMember(dest => dest.ZipPostalCodeEnabled, mo => mo.Ignore())- .ForMember(dest => dest.ZipPostalCodeRequired, mo => mo.Ignore())- .ForMember(dest => dest.PhoneEnabled, mo => mo.Ignore())- .ForMember(dest => dest.PhoneRequired, mo => mo.Ignore())- .ForMember(dest => dest.FaxEnabled, mo => mo.Ignore())- .ForMember(dest => dest.FaxRequired, mo => mo.Ignore());-- //address- CreateMap<AddressModel, Address>()- .ForMember(dest => dest.Id, mo => mo.Ignore())- .ForMember(dest => dest.Attributes, mo => mo.Ignore());+ CreateMap<Address, AddressModel>()+ .ForMember(dest => dest.AddressHtml, mo => mo.Ignore())+ .ForMember(dest => dest.CustomAddressAttributes, mo => mo.Ignore())+ .ForMember(dest => dest.FormattedCustomAddressAttributes, mo => mo.Ignore())+ .ForMember(dest => dest.AvailableCountries, mo => mo.Ignore())+ .ForMember(dest => dest.AvailableStates, mo => mo.Ignore())+ .ForMember(dest => dest.NameEnabled, mo => mo.Ignore())+ .ForMember(dest => dest.FirstNameEnabled, mo => mo.Ignore())+ .ForMember(dest => dest.FirstNameRequired, mo => mo.Ignore())+ .ForMember(dest => dest.LastNameEnabled, mo => mo.Ignore())+ .ForMember(dest => dest.LastNameRequired, mo => mo.Ignore())+ .ForMember(dest => dest.EmailEnabled, mo => mo.Ignore())+ .ForMember(dest => dest.EmailRequired, mo => mo.Ignore())+ .ForMember(dest => dest.CompanyEnabled, mo => mo.Ignore())+ .ForMember(dest => dest.CompanyRequired, mo => mo.Ignore())+ .ForMember(dest => dest.CountryEnabled, mo => mo.Ignore())+ .ForMember(dest => dest.StateProvinceEnabled, mo => mo.Ignore())+ .ForMember(dest => dest.CityEnabled, mo => mo.Ignore())+ .ForMember(dest => dest.CityRequired, mo => mo.Ignore())+ .ForMember(dest => dest.StreetAddressEnabled, mo => mo.Ignore())+ .ForMember(dest => dest.StreetAddressRequired, mo => mo.Ignore())+ .ForMember(dest => dest.StreetAddress2Enabled, mo => mo.Ignore())+ .ForMember(dest => dest.StreetAddress2Required, mo => mo.Ignore())+ .ForMember(dest => dest.ZipPostalCodeEnabled, mo => mo.Ignore())+ .ForMember(dest => dest.ZipPostalCodeRequired, mo => mo.Ignore())+ .ForMember(dest => dest.PhoneEnabled, mo => mo.Ignore())+ .ForMember(dest => dest.PhoneRequired, mo => mo.Ignore())+ .ForMember(dest => dest.FaxEnabled, mo => mo.Ignore())+ .ForMember(dest => dest.FaxRequired, mo => mo.Ignore());- }-- public int Order => 0;+ //address+ CreateMap<AddressModel, Address>()+ .ForMember(dest => dest.Id, mo => mo.Ignore())+ .ForMember(dest => dest.Attributes, mo => mo.Ignore());}-}++ public int Order => 0;+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Mapper/ProductProfile.cs b/src/Web/Grand.Web.Vendor/Mapper/ProductProfile.csindex 95cb18d5e..d36c8e26c 100644--- a/src/Web/Grand.Web.Vendor/Mapper/ProductProfile.cs+++ b/src/Web/Grand.Web.Vendor/Mapper/ProductProfile.cs@@ -5,99 +5,98 @@ using Grand.Infrastructure.Mapper;using Grand.Web.Common.Extensions;using Grand.Web.Vendor.Models.Catalog;-namespace Grand.Web.Vendor.Mapper+namespace Grand.Web.Vendor.Mapper;++public class ProductProfile : Profile, IAutoMapperProfile{- public class ProductProfile : Profile, IAutoMapperProfile+ public ProductProfile(){- public ProductProfile()- {- CreateMap<Product, ProductModel>()- .ForMember(dest => dest.Locales, mo => mo.Ignore())- .ForMember(dest => dest.ProductTypeName, mo => mo.Ignore())- .ForMember(dest => dest.AssociatedToProductId, mo => mo.Ignore())- .ForMember(dest => dest.AssociatedToProductName, mo => mo.Ignore())- .ForMember(dest => dest.StockQuantityStr, mo => mo.Ignore())- .ForMember(dest => dest.CreatedOn, mo => mo.Ignore())- .ForMember(dest => dest.UpdatedOn, mo => mo.Ignore())- .ForMember(dest => dest.PictureThumbnailUrl, mo => mo.Ignore())- .ForMember(dest => dest.AvailableProductLayouts, mo => mo.Ignore())- .ForMember(dest => dest.AvailableProductAttributes, mo => mo.Ignore())- .ForMember(dest => dest.AddPictureModel, mo => mo.Ignore())- .ForMember(dest => dest.ProductPictureModels, mo => mo.Ignore())- .ForMember(dest => dest.CopyProductModel, mo => mo.Ignore())- .ForMember(dest => dest.ProductWarehouseInventoryModels, mo => mo.Ignore())- .ForMember(dest => dest.SeName, mo => mo.MapFrom(src => src.GetSeName("", true)))- .ForMember(dest => dest.AvailableTaxCategories, mo => mo.Ignore())- .ForMember(dest => dest.AvailableUnits, mo => mo.Ignore())- .ForMember(dest => dest.PrimaryStoreCurrencyCode, mo => mo.Ignore())- .ForMember(dest => dest.BaseDimensionIn, mo => mo.Ignore())- .ForMember(dest => dest.BaseWeightIn, mo => mo.Ignore())- .ForMember(dest => dest.AvailableDeliveryDates, mo => mo.Ignore())- .ForMember(dest => dest.AvailableWarehouses, mo => mo.Ignore())- .ForMember(dest => dest.AvailableBasepriceUnits, mo => mo.Ignore())- .ForMember(dest => dest.AvailableBasepriceBaseUnits, mo => mo.Ignore())- .ForPath(dest => dest.CalendarModel.IncBothDate, mo => mo.MapFrom(x => x.IncBothDate));+ CreateMap<Product, ProductModel>()+ .ForMember(dest => dest.Locales, mo => mo.Ignore())+ .ForMember(dest => dest.ProductTypeName, mo => mo.Ignore())+ .ForMember(dest => dest.AssociatedToProductId, mo => mo.Ignore())+ .ForMember(dest => dest.AssociatedToProductName, mo => mo.Ignore())+ .ForMember(dest => dest.StockQuantityStr, mo => mo.Ignore())+ .ForMember(dest => dest.CreatedOn, mo => mo.Ignore())+ .ForMember(dest => dest.UpdatedOn, mo => mo.Ignore())+ .ForMember(dest => dest.PictureThumbnailUrl, mo => mo.Ignore())+ .ForMember(dest => dest.AvailableProductLayouts, mo => mo.Ignore())+ .ForMember(dest => dest.AvailableProductAttributes, mo => mo.Ignore())+ .ForMember(dest => dest.AddPictureModel, mo => mo.Ignore())+ .ForMember(dest => dest.ProductPictureModels, mo => mo.Ignore())+ .ForMember(dest => dest.CopyProductModel, mo => mo.Ignore())+ .ForMember(dest => dest.ProductWarehouseInventoryModels, mo => mo.Ignore())+ .ForMember(dest => dest.SeName, mo => mo.MapFrom(src => src.GetSeName("", true)))+ .ForMember(dest => dest.AvailableTaxCategories, mo => mo.Ignore())+ .ForMember(dest => dest.AvailableUnits, mo => mo.Ignore())+ .ForMember(dest => dest.PrimaryStoreCurrencyCode, mo => mo.Ignore())+ .ForMember(dest => dest.BaseDimensionIn, mo => mo.Ignore())+ .ForMember(dest => dest.BaseWeightIn, mo => mo.Ignore())+ .ForMember(dest => dest.AvailableDeliveryDates, mo => mo.Ignore())+ .ForMember(dest => dest.AvailableWarehouses, mo => mo.Ignore())+ .ForMember(dest => dest.AvailableBasepriceUnits, mo => mo.Ignore())+ .ForMember(dest => dest.AvailableBasepriceBaseUnits, mo => mo.Ignore())+ .ForPath(dest => dest.CalendarModel.IncBothDate, mo => mo.MapFrom(x => x.IncBothDate));++ CreateMap<ProductModel, Product>()+ .ForMember(dest => dest.Id, mo => mo.Ignore())+ .ForMember(dest => dest.Locales, mo => mo.Ignore())+ .ForMember(dest => dest.VendorId, mo => mo.Ignore())+ .ForMember(dest => dest.UpdatedOnUtc, mo => mo.Ignore())+ .ForMember(dest => dest.Coordinates, mo => mo.Ignore())+ .ForMember(dest => dest.ParentGroupedProductId, mo => mo.Ignore())+ .ForMember(dest => dest.ApprovedRatingSum, mo => mo.Ignore())+ .ForMember(dest => dest.NotApprovedRatingSum, mo => mo.Ignore())+ .ForMember(dest => dest.ApprovedTotalReviews, mo => mo.Ignore())+ .ForMember(dest => dest.NotApprovedTotalReviews, mo => mo.Ignore())+ .ForMember(dest => dest.ProductCategories, mo => mo.Ignore())+ .ForMember(dest => dest.ProductCollections, mo => mo.Ignore())+ .ForMember(dest => dest.ProductPictures, mo => mo.Ignore())+ .ForMember(dest => dest.ProductSpecificationAttributes, mo => mo.Ignore())+ .ForMember(dest => dest.ProductWarehouseInventory, mo => mo.Ignore())+ .ForMember(dest => dest.Interval, mo => mo.Ignore())+ .ForMember(dest => dest.ProductAttributeMappings, mo => mo.Ignore())+ .ForMember(dest => dest.ProductAttributeCombinations, mo => mo.Ignore())+ .ForMember(dest => dest.TierPrices, mo => mo.Ignore())+ .ForMember(dest => dest.AppliedDiscounts, mo => mo.Ignore())+ .ForPath(dest => dest.IncBothDate, mo => mo.MapFrom(x => x.CalendarModel.IncBothDate));++ CreateMap<ProductAttributeMapping, ProductModel.ProductAttributeMappingModel>();- CreateMap<ProductModel, Product>()- .ForMember(dest => dest.Id, mo => mo.Ignore())- .ForMember(dest => dest.Locales, mo => mo.Ignore())- .ForMember(dest => dest.VendorId, mo => mo.Ignore())- .ForMember(dest => dest.UpdatedOnUtc, mo => mo.Ignore())- .ForMember(dest => dest.Coordinates, mo => mo.Ignore())- .ForMember(dest => dest.ParentGroupedProductId, mo => mo.Ignore())- .ForMember(dest => dest.ApprovedRatingSum, mo => mo.Ignore())- .ForMember(dest => dest.NotApprovedRatingSum, mo => mo.Ignore())- .ForMember(dest => dest.ApprovedTotalReviews, mo => mo.Ignore())- .ForMember(dest => dest.NotApprovedTotalReviews, mo => mo.Ignore())- .ForMember(dest => dest.ProductCategories, mo => mo.Ignore())- .ForMember(dest => dest.ProductCollections, mo => mo.Ignore())- .ForMember(dest => dest.ProductPictures, mo => mo.Ignore())- .ForMember(dest => dest.ProductSpecificationAttributes, mo => mo.Ignore())- .ForMember(dest => dest.ProductWarehouseInventory, mo => mo.Ignore())- .ForMember(dest => dest.Interval, mo => mo.Ignore())- .ForMember(dest => dest.ProductAttributeMappings, mo => mo.Ignore())- .ForMember(dest => dest.ProductAttributeCombinations, mo => mo.Ignore())- .ForMember(dest => dest.TierPrices, mo => mo.Ignore())- .ForMember(dest => dest.AppliedDiscounts, mo => mo.Ignore())- .ForPath(dest => dest.IncBothDate, mo => mo.MapFrom(x => x.CalendarModel.IncBothDate));-- CreateMap<ProductAttributeMapping, ProductModel.ProductAttributeMappingModel>();+ CreateMap<ProductModel.ProductAttributeMappingModel, ProductAttributeMapping>()+ .ForMember(dest => dest.Id, mo => mo.Ignore());- CreateMap<ProductModel.ProductAttributeMappingModel, ProductAttributeMapping>()- .ForMember(dest => dest.Id, mo => mo.Ignore());-- CreateMap<ProductAttributeCombination, ProductAttributeCombinationModel>()- .ForMember(dest => dest.UseMultipleWarehouses, mo => mo.Ignore())- .ForMember(dest => dest.PrimaryStoreCurrencyCode, mo => mo.Ignore())- .ForMember(dest => dest.WarehouseInventoryModels, mo => mo.Ignore());- CreateMap<ProductAttributeCombinationModel, ProductAttributeCombination>()- .ForMember(dest => dest.WarehouseInventory, mo => mo.Ignore())- .ForMember(dest => dest.Id, mo => mo.Ignore());+ CreateMap<ProductAttributeCombination, ProductAttributeCombinationModel>()+ .ForMember(dest => dest.UseMultipleWarehouses, mo => mo.Ignore())+ .ForMember(dest => dest.PrimaryStoreCurrencyCode, mo => mo.Ignore())+ .ForMember(dest => dest.WarehouseInventoryModels, mo => mo.Ignore());+ CreateMap<ProductAttributeCombinationModel, ProductAttributeCombination>()+ .ForMember(dest => dest.WarehouseInventory, mo => mo.Ignore())+ .ForMember(dest => dest.Id, mo => mo.Ignore());- CreateMap<PredefinedProductAttributeValue, ProductAttributeValue>()- .ForMember(dest => dest.Id, mo => mo.Ignore());-- CreateMap<PredefinedProductAttributeValue, PredefinedProductAttributeValueModel>()- .ForMember(dest => dest.Locales, mo => mo.Ignore())- .ForMember(dest => dest.PriceAdjustmentStr, mo => mo.MapFrom(x => x.PriceAdjustment.ToString("N2")))- .ForMember(dest => dest.WeightAdjustmentStr, mo => mo.MapFrom(x => x.WeightAdjustment.ToString("N2")));+ CreateMap<PredefinedProductAttributeValue, ProductAttributeValue>()+ .ForMember(dest => dest.Id, mo => mo.Ignore());- CreateMap<PredefinedProductAttributeValueModel, PredefinedProductAttributeValue>()- .ForMember(dest => dest.Id, mo => mo.Ignore())- .ForMember(dest => dest.Locales, mo => mo.MapFrom(x => x.Locales.ToTranslationProperty()));-- CreateMap<ProductSpecificationAttribute, ProductModel.AddProductSpecificationAttributeModel>()- .ForMember(dest => dest.AvailableAttributes, mo => mo.Ignore())- .ForMember(dest => dest.AvailableOptions, mo => mo.Ignore());- CreateMap<ProductModel.AddProductSpecificationAttributeModel, ProductSpecificationAttribute>();+ CreateMap<PredefinedProductAttributeValue, PredefinedProductAttributeValueModel>()+ .ForMember(dest => dest.Locales, mo => mo.Ignore())+ .ForMember(dest => dest.PriceAdjustmentStr, mo => mo.MapFrom(x => x.PriceAdjustment.ToString("N2")))+ .ForMember(dest => dest.WeightAdjustmentStr, mo => mo.MapFrom(x => x.WeightAdjustment.ToString("N2")));- CreateMap<TierPrice, ProductModel.TierPriceModel>()- .ForMember(dest => dest.AvailableCurrencies, mo => mo.Ignore());-- CreateMap<ProductModel.TierPriceModel, TierPrice>()- .ForMember(dest => dest.Id, mo => mo.Ignore());- }+ CreateMap<PredefinedProductAttributeValueModel, PredefinedProductAttributeValue>()+ .ForMember(dest => dest.Id, mo => mo.Ignore())+ .ForMember(dest => dest.Locales, mo => mo.MapFrom(x => x.Locales.ToTranslationProperty()));- public int Order => 0;+ CreateMap<ProductSpecificationAttribute, ProductModel.AddProductSpecificationAttributeModel>()+ .ForMember(dest => dest.AvailableAttributes, mo => mo.Ignore())+ .ForMember(dest => dest.AvailableOptions, mo => mo.Ignore());+ CreateMap<ProductModel.AddProductSpecificationAttributeModel, ProductSpecificationAttribute>();++ CreateMap<TierPrice, ProductModel.TierPriceModel>()+ .ForMember(dest => dest.AvailableCurrencies, mo => mo.Ignore());++ CreateMap<ProductModel.TierPriceModel, TierPrice>()+ .ForMember(dest => dest.Id, mo => mo.Ignore());}++ public int Order => 0;}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Mapper/VendorProfile.cs b/src/Web/Grand.Web.Vendor/Mapper/VendorProfile.csindex c8e4458be..a744db012 100644--- a/src/Web/Grand.Web.Vendor/Mapper/VendorProfile.cs+++ b/src/Web/Grand.Web.Vendor/Mapper/VendorProfile.cs@@ -3,35 +3,35 @@ using Grand.Business.Core.Extensions;using Grand.Infrastructure.Mapper;using Grand.Web.Vendor.Models.Vendor;-namespace Grand.Web.Vendor.Mapper+namespace Grand.Web.Vendor.Mapper;++public class VendorProfile : Profile, IAutoMapperProfile{- public class VendorProfile : Profile, IAutoMapperProfile+ public VendorProfile(){- public VendorProfile()- {- CreateMap<Domain.Vendors.Vendor, VendorModel>()- .ForMember(dest => dest.Locales, mo => mo.Ignore())- .ForMember(dest => dest.UserFields, mo => mo.Ignore())- .ForMember(dest => dest.SeName, mo => mo.MapFrom(src => src.GetSeName("", true)));+ CreateMap<Domain.Vendors.Vendor, VendorModel>()+ .ForMember(dest => dest.Locales, mo => mo.Ignore())+ .ForMember(dest => dest.UserFields, mo => mo.Ignore())+ .ForMember(dest => dest.SeName, mo => mo.MapFrom(src => src.GetSeName("", true)));- CreateMap<VendorModel, Domain.Vendors.Vendor>()- .ForMember(dest => dest.Id, mo => mo.Ignore())- .ForMember(dest => dest.Locales, mo => mo.Ignore())- .ForMember(dest => dest.Coordinates, mo => mo.Ignore())- .ForMember(dest => dest.Active, mo => mo.Ignore())- .ForMember(dest => dest.Commission, mo => mo.Ignore())- .ForMember(dest => dest.DisplayOrder, mo => mo.Ignore())- .ForMember(dest => dest.AdminComment, mo => mo.Ignore())- .ForMember(dest => dest.AppliedDiscounts, mo => mo.Ignore())- .ForMember(dest => dest.PictureId, mo => mo.Ignore())- .ForMember(dest => dest.VendorNotes, mo => mo.Ignore())- .ForMember(dest => dest.NotApprovedRatingSum, mo => mo.Ignore())- .ForMember(dest => dest.ApprovedRatingSum, mo => mo.Ignore())- .ForMember(dest => dest.ApprovedTotalReviews, mo => mo.Ignore())- .ForMember(dest => dest.NotApprovedTotalReviews, mo => mo.Ignore())- .ForMember(dest => dest.AllowCustomerReviews, mo => mo.Ignore())- .ForMember(dest => dest.Deleted, mo => mo.Ignore());- }- public int Order => 0;+ CreateMap<VendorModel, Domain.Vendors.Vendor>()+ .ForMember(dest => dest.Id, mo => mo.Ignore())+ .ForMember(dest => dest.Locales, mo => mo.Ignore())+ .ForMember(dest => dest.Coordinates, mo => mo.Ignore())+ .ForMember(dest => dest.Active, mo => mo.Ignore())+ .ForMember(dest => dest.Commission, mo => mo.Ignore())+ .ForMember(dest => dest.DisplayOrder, mo => mo.Ignore())+ .ForMember(dest => dest.AdminComment, mo => mo.Ignore())+ .ForMember(dest => dest.AppliedDiscounts, mo => mo.Ignore())+ .ForMember(dest => dest.PictureId, mo => mo.Ignore())+ .ForMember(dest => dest.VendorNotes, mo => mo.Ignore())+ .ForMember(dest => dest.NotApprovedRatingSum, mo => mo.Ignore())+ .ForMember(dest => dest.ApprovedRatingSum, mo => mo.Ignore())+ .ForMember(dest => dest.ApprovedTotalReviews, mo => mo.Ignore())+ .ForMember(dest => dest.NotApprovedTotalReviews, mo => mo.Ignore())+ .ForMember(dest => dest.AllowCustomerReviews, mo => mo.Ignore())+ .ForMember(dest => dest.Deleted, mo => mo.Ignore());}++ public int Order => 0;}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Catalog/BulkEditListModel.cs b/src/Web/Grand.Web.Vendor/Models/Catalog/BulkEditListModel.csindex e7e2879df..5dc967f13 100644--- a/src/Web/Grand.Web.Vendor/Models/Catalog/BulkEditListModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Catalog/BulkEditListModel.cs@@ -3,28 +3,27 @@ using Grand.Infrastructure.Models;using Microsoft.AspNetCore.Mvc.Rendering;using System.ComponentModel.DataAnnotations;-namespace Grand.Web.Vendor.Models.Catalog+namespace Grand.Web.Vendor.Models.Catalog;++public class BulkEditListModel : BaseModel{- public class BulkEditListModel : BaseModel- {- [GrandResourceDisplayName("Vendor.Catalog.BulkEdit.List.SearchProductName")]- public string SearchProductName { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.BulkEdit.List.SearchProductName")]+ public string SearchProductName { get; set; }++ [UIHint("Category")]+ [GrandResourceDisplayName("Vendor.Catalog.BulkEdit.List.SearchCategory")]+ public string SearchCategoryId { get; set; }- [UIHint("Category")]- [GrandResourceDisplayName("Vendor.Catalog.BulkEdit.List.SearchCategory")]- public string SearchCategoryId { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.List.Brand")]+ [UIHint("Brand")]+ public string SearchBrandId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.List.Brand")]- [UIHint("Brand")]- public string SearchBrandId { get; set; }+ [UIHint("Collection")]+ [GrandResourceDisplayName("Vendor.Catalog.BulkEdit.List.SearchCollection")]+ public string SearchCollectionId { get; set; }- [UIHint("Collection")]- [GrandResourceDisplayName("Vendor.Catalog.BulkEdit.List.SearchCollection")]- public string SearchCollectionId { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchProductType")]+ public int SearchProductTypeId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchProductType")]- public int SearchProductTypeId { get; set; }-- public IList<SelectListItem> AvailableProductTypes { get; set; } = new List<SelectListItem>();- }+ public IList<SelectListItem> AvailableProductTypes { get; set; } = new List<SelectListItem>();}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Catalog/BulkEditProductModel.cs b/src/Web/Grand.Web.Vendor/Models/Catalog/BulkEditProductModel.csindex 5f4ef212f..19d5a5d22 100644--- a/src/Web/Grand.Web.Vendor/Models/Catalog/BulkEditProductModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Catalog/BulkEditProductModel.cs@@ -1,33 +1,33 @@using Grand.Infrastructure.ModelBinding;using Grand.Infrastructure.Models;-namespace Grand.Web.Vendor.Models.Catalog+namespace Grand.Web.Vendor.Models.Catalog;++public class BulkEditProductModel : BaseEntityModel{- public class BulkEditProductModel : BaseEntityModel- {- [GrandResourceDisplayName("Vendor.Catalog.BulkEdit.Fields.Name")]+ [GrandResourceDisplayName("Vendor.Catalog.BulkEdit.Fields.Name")]++ public string Name { get; set; }- public string Name { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.BulkEdit.Fields.SKU")]- [GrandResourceDisplayName("Vendor.Catalog.BulkEdit.Fields.SKU")]+ public string Sku { get; set; }- public string Sku { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.BulkEdit.Fields.Price")]+ public double Price { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.BulkEdit.Fields.Price")]- public double Price { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.BulkEdit.Fields.OldPrice")]+ public double OldPrice { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.BulkEdit.Fields.OldPrice")]- public double OldPrice { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.BulkEdit.Fields.ManageInventoryMethod")]+ public int ManageInventoryMethodId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.BulkEdit.Fields.ManageInventoryMethod")]- public int ManageInventoryMethodId { get; set; }- public string ManageInventoryMethod { get; set; }+ public string ManageInventoryMethod { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.BulkEdit.Fields.StockQuantity")]- public int StockQuantity { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.BulkEdit.Fields.StockQuantity")]+ public int StockQuantity { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.BulkEdit.Fields.Published")]- public bool Published { get; set; }- }+ [GrandResourceDisplayName("Vendor.Catalog.BulkEdit.Fields.Published")]+ public bool Published { get; set; }}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Catalog/CopyProductModel.cs b/src/Web/Grand.Web.Vendor/Models/Catalog/CopyProductModel.csindex 5c9b0a384..16ae6ab0a 100644--- a/src/Web/Grand.Web.Vendor/Models/Catalog/CopyProductModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Catalog/CopyProductModel.cs@@ -1,19 +1,16 @@using Grand.Infrastructure.ModelBinding;using Grand.Infrastructure.Models;-namespace Grand.Web.Vendor.Models.Catalog-{- public class CopyProductModel : BaseEntityModel- {-- [GrandResourceDisplayName("Vendor.Catalog.Products.Copy.Name")]- public string Name { get; set; }+namespace Grand.Web.Vendor.Models.Catalog;- [GrandResourceDisplayName("Vendor.Catalog.Products.Copy.CopyImages")]- public bool CopyImages { get; set; }+public class CopyProductModel : BaseEntityModel+{+ [GrandResourceDisplayName("Vendor.Catalog.Products.Copy.Name")]+ public string Name { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Copy.Published")]- public bool Published { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Copy.CopyImages")]+ public bool CopyImages { get; set; }- }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Copy.Published")]+ public bool Published { get; set; }}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Catalog/ProductAttributeCombinationModel.cs b/src/Web/Grand.Web.Vendor/Models/Catalog/ProductAttributeCombinationModel.csindex 0d2704cf4..876b919d5 100644--- a/src/Web/Grand.Web.Vendor/Models/Catalog/ProductAttributeCombinationModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Catalog/ProductAttributeCombinationModel.cs@@ -6,96 +6,106 @@ using Grand.Web.Common.Models;using Microsoft.AspNetCore.Mvc;using System.ComponentModel.DataAnnotations;-namespace Grand.Web.Vendor.Models.Catalog+namespace Grand.Web.Vendor.Models.Catalog;++public class ProductAttributeCombinationModel : BaseModel{- public class ProductAttributeCombinationModel : BaseModel- {- public string Id { get; set; }+ public string Id { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.StockQuantity")]- public int StockQuantity { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.StockQuantity")]+ public int StockQuantity { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.ReservedQuantity")]- public int ReservedQuantity { get; set; }+ [GrandResourceDisplayName(+ "Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.ReservedQuantity")]+ public int ReservedQuantity { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.AllowOutOfStockOrders")]- public bool AllowOutOfStockOrders { get; set; }+ [GrandResourceDisplayName(+ "Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.AllowOutOfStockOrders")]+ public bool AllowOutOfStockOrders { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Text")]- public string Text { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Text")]+ public string Text { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Sku")]- public string Sku { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Sku")]+ public string Sku { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Mpn")]- public string Mpn { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Mpn")]+ public string Mpn { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Gtin")]- public string Gtin { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Gtin")]+ public string Gtin { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.OverriddenPrice")]- [UIHint("DoubleNullable")]- public double? OverriddenPrice { get; set; }- public string PrimaryStoreCurrencyCode { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.OverriddenPrice")]+ [UIHint("DoubleNullable")]+ public double? OverriddenPrice { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.NotifyAdminForQuantityBelow")]- public int NotifyAdminForQuantityBelow { get; set; }+ public string PrimaryStoreCurrencyCode { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Picture")]- public string PictureId { get; set; }- public string PictureThumbnailUrl { get; set; }+ [GrandResourceDisplayName(+ "Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.NotifyAdminForQuantityBelow")]+ public int NotifyAdminForQuantityBelow { get; set; }- public IList<ProductModel.ProductPictureModel> ProductPictureModels { get; set; } = new List<ProductModel.ProductPictureModel>();+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Picture")]+ public string PictureId { get; set; }- public IList<ProductAttributeModel> ProductAttributes { get; set; } = new List<ProductAttributeModel>();+ public string PictureThumbnailUrl { get; set; }- [ModelBinder(BinderType = typeof(CustomAttributesBinder))]- public IList<CustomAttributeModel> SelectedAttributes { get; set; }-- public IList<string> Warnings { get; set; } = new List<string>();+ public IList<ProductModel.ProductPictureModel> ProductPictureModels { get; set; } =+ new List<ProductModel.ProductPictureModel>();- public string ProductId { get; set; }- public string Attributes { get; set; }+ public IList<ProductAttributeModel> ProductAttributes { get; set; } = new List<ProductAttributeModel>();- public bool UseMultipleWarehouses { get; set; }+ [ModelBinder(BinderType = typeof(CustomAttributesBinder))]+ public IList<CustomAttributeModel> SelectedAttributes { get; set; }- public IList<WarehouseInventoryModel> WarehouseInventoryModels { get; set; } = new List<WarehouseInventoryModel>();+ public IList<string> Warnings { get; set; } = new List<string>();- #region Nested classes+ public string ProductId { get; set; }+ public string Attributes { get; set; }- public class ProductAttributeModel : BaseEntityModel- {- public string ProductAttributeId { get; set; }- public string Name { get; set; }- public string TextPrompt { get; set; }- public bool IsRequired { get; set; }- public AttributeControlType AttributeControlType { get; set; }- public IList<ProductAttributeValueModel> Values { get; set; } = new List<ProductAttributeValueModel>();- }+ public bool UseMultipleWarehouses { get; set; }- public class ProductAttributeValueModel : BaseEntityModel- {- public string Name { get; set; }+ public IList<WarehouseInventoryModel> WarehouseInventoryModels { get; set; } = new List<WarehouseInventoryModel>();- public bool IsPreSelected { get; set; }- }+ #region Nested classes- public class WarehouseInventoryModel : BaseEntityModel- {- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombination.WarehouseInventory.Fields.Warehouse")]- public string WarehouseId { get; set; }- public string WarehouseName { get; set; }+ public class ProductAttributeModel : BaseEntityModel+ {+ public string ProductAttributeId { get; set; }+ public string Name { get; set; }+ public string TextPrompt { get; set; }+ public bool IsRequired { get; set; }+ public AttributeControlType AttributeControlType { get; set; }+ public IList<ProductAttributeValueModel> Values { get; set; } = new List<ProductAttributeValueModel>();+ }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombination.WarehouseInventory.Fields.WarehouseUsed")]- public bool WarehouseUsed { get; set; }+ public class ProductAttributeValueModel : BaseEntityModel+ {+ public string Name { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombination.WarehouseInventory.Fields.StockQuantity")]- public int StockQuantity { get; set; }+ public bool IsPreSelected { get; set; }+ }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombination.WarehouseInventory.Fields.ReservedQuantity")]- public int ReservedQuantity { get; set; }- }+ public class WarehouseInventoryModel : BaseEntityModel+ {+ [GrandResourceDisplayName(+ "Vendor.Catalog.Products.ProductAttributes.AttributeCombination.WarehouseInventory.Fields.Warehouse")]+ public string WarehouseId { get; set; }++ public string WarehouseName { get; set; }- #endregion+ [GrandResourceDisplayName(+ "Vendor.Catalog.Products.ProductAttributes.AttributeCombination.WarehouseInventory.Fields.WarehouseUsed")]+ public bool WarehouseUsed { get; set; }++ [GrandResourceDisplayName(+ "Vendor.Catalog.Products.ProductAttributes.AttributeCombination.WarehouseInventory.Fields.StockQuantity")]+ public int StockQuantity { get; set; }++ [GrandResourceDisplayName(+ "Vendor.Catalog.Products.ProductAttributes.AttributeCombination.WarehouseInventory.Fields.ReservedQuantity")]+ public int ReservedQuantity { get; set; }}++ #endregion}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Catalog/ProductAttributeConditionModel.cs b/src/Web/Grand.Web.Vendor/Models/Catalog/ProductAttributeConditionModel.csindex 94c4981d7..6437c3029 100644--- a/src/Web/Grand.Web.Vendor/Models/Catalog/ProductAttributeConditionModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Catalog/ProductAttributeConditionModel.cs@@ -5,45 +5,47 @@ using Grand.Web.Common.Binders;using Grand.Web.Common.Models;using Microsoft.AspNetCore.Mvc;-namespace Grand.Web.Vendor.Models.Catalog+namespace Grand.Web.Vendor.Models.Catalog;++public class ProductAttributeConditionModel : BaseModel, IProductValidVendor{- public class ProductAttributeConditionModel : BaseModel, IProductValidVendor- {- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Condition.EnableCondition")]- public bool EnableCondition { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Condition.EnableCondition")]+ public bool EnableCondition { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Condition.Attributes")]+ public string SelectedProductAttributeId { get; set; }++ public IList<ProductAttributeModel> ProductAttributes { get; set; } = new List<ProductAttributeModel>();- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Condition.Attributes")]- public string SelectedProductAttributeId { get; set; }- public IList<ProductAttributeModel> ProductAttributes { get; set; } = new List<ProductAttributeModel>();+ [ModelBinder(BinderType = typeof(CustomAttributesBinder))]+ public IList<CustomAttributeModel> SelectedAttributes { get; set; }- [ModelBinder(BinderType = typeof(CustomAttributesBinder))]- public IList<CustomAttributeModel> SelectedAttributes { get; set; }- public string ProductAttributeMappingId { get; set; }- public string ProductId { get; set; }+ public string ProductAttributeMappingId { get; set; }+ public string ProductId { get; set; }- #region Nested classes+ #region Nested classes- public class ProductAttributeModel : BaseEntityModel- {- public string ProductAttributeId { get; set; }+ public class ProductAttributeModel : BaseEntityModel+ {+ public string ProductAttributeId { get; set; }- public string Name { get; set; }+ public string Name { get; set; }- public string TextPrompt { get; set; }+ public string TextPrompt { get; set; }- public bool IsRequired { get; set; }+ public bool IsRequired { get; set; }- public AttributeControlType AttributeControlType { get; set; }+ public AttributeControlType AttributeControlType { get; set; }- public IList<ProductAttributeValueModel> Values { get; set; } = new List<ProductAttributeValueModel>();- }+ public IList<ProductAttributeValueModel> Values { get; set; } = new List<ProductAttributeValueModel>();+ }- public class ProductAttributeValueModel : BaseEntityModel- {- public string Name { get; set; }+ public class ProductAttributeValueModel : BaseEntityModel+ {+ public string Name { get; set; }- public bool IsPreSelected { get; set; }- }- #endregion+ public bool IsPreSelected { get; set; }}++ #endregion}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Catalog/ProductAttributeModel.cs b/src/Web/Grand.Web.Vendor/Models/Catalog/ProductAttributeModel.csindex d52eab15e..a809e6de8 100644--- a/src/Web/Grand.Web.Vendor/Models/Catalog/ProductAttributeModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Catalog/ProductAttributeModel.cs@@ -2,58 +2,62 @@using Grand.Infrastructure.Models;using Grand.Web.Common.Models;-namespace Grand.Web.Vendor.Models.Catalog+namespace Grand.Web.Vendor.Models.Catalog;++public class ProductAttributeLocalizedModel : ILocalizedModelLocal{- public class ProductAttributeLocalizedModel : ILocalizedModelLocal- {- public string LanguageId { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Attributes.ProductAttributes.Fields.Name")]++ public string Name { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Attributes.ProductAttributes.Fields.Description")]- [GrandResourceDisplayName("Vendor.Catalog.Attributes.ProductAttributes.Fields.Name")]+ public string Description { get; set; }- public string Name { get; set; }+ public string LanguageId { get; set; }+}- [GrandResourceDisplayName("Vendor.Catalog.Attributes.ProductAttributes.Fields.Description")]+public class PredefinedProductAttributeValueModel : BaseEntityModel,+ ILocalizedModel<PredefinedProductAttributeValueLocalizedModel>+{+ public string ProductAttributeId { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Attributes.ProductAttributes.PredefinedValues.Fields.Name")]- public string Description { get; set; }- }+ public string Name { get; set; }- public class PredefinedProductAttributeValueModel : BaseEntityModel, ILocalizedModel<PredefinedProductAttributeValueLocalizedModel>- {- public string ProductAttributeId { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Attributes.ProductAttributes.PredefinedValues.Fields.PriceAdjustment")]+ public double PriceAdjustment { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Attributes.ProductAttributes.PredefinedValues.Fields.Name")]+ [GrandResourceDisplayName("Vendor.Catalog.Attributes.ProductAttributes.PredefinedValues.Fields.PriceAdjustment")]+ //used only on the values list page+ public string PriceAdjustmentStr { get; set; }- public string Name { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Attributes.ProductAttributes.PredefinedValues.Fields.WeightAdjustment")]+ public double WeightAdjustment { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Attributes.ProductAttributes.PredefinedValues.Fields.PriceAdjustment")]- public double PriceAdjustment { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Attributes.ProductAttributes.PredefinedValues.Fields.PriceAdjustment")]- //used only on the values list page- public string PriceAdjustmentStr { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Attributes.ProductAttributes.PredefinedValues.Fields.WeightAdjustment")]+ //used only on the values list page+ public string WeightAdjustmentStr { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Attributes.ProductAttributes.PredefinedValues.Fields.WeightAdjustment")]- public double WeightAdjustment { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Attributes.ProductAttributes.PredefinedValues.Fields.WeightAdjustment")]- //used only on the values list page- public string WeightAdjustmentStr { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Attributes.ProductAttributes.PredefinedValues.Fields.Cost")]+ public double Cost { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Attributes.ProductAttributes.PredefinedValues.Fields.Cost")]- public double Cost { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Attributes.ProductAttributes.PredefinedValues.Fields.IsPreSelected")]+ public bool IsPreSelected { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Attributes.ProductAttributes.PredefinedValues.Fields.IsPreSelected")]- public bool IsPreSelected { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Attributes.ProductAttributes.PredefinedValues.Fields.DisplayOrder")]+ public int DisplayOrder { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Attributes.ProductAttributes.PredefinedValues.Fields.DisplayOrder")]- public int DisplayOrder { get; set; }+ public IList<PredefinedProductAttributeValueLocalizedModel> Locales { get; set; } =+ new List<PredefinedProductAttributeValueLocalizedModel>();+}- public IList<PredefinedProductAttributeValueLocalizedModel> Locales { get; set; } = new List<PredefinedProductAttributeValueLocalizedModel>();- }- public class PredefinedProductAttributeValueLocalizedModel : ILocalizedModelLocal- {- public string LanguageId { get; set; }+public class PredefinedProductAttributeValueLocalizedModel : ILocalizedModelLocal+{+ [GrandResourceDisplayName("Vendor.Catalog.Attributes.ProductAttributes.PredefinedValues.Fields.Name")]- [GrandResourceDisplayName("Vendor.Catalog.Attributes.ProductAttributes.PredefinedValues.Fields.Name")]+ public string Name { get; set; }- public string Name { get; set; }- }+ public string LanguageId { get; set; }}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Catalog/ProductListModel.cs b/src/Web/Grand.Web.Vendor/Models/Catalog/ProductListModel.csindex e8f4835ea..68bece177 100644--- a/src/Web/Grand.Web.Vendor/Models/Catalog/ProductListModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Catalog/ProductListModel.cs@@ -3,37 +3,42 @@ using Grand.Infrastructure.Models;using Microsoft.AspNetCore.Mvc.Rendering;using System.ComponentModel.DataAnnotations;-namespace Grand.Web.Vendor.Models.Catalog+namespace Grand.Web.Vendor.Models.Catalog;++public class ProductListModel : BaseModel{- public class ProductListModel : BaseModel- {- [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchProductName")]- public string SearchProductName { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchCategory")]- [UIHint("Category")]- public string SearchCategoryId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchIncludeSubCategories")]- public bool SearchIncludeSubCategories { get; set; }-- [GrandResourceDisplayName("Vendor.Catalog.Products.List.Brand")]- [UIHint("Brand")]- public string SearchBrandId { get; set; }-- [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchCollection")]- [UIHint("Collection")]- public string SearchCollectionId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchWarehouse")]- public string SearchWarehouseId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchProductType")]- public int SearchProductTypeId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchPublished")]- public int SearchPublishedId { get; set; }-- [GrandResourceDisplayName("Vendor.Catalog.Products.List.GoDirectlyToSku")]-- public string GoDirectlyToSku { get; set; }- public IList<SelectListItem> AvailableWarehouses { get; set; } = new List<SelectListItem>();- public IList<SelectListItem> AvailableProductTypes { get; set; } = new List<SelectListItem>();- public IList<SelectListItem> AvailablePublishedOptions { get; set; } = new List<SelectListItem>();- }+ [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchProductName")]+ public string SearchProductName { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchCategory")]+ [UIHint("Category")]+ public string SearchCategoryId { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchIncludeSubCategories")]+ public bool SearchIncludeSubCategories { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.List.Brand")]+ [UIHint("Brand")]+ public string SearchBrandId { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchCollection")]+ [UIHint("Collection")]+ public string SearchCollectionId { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchWarehouse")]+ public string SearchWarehouseId { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchProductType")]+ public int SearchProductTypeId { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchPublished")]+ public int SearchPublishedId { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.List.GoDirectlyToSku")]++ public string GoDirectlyToSku { get; set; }++ public IList<SelectListItem> AvailableWarehouses { get; set; } = new List<SelectListItem>();+ public IList<SelectListItem> AvailableProductTypes { get; set; } = new List<SelectListItem>();+ public IList<SelectListItem> AvailablePublishedOptions { get; set; } = new List<SelectListItem>();}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Catalog/ProductModel.cs b/src/Web/Grand.Web.Vendor/Models/Catalog/ProductModel.csindex 8e257acd9..c4e38c6e7 100644--- a/src/Web/Grand.Web.Vendor/Models/Catalog/ProductModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Catalog/ProductModel.cs@@ -1,932 +1,991 @@-using Grand.Web.Common.Models;-using Grand.Domain.Catalog;+using Grand.Domain.Catalog;using Grand.Infrastructure.ModelBinding;using Grand.Infrastructure.Models;+using Grand.Web.Common.Models;using Grand.Web.Common.Validators;using Microsoft.AspNetCore.Mvc.Rendering;using System.ComponentModel.DataAnnotations;-namespace Grand.Web.Vendor.Models.Catalog+namespace Grand.Web.Vendor.Models.Catalog;++public class ProductModel : BaseEntityModel, ILocalizedModel<ProductLocalizedModel>{- public class ProductModel : BaseEntityModel, ILocalizedModel<ProductLocalizedModel>- {- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ID")]- public override string Id { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ID")]+ public override string Id { get; set; }- //picture thumbnail- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.PictureThumbnailUrl")]- public string PictureThumbnailUrl { get; set; }+ //picture thumbnail+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.PictureThumbnailUrl")]+ public string PictureThumbnailUrl { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ProductType")]- public int ProductTypeId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ProductType")]- public string ProductTypeName { get; set; }- public bool AuctionEnded { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ProductType")]+ public int ProductTypeId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.AssociatedToProductName")]- public string AssociatedToProductId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.AssociatedToProductName")]- public string AssociatedToProductName { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ProductType")]+ public string ProductTypeName { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.VisibleIndividually")]- public bool VisibleIndividually { get; set; }+ public bool AuctionEnded { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ProductLayout")]- public string ProductLayoutId { get; set; }- public IList<SelectListItem> AvailableProductLayouts { get; set; } = new List<SelectListItem>();+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.AssociatedToProductName")]+ public string AssociatedToProductId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Name")]- public string Name { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.AssociatedToProductName")]+ public string AssociatedToProductName { get; set; }- [NoScripts]- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ShortDescription")]- public string ShortDescription { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.VisibleIndividually")]+ public bool VisibleIndividually { get; set; }- [NoScripts]- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.FullDescription")]- public string FullDescription { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ProductLayout")]+ public string ProductLayoutId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Flag")]- public string Flag { get; set; }+ public IList<SelectListItem> AvailableProductLayouts { get; set; } = new List<SelectListItem>();- [NoScripts]- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.AdminComment")]- public string AdminComment { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Name")]+ public string Name { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Brand")]- [UIHint("Brand")]- public string BrandId { get; set; }+ [NoScripts]+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ShortDescription")]+ public string ShortDescription { get; set; }+ [NoScripts]+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.FullDescription")]+ public string FullDescription { get; set; }- [NoScripts]- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MetaKeywords")]- public string MetaKeywords { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Flag")]+ public string Flag { get; set; }- [NoScripts]- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MetaDescription")]- public string MetaDescription { get; set; }+ [NoScripts]+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.AdminComment")]+ public string AdminComment { get; set; }- [NoScripts]- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MetaTitle")]- public string MetaTitle { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Brand")]+ [UIHint("Brand")]+ public string BrandId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.SeName")]- public string SeName { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.AllowCustomerReviews")]- public bool AllowCustomerReviews { get; set; }+ [NoScripts]+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MetaKeywords")]+ public string MetaKeywords { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Sku")]- public string Sku { get; set; }+ [NoScripts]+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MetaDescription")]+ public string MetaDescription { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Mpn")]- public string Mpn { get; set; }+ [NoScripts]+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MetaTitle")]+ public string MetaTitle { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.GTIN")]- public virtual string Gtin { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.SeName")]+ public string SeName { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.IsGiftVoucher")]- public bool IsGiftVoucher { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.AllowCustomerReviews")]+ public bool AllowCustomerReviews { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.GiftVoucherType")]- public int GiftVoucherTypeId { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Sku")]+ public string Sku { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.OverriddenGiftVoucherAmount")]- [UIHint("DoubleNullable")]- public double? OverGiftAmount { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Mpn")]+ public string Mpn { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.RequireOtherProducts")]- public bool RequireOtherProducts { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.GTIN")]+ public virtual string Gtin { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.RequiredProductIds")]- public string RequiredProductIds { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.IsGiftVoucher")]+ public bool IsGiftVoucher { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.AutomaticallyAddRequiredProducts")]- public bool AutoAddRequiredProducts { get; set; }-- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.IsRecurring")]- public bool IsRecurring { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.GiftVoucherType")]+ public int GiftVoucherTypeId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.RecurringCycleLength")]- public int RecurringCycleLength { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.OverriddenGiftVoucherAmount")]+ [UIHint("DoubleNullable")]+ public double? OverGiftAmount { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.RecurringCyclePeriod")]- public int RecurringCyclePeriodId { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.RequireOtherProducts")]+ public bool RequireOtherProducts { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.RecurringTotalCycles")]- public int RecurringTotalCycles { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.RequiredProductIds")]+ public string RequiredProductIds { get; set; }- //calendar- public GenerateCalendarModel CalendarModel { get; set; } = new();+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.AutomaticallyAddRequiredProducts")]+ public bool AutoAddRequiredProducts { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.IsShipEnabled")]- public bool IsShipEnabled { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.IsRecurring")]+ public bool IsRecurring { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.IsFreeShipping")]- public bool IsFreeShipping { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.RecurringCycleLength")]+ public int RecurringCycleLength { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ShipSeparately")]- public bool ShipSeparately { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.RecurringCyclePeriod")]+ public int RecurringCyclePeriodId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.AdditionalShippingCharge")]- public double AdditionalShippingCharge { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.RecurringTotalCycles")]+ public int RecurringTotalCycles { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.DeliveryDate")]- public string DeliveryDateId { get; set; }- public IList<SelectListItem> AvailableDeliveryDates { get; set; } = new List<SelectListItem>();+ //calendar+ public GenerateCalendarModel CalendarModel { get; set; } = new();- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.IsTaxExempt")]- public bool IsTaxExempt { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.IsShipEnabled")]+ public bool IsShipEnabled { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.TaxCategory")]- public string TaxCategoryId { get; set; }- public IList<SelectListItem> AvailableTaxCategories { get; set; } = new List<SelectListItem>();+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.IsFreeShipping")]+ public bool IsFreeShipping { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.IsTelecommunicationsOrBroadcastingOrElectronicServices")]- public bool IsTele { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ShipSeparately")]+ public bool ShipSeparately { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ManageInventoryMethod")]- public int ManageInventoryMethodId { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.AdditionalShippingCharge")]+ public double AdditionalShippingCharge { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.UseMultipleWarehouses")]- public bool UseMultipleWarehouses { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.DeliveryDate")]+ public string DeliveryDateId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Warehouse")]- public string WarehouseId { get; set; }- public IList<SelectListItem> AvailableWarehouses { get; set; } = new List<SelectListItem>();+ public IList<SelectListItem> AvailableDeliveryDates { get; set; } = new List<SelectListItem>();- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.StockQuantity")]- public int StockQuantity { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ReservedQuantity")]- public int ReservedQuantity { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.IsTaxExempt")]+ public bool IsTaxExempt { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.StockQuantity")]- public string StockQuantityStr { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.TaxCategory")]+ public string TaxCategoryId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.DisplayStockAvailability")]- public bool StockAvailability { get; set; }+ public IList<SelectListItem> AvailableTaxCategories { get; set; } = new List<SelectListItem>();- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.DisplayStockQuantity")]- public bool DisplayStockQuantity { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.IsTelecommunicationsOrBroadcastingOrElectronicServices")]+ public bool IsTele { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MinStockQuantity")]- public int MinStockQuantity { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ManageInventoryMethod")]+ public int ManageInventoryMethodId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.LowStockActivity")]- public int LowStockActivityId { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.UseMultipleWarehouses")]+ public bool UseMultipleWarehouses { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.NotifyAdminForQuantityBelow")]- public int NotifyAdminForQuantityBelow { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Warehouse")]+ public string WarehouseId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.BackorderMode")]- public int BackorderModeId { get; set; }+ public IList<SelectListItem> AvailableWarehouses { get; set; } = new List<SelectListItem>();- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.AllowOutOfStockSubscriptions")]- public bool AllowOutOfStockSubscriptions { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.StockQuantity")]+ public int StockQuantity { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.OrderMinimumQuantity")]- public int OrderMinimumQuantity { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ReservedQuantity")]+ public int ReservedQuantity { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.OrderMaximumQuantity")]- public int OrderMaximumQuantity { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.StockQuantity")]+ public string StockQuantityStr { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.AllowedQuantities")]- public string AllowedQuantities { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.DisplayStockAvailability")]+ public bool StockAvailability { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.NotReturnable")]- public bool NotReturnable { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.DisplayStockQuantity")]+ public bool DisplayStockQuantity { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.DisableBuyButton")]- public bool DisableBuyButton { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MinStockQuantity")]+ public int MinStockQuantity { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.DisableWishlistButton")]- public bool DisableWishlistButton { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.LowStockActivity")]+ public int LowStockActivityId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.AvailableForPreOrder")]- public bool AvailableForPreOrder { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.NotifyAdminForQuantityBelow")]+ public int NotifyAdminForQuantityBelow { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.PreOrderDateTime")]- [UIHint("DateTimeNullable")]- public DateTime? PreOrderDateTime { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.BackorderMode")]+ public int BackorderModeId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.CallForPrice")]- public bool CallForPrice { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.AllowOutOfStockSubscriptions")]+ public bool AllowOutOfStockSubscriptions { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Price")]- public double Price { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.OrderMinimumQuantity")]+ public int OrderMinimumQuantity { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.OldPrice")]- public double OldPrice { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.OrderMaximumQuantity")]+ public int OrderMaximumQuantity { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.CatalogPrice")]- public double CatalogPrice { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.AllowedQuantities")]+ public string AllowedQuantities { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.StartPrice")]- public double StartPrice { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.NotReturnable")]+ public bool NotReturnable { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ProductCost")]- public double ProductCost { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.DisableBuyButton")]+ public bool DisableBuyButton { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.EnteredPrice")]- public bool EnteredPrice { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.DisableWishlistButton")]+ public bool DisableWishlistButton { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MinEnteredPrice")]- public double MinEnteredPrice { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.AvailableForPreOrder")]+ public bool AvailableForPreOrder { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MaxEnteredPrice")]- public double MaxEnteredPrice { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.PreOrderDateTime")]+ [UIHint("DateTimeNullable")]+ public DateTime? PreOrderDateTime { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.BasepriceEnabled")]- public bool BasepriceEnabled { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.BasepriceAmount")]- public double BasepriceAmount { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.BasepriceUnit")]- public string BasepriceUnitId { get; set; }- public IList<SelectListItem> AvailableBasepriceUnits { get; set; } = new List<SelectListItem>();+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.CallForPrice")]+ public bool CallForPrice { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.BasepriceBaseAmount")]- public double BasepriceBaseAmount { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.BasepriceBaseUnit")]- public string BasepriceBaseUnitId { get; set; }- public IList<SelectListItem> AvailableBasepriceBaseUnits { get; set; } = new List<SelectListItem>();+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Price")]+ public double Price { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MarkAsNew")]- public bool MarkAsNew { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MarkAsNewStartDateTime")]- [UIHint("DateTimeNullable")]- public DateTime? MarkAsNewStartDateTime { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MarkAsNewEndDateTime")]- [UIHint("DateTimeNullable")]- public DateTime? MarkAsNewEndDateTime { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.OldPrice")]+ public double OldPrice { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Unit")]- public string UnitId { get; set; }- public IList<SelectListItem> AvailableUnits { get; set; } = new List<SelectListItem>();+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.CatalogPrice")]+ public double CatalogPrice { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Weight")]- public double Weight { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.StartPrice")]+ public double StartPrice { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Length")]- public double Length { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ProductCost")]+ public double ProductCost { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Width")]- public double Width { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.EnteredPrice")]+ public bool EnteredPrice { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Height")]- public double Height { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MinEnteredPrice")]+ public double MinEnteredPrice { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.AvailableStartDateTime")]- [UIHint("DateTimeNullable")]- public DateTime? AvailableStartDateTime { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MaxEnteredPrice")]+ public double MaxEnteredPrice { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.AvailableEndDateTime")]- [UIHint("DateTimeNullable")]- public DateTime? AvailableEndDateTime { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.BasepriceEnabled")]+ public bool BasepriceEnabled { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.DisplayOrder")]- public int DisplayOrder { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.BasepriceAmount")]+ public double BasepriceAmount { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.DisplayOrderCategory")]- public int DisplayOrderCategory { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.BasepriceUnit")]+ public string BasepriceUnitId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.DisplayOrderBrand")]- public int DisplayOrderBrand { get; set; }+ public IList<SelectListItem> AvailableBasepriceUnits { get; set; } = new List<SelectListItem>();- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.DisplayOrderCollection")]- public int DisplayOrderCollection { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.BasepriceBaseAmount")]+ public double BasepriceBaseAmount { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.DisplayOrderOnSale")]- public int OnSale { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.BasepriceBaseUnit")]+ public string BasepriceBaseUnitId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Published")]- public bool Published { get; set; }+ public IList<SelectListItem> AvailableBasepriceBaseUnits { get; set; } = new List<SelectListItem>();- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.CreatedOn")]- public DateTime? CreatedOn { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.UpdatedOn")]- public DateTime? UpdatedOn { get; set; }- public long Ticks { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MarkAsNew")]+ public bool MarkAsNew { get; set; }- public string PrimaryStoreCurrencyCode { get; set; }- public string BaseDimensionIn { get; set; }- public string BaseWeightIn { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MarkAsNewStartDateTime")]+ [UIHint("DateTimeNullable")]+ public DateTime? MarkAsNewStartDateTime { get; set; }- public IList<ProductLocalizedModel> Locales { get; set; } = new List<ProductLocalizedModel>();+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MarkAsNewEndDateTime")]+ [UIHint("DateTimeNullable")]+ public DateTime? MarkAsNewEndDateTime { get; set; }- //product attributes- public IList<SelectListItem> AvailableProductAttributes { get; set; } = new List<SelectListItem>();+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Unit")]+ public string UnitId { get; set; }- //pictures- public ProductPictureModel AddPictureModel { get; set; } = new();- public IList<ProductPictureModel> ProductPictureModels { get; set; } = new List<ProductPictureModel>();+ public IList<SelectListItem> AvailableUnits { get; set; } = new List<SelectListItem>();- //multiple warehouses- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductWarehouseInventory")]- public IList<ProductWarehouseInventoryModel> ProductWarehouseInventoryModels { get; set; } = new List<ProductWarehouseInventoryModel>();+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Weight")]+ public double Weight { get; set; }- //copy product- public CopyProductModel CopyProductModel { get; set; } = new();+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Length")]+ public double Length { get; set; }- #region Nested classes+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Width")]+ public double Width { get; set; }- public class AddProductModel : BaseModel- {- [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchProductName")]-- public string SearchProductName { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchCategory")]- [UIHint("Category")]- public string SearchCategoryId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.List.Brand")]- [UIHint("Brand")]- public string SearchBrandId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchCollection")]- [UIHint("Collection")]- public string SearchCollectionId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchProductType")]- public int SearchProductTypeId { get; set; }-- public IList<SelectListItem> AvailableProductTypes { get; set; } = new List<SelectListItem>();- }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Height")]+ public double Height { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.AvailableStartDateTime")]+ [UIHint("DateTimeNullable")]+ public DateTime? AvailableStartDateTime { get; set; }- public class AddRequiredProductModel : AddProductModel- {-- }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.AvailableEndDateTime")]+ [UIHint("DateTimeNullable")]+ public DateTime? AvailableEndDateTime { get; set; }- public class AddProductSpecificationAttributeModel : BaseModel, IProductValidVendor- {- public string Id { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.DisplayOrder")]+ public int DisplayOrder { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.SpecificationAttributes.Fields.SpecificationAttribute")]- public string SpecificationAttributeId { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.DisplayOrderCategory")]+ public int DisplayOrderCategory { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.SpecificationAttributes.Fields.AttributeType")]- public SpecificationAttributeType AttributeTypeId { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.DisplayOrderBrand")]+ public int DisplayOrderBrand { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.SpecificationAttributes.Fields.SpecificationAttributeOption")]- public string SpecificationAttributeOptionId { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.DisplayOrderCollection")]+ public int DisplayOrderCollection { get; set; }- [NoScripts]- [GrandResourceDisplayName("Vendor.Catalog.Products.SpecificationAttributes.Fields.CustomName")]- public string CustomName { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.DisplayOrderOnSale")]+ public int OnSale { get; set; }- [NoScripts]- [GrandResourceDisplayName("Vendor.Catalog.Products.SpecificationAttributes.Fields.CustomValue")]- public string CustomValue { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Published")]+ public bool Published { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.SpecificationAttributes.Fields.AllowFiltering")]- public bool AllowFiltering { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.CreatedOn")]+ public DateTime? CreatedOn { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.SpecificationAttributes.Fields.ShowOnProductPage")]- public bool ShowOnProductPage { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.UpdatedOn")]+ public DateTime? UpdatedOn { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.SpecificationAttributes.Fields.DisplayOrder")]- public int DisplayOrder { get; set; }+ public long Ticks { get; set; }- public string ProductId { get; set; }- public IList<SelectListItem> AvailableAttributes { get; set; } = new List<SelectListItem>();- public IList<SelectListItem> AvailableOptions { get; set; } = new List<SelectListItem>();- }+ public string PrimaryStoreCurrencyCode { get; set; }+ public string BaseDimensionIn { get; set; }+ public string BaseWeightIn { get; set; }- public class ProductPictureModel : BaseEntityModel, ILocalizedModel<ProductPictureModel.ProductPictureLocalizedModel>, IProductValidVendor- {- public string ProductId { get; set; }+ //product attributes+ public IList<SelectListItem> AvailableProductAttributes { get; set; } = new List<SelectListItem>();++ //pictures+ public ProductPictureModel AddPictureModel { get; set; } = new();+ public IList<ProductPictureModel> ProductPictureModels { get; set; } = new List<ProductPictureModel>();++ //multiple warehouses+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductWarehouseInventory")]+ public IList<ProductWarehouseInventoryModel> ProductWarehouseInventoryModels { get; set; } =+ new List<ProductWarehouseInventoryModel>();++ //copy product+ public CopyProductModel CopyProductModel { get; set; } = new();++ public IList<ProductLocalizedModel> Locales { get; set; } = new List<ProductLocalizedModel>();++ #region Nested classes++ public class AddProductModel : BaseModel+ {+ [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchProductName")]++ public string SearchProductName { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchCategory")]+ [UIHint("Category")]+ public string SearchCategoryId { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.List.Brand")]+ [UIHint("Brand")]+ public string SearchBrandId { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchCollection")]+ [UIHint("Collection")]+ public string SearchCollectionId { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.List.SearchProductType")]+ public int SearchProductTypeId { get; set; }++ public IList<SelectListItem> AvailableProductTypes { get; set; } = new List<SelectListItem>();+ }- [UIHint("MultiPicture")]- [GrandResourceDisplayName("Vendor.Catalog.Products.Pictures.Fields.Picture")]- public string PictureId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Pictures.Fields.Picture")]- public string PictureUrl { get; set; }+ public class AddRequiredProductModel : AddProductModel+ {+ }- [GrandResourceDisplayName("Vendor.Catalog.Products.Pictures.Fields.DisplayOrder")]- public int DisplayOrder { get; set; }+ public class AddProductSpecificationAttributeModel : BaseModel, IProductValidVendor+ {+ public string Id { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.SpecificationAttributes.Fields.SpecificationAttribute")]+ public string SpecificationAttributeId { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.SpecificationAttributes.Fields.AttributeType")]+ public SpecificationAttributeType AttributeTypeId { get; set; }++ [GrandResourceDisplayName(+ "Vendor.Catalog.Products.SpecificationAttributes.Fields.SpecificationAttributeOption")]+ public string SpecificationAttributeOptionId { get; set; }++ [NoScripts]+ [GrandResourceDisplayName("Vendor.Catalog.Products.SpecificationAttributes.Fields.CustomName")]+ public string CustomName { get; set; }++ [NoScripts]+ [GrandResourceDisplayName("Vendor.Catalog.Products.SpecificationAttributes.Fields.CustomValue")]+ public string CustomValue { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.SpecificationAttributes.Fields.AllowFiltering")]+ public bool AllowFiltering { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.SpecificationAttributes.Fields.ShowOnProductPage")]+ public bool ShowOnProductPage { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.SpecificationAttributes.Fields.DisplayOrder")]+ public int DisplayOrder { get; set; }++ public IList<SelectListItem> AvailableAttributes { get; set; } = new List<SelectListItem>();+ public IList<SelectListItem> AvailableOptions { get; set; } = new List<SelectListItem>();++ public string ProductId { get; set; }+ }++ public class ProductPictureModel : BaseEntityModel,+ ILocalizedModel<ProductPictureModel.ProductPictureLocalizedModel>, IProductValidVendor+ {+ [UIHint("MultiPicture")]+ [GrandResourceDisplayName("Vendor.Catalog.Products.Pictures.Fields.Picture")]+ public string PictureId { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.Pictures.Fields.Picture")]+ public string PictureUrl { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.Pictures.Fields.DisplayOrder")]+ public int DisplayOrder { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.Pictures.Fields.OverrideAltAttribute")]+ public string AltAttribute { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.Pictures.Fields.OverrideTitleAttribute")]+ public string TitleAttribute { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.Pictures.Fields.Style")]+ public string Style { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.Pictures.Fields.ExtraField")]+ public string ExtraField { get; set; }++ public IList<ProductPictureLocalizedModel> Locales { get; set; } = new List<ProductPictureLocalizedModel>();+ public string ProductId { get; set; }++ public class ProductPictureLocalizedModel : ILocalizedModelLocal+ {[GrandResourceDisplayName("Vendor.Catalog.Products.Pictures.Fields.OverrideAltAttribute")]public string AltAttribute { get; set; }[GrandResourceDisplayName("Vendor.Catalog.Products.Pictures.Fields.OverrideTitleAttribute")]public string TitleAttribute { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Pictures.Fields.Style")]- public string Style { get; set; }+ public string LanguageId { get; set; }+ }+ }- [GrandResourceDisplayName("Vendor.Catalog.Products.Pictures.Fields.ExtraField")]- public string ExtraField { get; set; }+ public class ProductCategoryModel : BaseEntityModel, IProductValidVendor+ {+ [GrandResourceDisplayName("Vendor.Catalog.Products.Categories.Fields.Category")]+ public string Category { get; set; }- public IList<ProductPictureLocalizedModel> Locales { get; set; } = new List<ProductPictureLocalizedModel>();+ public string CategoryId { get; set; }- public class ProductPictureLocalizedModel : ILocalizedModelLocal- {- public string LanguageId { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Categories.Fields.DisplayOrder")]+ public int DisplayOrder { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Pictures.Fields.OverrideAltAttribute")]- public string AltAttribute { get; set; }+ public string ProductId { get; set; }+ }- [GrandResourceDisplayName("Vendor.Catalog.Products.Pictures.Fields.OverrideTitleAttribute")]- public string TitleAttribute { get; set; }+ public class ProductCollectionModel : BaseEntityModel, IProductValidVendor+ {+ [GrandResourceDisplayName("Vendor.Catalog.Products.Collections.Fields.Collection")]+ public string Collection { get; set; }- }+ public string CollectionId { get; set; }- }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Collections.Fields.DisplayOrder")]+ public int DisplayOrder { get; set; }- public class ProductCategoryModel : BaseEntityModel, IProductValidVendor- {- [GrandResourceDisplayName("Vendor.Catalog.Products.Categories.Fields.Category")]- public string Category { get; set; }+ public string ProductId { get; set; }+ }- public string ProductId { get; set; }+ public class RelatedProductModel : BaseEntityModel, IProductRelatedValidVendor+ {+ [GrandResourceDisplayName("Vendor.Catalog.Products.RelatedProducts.Fields.Product")]+ public string Product2Name { get; set; }- public string CategoryId { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.RelatedProducts.Fields.DisplayOrder")]+ public int DisplayOrder { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Categories.Fields.DisplayOrder")]- public int DisplayOrder { get; set; }- }+ public string ProductId1 { get; set; }+ public string ProductId2 { get; set; }+ }- public class ProductCollectionModel : BaseEntityModel, IProductValidVendor- {- [GrandResourceDisplayName("Vendor.Catalog.Products.Collections.Fields.Collection")]- public string Collection { get; set; }+ public class AddRelatedProductModel : AddProductModel, IProductValidVendor+ {+ public string[] SelectedProductIds { get; set; }+ public string ProductId { get; set; }+ }- public string ProductId { get; set; }+ public class SimilarProductModel : BaseEntityModel, IProductRelatedValidVendor+ {+ [GrandResourceDisplayName("Vendor.Catalog.Products.SimilarProducts.Fields.Product")]+ public string Product2Name { get; set; }- public string CollectionId { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.SimilarProducts.Fields.DisplayOrder")]+ public int DisplayOrder { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Collections.Fields.DisplayOrder")]- public int DisplayOrder { get; set; }- }+ public string ProductId1 { get; set; }+ public string ProductId2 { get; set; }+ }- public class RelatedProductModel : BaseEntityModel, IProductRelatedValidVendor- {- public string ProductId1 { get; set; }- public string ProductId2 { get; set; }+ public class AddSimilarProductModel : AddProductModel, IProductValidVendor+ {+ public string[] SelectedProductIds { get; set; }+ public string ProductId { get; set; }+ }- [GrandResourceDisplayName("Vendor.Catalog.Products.RelatedProducts.Fields.Product")]- public string Product2Name { get; set; }+ public class BundleProductModel : BaseEntityModel, IProductValidVendor+ {+ public string ProductBundleId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.RelatedProducts.Fields.DisplayOrder")]- public int DisplayOrder { get; set; }- }- public class AddRelatedProductModel : AddProductModel, IProductValidVendor- {- public string ProductId { get; set; }- public string[] SelectedProductIds { get; set; }- }+ [GrandResourceDisplayName("Vendor.Catalog.Products.BundleProducts.Fields.Product")]+ public string ProductName { get; set; }- public class SimilarProductModel : BaseEntityModel, IProductRelatedValidVendor- {- public string ProductId1 { get; set; }- public string ProductId2 { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.BundleProducts.Fields.Quantity")]+ public int Quantity { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.SimilarProducts.Fields.Product")]- public string Product2Name { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.BundleProducts.Fields.DisplayOrder")]+ public int DisplayOrder { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.SimilarProducts.Fields.DisplayOrder")]- public int DisplayOrder { get; set; }- }+ public string ProductId { get; set; }+ }- public class AddSimilarProductModel : AddProductModel, IProductValidVendor- {- public string ProductId { get; set; }+ public class AddBundleProductModel : AddProductModel, IProductValidVendor+ {+ public string[] SelectedProductIds { get; set; }+ public string ProductId { get; set; }+ }- public string[] SelectedProductIds { get; set; }- }+ public class AssociatedProductModel : BaseEntityModel, IProductValidVendor+ {+ [GrandResourceDisplayName("Vendor.Catalog.Products.AssociatedProducts.Fields.Product")]+ public string ProductName { get; set; }- public class BundleProductModel : BaseEntityModel, IProductValidVendor- {- public string ProductBundleId { get; set; }- public string ProductId { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.AssociatedProducts.Fields.DisplayOrder")]+ public int DisplayOrder { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.BundleProducts.Fields.Product")]- public string ProductName { get; set; }+ public string ProductId { get; set; }+ }- [GrandResourceDisplayName("Vendor.Catalog.Products.BundleProducts.Fields.Quantity")]- public int Quantity { get; set; }+ public class AddAssociatedProductModel : AddProductModel, IProductValidVendor+ {+ public string[] SelectedProductIds { get; set; }+ public string ProductId { get; set; }+ }- [GrandResourceDisplayName("Vendor.Catalog.Products.BundleProducts.Fields.DisplayOrder")]- public int DisplayOrder { get; set; }- }+ public class CrossSellProductModel : BaseEntityModel, IProductValidVendor+ {+ [GrandResourceDisplayName("Vendor.Catalog.Products.CrossSells.Fields.Product")]+ public string Product2Name { get; set; }- public class AddBundleProductModel : AddProductModel, IProductValidVendor- {- public string ProductId { get; set; }+ public string ProductId { get; set; }+ }- public string[] SelectedProductIds { get; set; }- }+ public class AddCrossSellProductModel : AddProductModel, IProductValidVendor+ {+ public string[] SelectedProductIds { get; set; }+ public string ProductId { get; set; }+ }- public class AssociatedProductModel : BaseEntityModel, IProductValidVendor- {- public string ProductId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.AssociatedProducts.Fields.Product")]- public string ProductName { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.AssociatedProducts.Fields.DisplayOrder")]- public int DisplayOrder { get; set; }- }+ public class RecommendedProductModel : BaseEntityModel, IProductValidVendor+ {+ [GrandResourceDisplayName("Vendor.Catalog.Products.Recommended.Fields.Product")]+ public string Product2Name { get; set; }- public class AddAssociatedProductModel : AddProductModel, IProductValidVendor- {- public string ProductId { get; set; }+ public string ProductId { get; set; }+ }- public string[] SelectedProductIds { get; set; }- }+ public class AddRecommendedProductModel : AddProductModel, IProductValidVendor+ {+ public string[] SelectedProductIds { get; set; }+ public string ProductId { get; set; }+ }- public class CrossSellProductModel : BaseEntityModel, IProductValidVendor- {- public string ProductId { get; set; }+ public class ProductPriceModel : BaseEntityModel+ {+ public string CurrencyCode { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.CrossSells.Fields.Product")]- public string Product2Name { get; set; }- }+ public double Price { get; set; }+ }- public class AddCrossSellProductModel : AddProductModel, IProductValidVendor- {- public string ProductId { get; set; }+ public class TierPriceModel : BaseEntityModel, IProductValidVendor+ {+ [GrandResourceDisplayName("Vendor.Catalog.Products.TierPrices.Fields.CurrencyCode")]+ public string CurrencyCode { get; set; }- public string[] SelectedProductIds { get; set; }- }+ public IList<SelectListItem> AvailableCurrencies { get; set; } = new List<SelectListItem>();- public class RecommendedProductModel : BaseEntityModel, IProductValidVendor- {- public string ProductId { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.TierPrices.Fields.Quantity")]+ public int Quantity { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Recommended.Fields.Product")]- public string Product2Name { get; set; }- }- public class AddRecommendedProductModel : AddProductModel, IProductValidVendor- {- public string ProductId { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.TierPrices.Fields.Price")]+ public double Price { get; set; }- public string[] SelectedProductIds { get; set; }- }+ [GrandResourceDisplayName("Vendor.Catalog.Products.TierPrices.Fields.StartDateTime")]+ [UIHint("DateTimeNullable")]+ public DateTime? StartDateTime { get; set; }- public class ProductPriceModel : BaseEntityModel- {- public string CurrencyCode { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.TierPrices.Fields.EndDateTime")]+ [UIHint("DateTimeNullable")]+ public DateTime? EndDateTime { get; set; }- public double Price { get; set; }- }+ public string ProductId { get; set; }+ }- public class TierPriceModel : BaseEntityModel, IProductValidVendor- {- public string ProductId { get; set; }+ public class TierPriceDeleteModel : BaseEntityModel, IProductValidVendor+ {+ public string ProductId { get; set; }+ }- [GrandResourceDisplayName("Vendor.Catalog.Products.TierPrices.Fields.CurrencyCode")]- public string CurrencyCode { get; set; }- public IList<SelectListItem> AvailableCurrencies { get; set; } = new List<SelectListItem>();+ public class ProductWarehouseInventoryModel : BaseModel+ {+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductWarehouseInventory.Fields.Warehouse")]+ public string WarehouseId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.TierPrices.Fields.Quantity")]- public int Quantity { get; set; }+ public string WarehouseCode { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.TierPrices.Fields.Price")]- public double Price { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductWarehouseInventory.Fields.Warehouse")]+ public string WarehouseName { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.TierPrices.Fields.StartDateTime")]- [UIHint("DateTimeNullable")]- public DateTime? StartDateTime { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductWarehouseInventory.Fields.WarehouseUsed")]+ public bool WarehouseUsed { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.TierPrices.Fields.EndDateTime")]- [UIHint("DateTimeNullable")]- public DateTime? EndDateTime { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductWarehouseInventory.Fields.StockQuantity")]+ public int StockQuantity { get; set; }- }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductWarehouseInventory.Fields.ReservedQuantity")]+ public int ReservedQuantity { get; set; }+ }- public class TierPriceDeleteModel : BaseEntityModel, IProductValidVendor- {- public string ProductId { get; set; }- }-- public class ProductWarehouseInventoryModel : BaseModel- {- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductWarehouseInventory.Fields.Warehouse")]- public string WarehouseId { get; set; }- public string WarehouseCode { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductWarehouseInventory.Fields.Warehouse")]- public string WarehouseName { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductWarehouseInventory.Fields.WarehouseUsed")]- public bool WarehouseUsed { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductWarehouseInventory.Fields.StockQuantity")]- public int StockQuantity { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductWarehouseInventory.Fields.ReservedQuantity")]- public int ReservedQuantity { get; set; }+ public class ReservationModel : BaseEntityModel, IProductValidVendor+ {+ public string ReservationId { get; set; }+ public DateTime Date { get; set; }+ public string Resource { get; set; }+ public string Parameter { get; set; }+ public string OrderId { get; set; }+ public string Duration { get; set; }+ public string ProductId { get; set; }+ }- }- public class ReservationModel : BaseEntityModel, IProductValidVendor- {- public string ReservationId { get; set; }- public DateTime Date { get; set; }- public string Resource { get; set; }- public string Parameter { get; set; }- public string OrderId { get; set; }- public string ProductId { get; set; }- public string Duration { get; set; }- }+ public class BidModel : BaseEntityModel, IProductValidVendor+ {+ public string BidId { get; set; }+ public DateTime Date { get; set; }+ public string CustomerId { get; set; }+ public string Email { get; set; }+ public string Amount { get; set; }+ public string OrderId { get; set; }+ public string ProductId { get; set; }+ }- public class BidModel : BaseEntityModel, IProductValidVendor+ public class GenerateCalendarModel : BaseModel, IProductValidVendor+ {+ public GenerateCalendarModel(){- public string ProductId { get; set; }- public string BidId { get; set; }- public DateTime Date { get; set; }- public string CustomerId { get; set; }- public string Email { get; set; }- public string Amount { get; set; }- public string OrderId { get; set; }+ Interval = 1;+ Quantity = 1;}- public class GenerateCalendarModel : BaseModel, IProductValidVendor- {+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.StartDate")]+ [UIHint("DateNullable")]+ public DateTime? StartDate { get; set; }- public GenerateCalendarModel()- {- Interval = 1;- Quantity = 1;- }- public string ProductId { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.StartTime")]+ [UIHint("Time")]+ public DateTime StartTime { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.StartDate")]- [UIHint("DateNullable")]- public DateTime? StartDate { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.EndDate")]+ [UIHint("DateNullable")]+ public DateTime? EndDate { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.StartTime")]- [UIHint("Time")]- public DateTime StartTime { get; set; }+ [UIHint("Time")]+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.EndTime")]+ public DateTime EndTime { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.EndDate")]- [UIHint("DateNullable")]- public DateTime? EndDate { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.Interval")]+ public int Interval { get; set; } = 1;- [UIHint("Time")]- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.EndTime")]- public DateTime EndTime { get; set; }+ public int IntervalUnit { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.Interval")]- public int Interval { get; set; } = 1;- public int IntervalUnit { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.IncBothDate")]+ public bool IncBothDate { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.IncBothDate")]- public bool IncBothDate { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.Quantity")]+ public int Quantity { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.Quantity")]- public int Quantity { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.Resource")]+ public string Resource { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.Resource")]- public string Resource { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.Parameter")]+ public string Parameter { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.Parameter")]- public string Parameter { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.Monday")]+ public bool Monday { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.Monday")]- public bool Monday { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.Tuesday")]+ public bool Tuesday { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.Tuesday")]- public bool Tuesday { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.Wednesday")]+ public bool Wednesday { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.Wednesday")]- public bool Wednesday { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.Thursday")]+ public bool Thursday { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.Thursday")]- public bool Thursday { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.Friday")]+ public bool Friday { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.Friday")]- public bool Friday { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.Saturday")]+ public bool Saturday { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.Saturday")]- public bool Saturday { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.Sunday")]+ public bool Sunday { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Calendar.Sunday")]- public bool Sunday { get; set; }+ public string ProductId { get; set; }+ }- }+ public class ProductAttributeMappingModel : BaseEntityModel, IProductValidVendor+ {+ public string ProductAttributeId { get; set; }- public class ProductAttributeMappingModel : BaseEntityModel, IProductValidVendor- {- public string ProductId { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Fields.Attribute")]+ public string ProductAttribute { get; set; }- public string ProductAttributeId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Fields.Attribute")]- public string ProductAttribute { get; set; }- public IList<SelectListItem> AvailableProductAttribute { get; set; } = new List<SelectListItem>();+ public IList<SelectListItem> AvailableProductAttribute { get; set; } = new List<SelectListItem>();- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Fields.TextPrompt")]- public string TextPrompt { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Fields.TextPrompt")]+ public string TextPrompt { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Fields.IsRequired")]- public bool IsRequired { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Fields.ShowOnCatalogPage")]- public bool ShowOnCatalogPage { get; set; }- public AttributeControlType AttributeControlTypeId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Fields.AttributeControlType")]- public string AttributeControlType { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Fields.IsRequired")]+ public bool IsRequired { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Fields.DisplayOrder")]- public int DisplayOrder { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Fields.ShowOnCatalogPage")]+ public bool ShowOnCatalogPage { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Fields.Combination")]- public bool Combination { get; set; }+ public AttributeControlType AttributeControlTypeId { get; set; }- public bool ShouldHaveValues { get; set; }- public int TotalValues { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Fields.AttributeControlType")]+ public string AttributeControlType { get; set; }- //validation fields- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.ValidationRules")]- public bool ValidationRulesAllowed { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Fields.DisplayOrder")]+ public int DisplayOrder { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.ValidationRules.MinLength")]- [UIHint("Int32Nullable")]- public int? ValidationMinLength { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Fields.Combination")]+ public bool Combination { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.ValidationRules.MaxLength")]- [UIHint("Int32Nullable")]- public int? ValidationMaxLength { get; set; }+ public bool ShouldHaveValues { get; set; }+ public int TotalValues { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.ValidationRules.FileAllowedExtensions")]+ //validation fields+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.ValidationRules")]+ public bool ValidationRulesAllowed { get; set; }- public string ValidationFileAllowedExtensions { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.ValidationRules.MinLength")]+ [UIHint("Int32Nullable")]+ public int? ValidationMinLength { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.ValidationRules.FileMaximumSize")]- [UIHint("Int32Nullable")]- public int? ValidationFileMaximumSize { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.ValidationRules.MaxLength")]+ [UIHint("Int32Nullable")]+ public int? ValidationMaxLength { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.ValidationRules.DefaultValue")]+ [GrandResourceDisplayName(+ "Vendor.Catalog.Products.ProductAttributes.Attributes.ValidationRules.FileAllowedExtensions")]- public string DefaultValue { get; set; }- public string ValidationRulesString { get; set; }+ public string ValidationFileAllowedExtensions { get; set; }- //condition- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Condition")]- public bool ConditionAllowed { get; set; }- public string ConditionString { get; set; }- }- public class ProductAttributeValueListModel : BaseModel, IProductValidVendor- {- public string ProductId { get; set; }+ [GrandResourceDisplayName(+ "Vendor.Catalog.Products.ProductAttributes.Attributes.ValidationRules.FileMaximumSize")]+ [UIHint("Int32Nullable")]+ public int? ValidationFileMaximumSize { get; set; }- public string ProductName { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.ValidationRules.DefaultValue")]- public string ProductAttributeMappingId { get; set; }+ public string DefaultValue { get; set; }- public string ProductAttributeName { get; set; }- }+ public string ValidationRulesString { get; set; }- public class ProductAttributeValueModel : BaseEntityModel, ILocalizedModel<ProductAttributeValueLocalizedModel>, IProductValidVendor- {- public string ProductAttributeMappingId { get; set; }- public string ProductId { get; set; }+ //condition+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Condition")]+ public bool ConditionAllowed { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.AttributeValueType")]- public AttributeValueType AttributeValueTypeId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.AttributeValueType")]- public string AttributeValueTypeName { get; set; }+ public string ConditionString { get; set; }+ public string ProductId { get; set; }+ }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.AssociatedProduct")]- public string AssociatedProductId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.AssociatedProduct")]- public string AssociatedProductName { get; set; }+ public class ProductAttributeValueListModel : BaseModel, IProductValidVendor+ {+ public string ProductName { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.Name")]+ public string ProductAttributeMappingId { get; set; }- public string Name { get; set; }+ public string ProductAttributeName { get; set; }+ public string ProductId { get; set; }+ }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.ColorSquaresRgb")]+ public class ProductAttributeValueModel : BaseEntityModel, ILocalizedModel<ProductAttributeValueLocalizedModel>,+ IProductValidVendor+ {+ public string ProductAttributeMappingId { get; set; }- public string ColorSquaresRgb { get; set; }- public bool DisplayColorSquaresRgb { get; set; }+ [GrandResourceDisplayName(+ "Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.AttributeValueType")]+ public AttributeValueType AttributeValueTypeId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.ImageSquaresPicture")]- [UIHint("Picture")]- public string ImageSquaresPictureId { get; set; }- public bool DisplayImageSquaresPicture { get; set; }+ [GrandResourceDisplayName(+ "Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.AttributeValueType")]+ public string AttributeValueTypeName { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.PriceAdjustment")]- public double PriceAdjustment { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.PriceAdjustment")]- //used only on the values list page- public string PriceAdjustmentStr { get; set; }- public string PrimaryStoreCurrencyCode { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.WeightAdjustment")]- public double WeightAdjustment { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.WeightAdjustment")]- //used only on the values list page- public string WeightAdjustmentStr { get; set; }+ [GrandResourceDisplayName(+ "Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.AssociatedProduct")]+ public string AssociatedProductId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.Cost")]- public double Cost { get; set; }+ [GrandResourceDisplayName(+ "Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.AssociatedProduct")]+ public string AssociatedProductName { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.Quantity")]- public int Quantity { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.Name")]- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.IsPreSelected")]- public bool IsPreSelected { get; set; }+ public string Name { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.DisplayOrder")]- public int DisplayOrder { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.ColorSquaresRgb")]- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.Picture")]- public string PictureId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.Picture")]- public string PictureThumbnailUrl { get; set; }+ public string ColorSquaresRgb { get; set; }- public IList<ProductPictureModel> ProductPictureModels { get; set; } = new List<ProductPictureModel>();- public IList<ProductAttributeValueLocalizedModel> Locales { get; set; } = new List<ProductAttributeValueLocalizedModel>();+ public bool DisplayColorSquaresRgb { get; set; }- #region Nested classes+ [GrandResourceDisplayName(+ "Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.ImageSquaresPicture")]+ [UIHint("Picture")]+ public string ImageSquaresPictureId { get; set; }- public class AssociateProductToAttributeValueModel : AddProductModel- {- public string AssociatedToProductId { get; set; }- }+ public bool DisplayImageSquaresPicture { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.PriceAdjustment")]+ public double PriceAdjustment { get; set; }- #endregion- }- public class ProductAttributeValueLocalizedModel : ILocalizedModelLocal- {- public string LanguageId { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.PriceAdjustment")]+ //used only on the values list page+ public string PriceAdjustmentStr { get; set; }++ public string PrimaryStoreCurrencyCode { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.Name")]+ [GrandResourceDisplayName(+ "Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.WeightAdjustment")]+ public double WeightAdjustment { get; set; }- public string Name { get; set; }- }- public class ProductAttributeCombinationModel : BaseEntityModel, IProductValidVendor- {- public string ProductId { get; set; }+ [GrandResourceDisplayName(+ "Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.WeightAdjustment")]+ //used only on the values list page+ public string WeightAdjustmentStr { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.Cost")]+ public double Cost { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Attributes")]- public string Attributes { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.Quantity")]+ public int Quantity { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.StockQuantity")]- public int StockQuantity { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.IsPreSelected")]+ public bool IsPreSelected { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.AllowOutOfStockOrders")]- public bool AllowOutOfStockOrders { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.DisplayOrder")]+ public int DisplayOrder { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Sku")]- public string Sku { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.Picture")]+ public string PictureId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Mpn")]- public string Mpn { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.Picture")]+ public string PictureThumbnailUrl { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Gtin")]- public string Gtin { get; set; }+ public IList<ProductPictureModel> ProductPictureModels { get; set; } = new List<ProductPictureModel>();- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.OverriddenPrice")]- [UIHint("DoubleNullable")]- public double? OverriddenPrice { get; set; }+ public IList<ProductAttributeValueLocalizedModel> Locales { get; set; } =+ new List<ProductAttributeValueLocalizedModel>();- [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.NotifyAdminForQuantityBelow")]- public int NotifyAdminForQuantityBelow { get; set; }+ public string ProductId { get; set; }- }- public class ProductAttributeCombinationTierPricesModel : BaseEntityModel, IProductValidVendor+ #region Nested classes++ public class AssociateProductToAttributeValueModel : AddProductModel{- public string ProductId { get; set; }-- public string ProductAttributeCombinationId { get; set; }- /// <summary>- /// Gets or sets the quantity- /// </summary>- public int Quantity { get; set; }-- /// <summary>- /// Gets or sets the price- /// </summary>- public double Price { get; set; }+ public string AssociatedToProductId { get; set; }}#endregion}- public class ProductLocalizedModel : ILocalizedModelLocal, ISlugModelLocal+ public class ProductAttributeValueLocalizedModel : ILocalizedModelLocal{+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.Name")]++ public string Name { get; set; }+public string LanguageId { get; set; }+ }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Name")]+ public class ProductAttributeCombinationModel : BaseEntityModel, IProductValidVendor+ {+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Attributes")]+ public string Attributes { get; set; }- public string Name { get; set; }+ [GrandResourceDisplayName(+ "Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.StockQuantity")]+ public int StockQuantity { get; set; }- [NoScripts]- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ShortDescription")]- public string ShortDescription { get; set; }+ [GrandResourceDisplayName(+ "Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.AllowOutOfStockOrders")]+ public bool AllowOutOfStockOrders { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.FullDescription")]+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Sku")]+ public string Sku { get; set; }- [NoScripts]- public string FullDescription { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MetaKeywords")]+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Mpn")]+ public string Mpn { get; set; }- [NoScripts]- public string MetaKeywords { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Gtin")]+ public string Gtin { get; set; }- [NoScripts]- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MetaDescription")]- public string MetaDescription { get; set; }+ [GrandResourceDisplayName(+ "Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.OverriddenPrice")]+ [UIHint("DoubleNullable")]+ public double? OverriddenPrice { get; set; }- [NoScripts]- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MetaTitle")]- public string MetaTitle { get; set; }+ [GrandResourceDisplayName(+ "Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.NotifyAdminForQuantityBelow")]+ public int NotifyAdminForQuantityBelow { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.SeName")]- public string SeName { get; set; }+ public string ProductId { get; set; }}++ public class ProductAttributeCombinationTierPricesModel : BaseEntityModel, IProductValidVendor+ {+ public string ProductAttributeCombinationId { get; set; }++ /// <summary>+ /// Gets or sets the quantity+ /// </summary>+ public int Quantity { get; set; }++ /// <summary>+ /// Gets or sets the price+ /// </summary>+ public double Price { get; set; }++ public string ProductId { get; set; }+ }++ #endregion+}++public class ProductLocalizedModel : ILocalizedModelLocal, ISlugModelLocal+{+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Name")]++ public string Name { get; set; }++ [NoScripts]+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ShortDescription")]+ public string ShortDescription { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.FullDescription")]+ [NoScripts]+ public string FullDescription { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MetaKeywords")]+ [NoScripts]+ public string MetaKeywords { get; set; }++ [NoScripts]+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MetaDescription")]+ public string MetaDescription { get; set; }++ [NoScripts]+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.MetaTitle")]+ public string MetaTitle { get; set; }++ public string LanguageId { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.SeName")]+ public string SeName { get; set; }}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Catalog/ProductReviewModel.cs b/src/Web/Grand.Web.Vendor/Models/Catalog/ProductReviewModel.csindex 54f968d97..05ef05ad2 100644--- a/src/Web/Grand.Web.Vendor/Models/Catalog/ProductReviewModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Catalog/ProductReviewModel.cs@@ -1,35 +1,44 @@using Grand.Infrastructure.ModelBinding;using Grand.Infrastructure.Models;-namespace Grand.Web.Vendor.Models.Catalog+namespace Grand.Web.Vendor.Models.Catalog;++public class ProductReviewModel : BaseEntityModel{- public class ProductReviewModel : BaseEntityModel- {- [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.Product")]- public string ProductId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.Product")]- public string ProductName { get; set; }--- [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.Store")]- public string StoreName { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.Customer")]- public string CustomerId { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.Customer")]- public string CustomerInfo { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.Title")]- public string Title { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.ReviewText")]- public string ReviewText { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.ReplyText")]- public string ReplyText { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.Signature")]- public string Signature { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.Rating")]- public int Rating { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.IsApproved")]- public bool IsApproved { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.CreatedOn")]- public DateTime CreatedOn { get; set; }- }+ [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.Product")]+ public string ProductId { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.Product")]+ public string ProductName { get; set; }+++ [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.Store")]+ public string StoreName { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.Customer")]+ public string CustomerId { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.Customer")]+ public string CustomerInfo { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.Title")]+ public string Title { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.ReviewText")]+ public string ReviewText { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.ReplyText")]+ public string ReplyText { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.Signature")]+ public string Signature { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.Rating")]+ public int Rating { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.IsApproved")]+ public bool IsApproved { get; set; }++ [GrandResourceDisplayName("Vendor.Catalog.ProductReviews.Fields.CreatedOn")]+ public DateTime CreatedOn { get; set; }}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Catalog/ProductSpecificationAttributeModel.cs b/src/Web/Grand.Web.Vendor/Models/Catalog/ProductSpecificationAttributeModel.csindex 8a3db7d91..ea811af69 100644--- a/src/Web/Grand.Web.Vendor/Models/Catalog/ProductSpecificationAttributeModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Catalog/ProductSpecificationAttributeModel.cs@@ -1,27 +1,26 @@using Grand.Infrastructure.Models;-namespace Grand.Web.Vendor.Models.Catalog+namespace Grand.Web.Vendor.Models.Catalog;++public class ProductSpecificationAttributeModel : BaseEntityModel, IProductValidVendor{- public class ProductSpecificationAttributeModel : BaseEntityModel, IProductValidVendor- {- public int AttributeTypeId { get; set; }+ public int AttributeTypeId { get; set; }++ public string AttributeTypeName { get; set; }- public string AttributeTypeName { get; set; }+ public string AttributeName { get; set; }- public string AttributeName { get; set; }+ public string AttributeId { get; set; }- public string AttributeId { get; set; }+ public string ValueRaw { get; set; }- public string ValueRaw { get; set; }+ public bool AllowFiltering { get; set; }- public bool AllowFiltering { get; set; }+ public bool ShowOnProductPage { get; set; }- public bool ShowOnProductPage { get; set; }+ public int DisplayOrder { get; set; }- public int DisplayOrder { get; set; }-- public string SpecificationAttributeOptionId { get; set; }+ public string SpecificationAttributeOptionId { get; set; }- public string ProductId { get; set; }- }+ public string ProductId { get; set; }}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Cms/VendorWidgetModel.cs b/src/Web/Grand.Web.Vendor/Models/Cms/VendorWidgetModel.csindex f2a3794ca..3a383a4ab 100644--- a/src/Web/Grand.Web.Vendor/Models/Cms/VendorWidgetModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Cms/VendorWidgetModel.cs@@ -1,11 +1,10 @@using Grand.Infrastructure.Models;-namespace Grand.Web.Vendor.Models.Cms+namespace Grand.Web.Vendor.Models.Cms;++public class VendorWidgetModel : BaseModel{- public class VendorWidgetModel : BaseModel- {- public string WidgetZone { get; set; }- public string ViewComponentName { get; set; }- public object AdditionalData { get; set; }- }+ public string WidgetZone { get; set; }+ public string ViewComponentName { get; set; }+ public object AdditionalData { get; set; }}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Common/AddressModel.cs b/src/Web/Grand.Web.Vendor/Models/Common/AddressModel.csindex 8e3cfbcf9..58dde484f 100644--- a/src/Web/Grand.Web.Vendor/Models/Common/AddressModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Common/AddressModel.cs@@ -7,133 +7,133 @@ using Grand.Web.Common.Models;using Microsoft.AspNetCore.Mvc;using Microsoft.AspNetCore.Mvc.Rendering;-namespace Grand.Web.Vendor.Models.Common+namespace Grand.Web.Vendor.Models.Common;++public class AddressModel : BaseEntityModel{- public class AddressModel : BaseEntityModel- {- [GrandResourceDisplayName("Vendor.Address.Fields.AddressName")]- public string Name { get; set; }+ [GrandResourceDisplayName("Vendor.Address.Fields.AddressName")]+ public string Name { get; set; }++ [GrandResourceDisplayName("Vendor.Address.Fields.FirstName")]+ public string FirstName { get; set; }++ [GrandResourceDisplayName("Vendor.Address.Fields.LastName")]+ public string LastName { get; set; }++ [GrandResourceDisplayName("Vendor.Address.Fields.Email")]+ public string Email { get; set; }- [GrandResourceDisplayName("Vendor.Address.Fields.FirstName")]- public string FirstName { get; set; }+ [GrandResourceDisplayName("Vendor.Address.Fields.Company")]- [GrandResourceDisplayName("Vendor.Address.Fields.LastName")]- public string LastName { get; set; }+ public string Company { get; set; }- [GrandResourceDisplayName("Vendor.Address.Fields.Email")]- public string Email { get; set; }+ [GrandResourceDisplayName("Vendor.Address.Fields.VatNumber")]+ public string VatNumber { get; set; }- [GrandResourceDisplayName("Vendor.Address.Fields.Company")]+ [GrandResourceDisplayName("Vendor.Address.Fields.Country")]+ public string CountryId { get; set; }- public string Company { get; set; }+ [GrandResourceDisplayName("Vendor.Address.Fields.Country")]+ public string CountryName { get; set; }- [GrandResourceDisplayName("Vendor.Address.Fields.VatNumber")]- public string VatNumber { get; set; }+ [GrandResourceDisplayName("Vendor.Address.Fields.StateProvince")]+ public string StateProvinceId { get; set; }- [GrandResourceDisplayName("Vendor.Address.Fields.Country")]- public string CountryId { get; set; }+ [GrandResourceDisplayName("Vendor.Address.Fields.StateProvince")]+ public string StateProvinceName { get; set; }- [GrandResourceDisplayName("Vendor.Address.Fields.Country")]- public string CountryName { get; set; }+ [GrandResourceDisplayName("Vendor.Address.Fields.City")]+ public string City { get; set; }- [GrandResourceDisplayName("Vendor.Address.Fields.StateProvince")]- public string StateProvinceId { get; set; }+ [GrandResourceDisplayName("Vendor.Address.Fields.Address1")]+ public string Address1 { get; set; }- [GrandResourceDisplayName("Vendor.Address.Fields.StateProvince")]- public string StateProvinceName { get; set; }+ [GrandResourceDisplayName("Vendor.Address.Fields.Address2")]+ public string Address2 { get; set; }- [GrandResourceDisplayName("Vendor.Address.Fields.City")]- public string City { get; set; }+ [GrandResourceDisplayName("Vendor.Address.Fields.ZipPostalCode")]+ public string ZipPostalCode { get; set; }- [GrandResourceDisplayName("Vendor.Address.Fields.Address1")]- public string Address1 { get; set; }+ [GrandResourceDisplayName("Vendor.Address.Fields.PhoneNumber")]+ public string PhoneNumber { get; set; }- [GrandResourceDisplayName("Vendor.Address.Fields.Address2")]- public string Address2 { get; set; }+ [GrandResourceDisplayName("Vendor.Address.Fields.FaxNumber")]+ public string FaxNumber { get; set; }- [GrandResourceDisplayName("Vendor.Address.Fields.ZipPostalCode")]- public string ZipPostalCode { get; set; }+ [GrandResourceDisplayName("Vendor.Address.Fields.Note")]+ public string Note { get; set; }- [GrandResourceDisplayName("Vendor.Address.Fields.PhoneNumber")]- public string PhoneNumber { get; set; }+ //address in HTML format (usually used in grids)+ [GrandResourceDisplayName("Vendor.Address")]+ public string AddressHtml { get; set; }- [GrandResourceDisplayName("Vendor.Address.Fields.FaxNumber")]- public string FaxNumber { get; set; }+ //formatted custom address attributes+ public string FormattedCustomAddressAttributes { get; set; }+ public IList<AddressAttributeModel> CustomAddressAttributes { get; set; } = new List<AddressAttributeModel>();- [GrandResourceDisplayName("Vendor.Address.Fields.Note")]- public string Note { get; set; }+ [ModelBinder(BinderType = typeof(CustomAttributesBinder))]+ public IList<CustomAttributeModel> SelectedAttributes { get; set; }- //address in HTML format (usually used in grids)- [GrandResourceDisplayName("Vendor.Address")]- public string AddressHtml { get; set; }+ public IList<SelectListItem> AvailableCountries { get; set; } = new List<SelectListItem>();+ public IList<SelectListItem> AvailableStates { get; set; } = new List<SelectListItem>();- //formatted custom address attributes- public string FormattedCustomAddressAttributes { get; set; }- public IList<AddressAttributeModel> CustomAddressAttributes { get; set; } = new List<AddressAttributeModel>();- [ModelBinder(BinderType = typeof(CustomAttributesBinder))]- public IList<CustomAttributeModel> SelectedAttributes { get; set; }-- public IList<SelectListItem> AvailableCountries { get; set; } = new List<SelectListItem>();- public IList<SelectListItem> AvailableStates { get; set; } = new List<SelectListItem>();+ public bool NameEnabled { get; set; }+ public bool FirstNameEnabled { get; set; }+ public bool FirstNameRequired { get; set; }+ public bool LastNameEnabled { get; set; }+ public bool LastNameRequired { get; set; }+ public bool EmailEnabled { get; set; }+ public bool EmailRequired { get; set; }+ public bool CompanyEnabled { get; set; }+ public bool CompanyRequired { get; set; }+ public bool VatNumberEnabled { get; set; }+ public bool VatNumberRequired { get; set; }+ public bool CountryEnabled { get; set; }+ public bool StateProvinceEnabled { get; set; }+ public bool CityEnabled { get; set; }+ public bool CityRequired { get; set; }+ public bool StreetAddressEnabled { get; set; }+ public bool StreetAddressRequired { get; set; }+ public bool StreetAddress2Enabled { get; set; }+ public bool StreetAddress2Required { get; set; }+ public bool ZipPostalCodeEnabled { get; set; }+ public bool ZipPostalCodeRequired { get; set; }+ public bool PhoneEnabled { get; set; }+ public bool PhoneRequired { get; set; }+ public bool FaxEnabled { get; set; }+ public bool FaxRequired { get; set; }+ public bool NoteEnabled { get; set; }+ public bool AddressTypeEnabled { get; set; }- public bool NameEnabled { get; set; }- public bool FirstNameEnabled { get; set; }- public bool FirstNameRequired { get; set; }- public bool LastNameEnabled { get; set; }- public bool LastNameRequired { get; set; }- public bool EmailEnabled { get; set; }- public bool EmailRequired { get; set; }- public bool CompanyEnabled { get; set; }- public bool CompanyRequired { get; set; }- public bool VatNumberEnabled { get; set; }- public bool VatNumberRequired { get; set; }- public bool CountryEnabled { get; set; }- public bool StateProvinceEnabled { get; set; }- public bool CityEnabled { get; set; }- public bool CityRequired { get; set; }- public bool StreetAddressEnabled { get; set; }- public bool StreetAddressRequired { get; set; }- public bool StreetAddress2Enabled { get; set; }- public bool StreetAddress2Required { get; set; }- public bool ZipPostalCodeEnabled { get; set; }- public bool ZipPostalCodeRequired { get; set; }- public bool PhoneEnabled { get; set; }- public bool PhoneRequired { get; set; }- public bool FaxEnabled { get; set; }- public bool FaxRequired { get; set; }- public bool NoteEnabled { get; set; }+ [GrandResourceDisplayName("Address.Fields.AddressType")]+ public AddressType AddressType { get; set; }- public bool AddressTypeEnabled { get; set; }- [GrandResourceDisplayName("Address.Fields.AddressType")]- public AddressType AddressType { get; set; }+ #region Nested classes- #region Nested classes+ public class AddressAttributeModel : BaseEntityModel+ {+ public string Name { get; set; }- public class AddressAttributeModel : BaseEntityModel- {- public string Name { get; set; }+ public bool IsRequired { get; set; }- public bool IsRequired { get; set; }+ /// <summary>+ /// Selected value for textboxes+ /// </summary>+ public string DefaultValue { get; set; }- /// <summary>- /// Selected value for textboxes- /// </summary>- public string DefaultValue { get; set; }+ public AttributeControlType AttributeControlType { get; set; }- public AttributeControlType AttributeControlType { get; set; }+ public IList<AddressAttributeValueModel> Values { get; set; } = new List<AddressAttributeValueModel>();+ }- public IList<AddressAttributeValueModel> Values { get; set; } = new List<AddressAttributeValueModel>();- }+ public class AddressAttributeValueModel : BaseEntityModel+ {+ public string Name { get; set; }- public class AddressAttributeValueModel : BaseEntityModel- {- public string Name { get; set; }-- public bool IsPreSelected { get; set; }- }-- #endregion+ public bool IsPreSelected { get; set; }}++ #endregion}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Common/LoginModel.cs b/src/Web/Grand.Web.Vendor/Models/Common/LoginModel.csindex d92c5ae82..e798cf701 100644--- a/src/Web/Grand.Web.Vendor/Models/Common/LoginModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Common/LoginModel.cs@@ -2,27 +2,27 @@using Grand.Infrastructure.Models;using System.ComponentModel.DataAnnotations;-namespace Grand.Web.Vendor.Models.Common+namespace Grand.Web.Vendor.Models.Common;++public class LoginModel : BaseModel{- public class LoginModel : BaseModel- {- [DataType(DataType.EmailAddress)]- [GrandResourceDisplayName("Account.Login.Fields.Email")]- public string Email { get; set; }-- public bool UsernamesEnabled { get; set; }- [GrandResourceDisplayName("Account.Login.Fields.UserName")]- public string Username { get; set; }-- [DataType(DataType.Password)]- [GrandResourceDisplayName("Account.Login.Fields.Password")]- public string Password { get; set; }-- [GrandResourceDisplayName("Account.Login.Fields.RememberMe")]- public bool RememberMe { get; set; }-- public bool DisplayCaptcha { get; set; }-- public ICaptchaValidModel Captcha { get; set; } = new CaptchaModel();- }+ [DataType(DataType.EmailAddress)]+ [GrandResourceDisplayName("Account.Login.Fields.Email")]+ public string Email { get; set; }++ public bool UsernamesEnabled { get; set; }++ [GrandResourceDisplayName("Account.Login.Fields.UserName")]+ public string Username { get; set; }++ [DataType(DataType.Password)]+ [GrandResourceDisplayName("Account.Login.Fields.Password")]+ public string Password { get; set; }++ [GrandResourceDisplayName("Account.Login.Fields.RememberMe")]+ public bool RememberMe { get; set; }++ public bool DisplayCaptcha { get; set; }++ public ICaptchaValidModel Captcha { get; set; } = new CaptchaModel();}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Common/SearchModel.cs b/src/Web/Grand.Web.Vendor/Models/Common/SearchModel.csindex 59c638cb3..689f1fa82 100644--- a/src/Web/Grand.Web.Vendor/Models/Common/SearchModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Common/SearchModel.cs@@ -1,8 +1,7 @@-namespace Grand.Web.Vendor.Models.Common+namespace Grand.Web.Vendor.Models.Common;++public class SearchModel{- public class SearchModel- {- public string Id { get; set; }- public string Name { get; set; }- }-}+ public string Id { get; set; }+ public string Name { get; set; }+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/MerchandiseReturn/MerchandiseReturnListModel.cs b/src/Web/Grand.Web.Vendor/Models/MerchandiseReturn/MerchandiseReturnListModel.csindex 316fd8d84..ad2e54eb6 100644--- a/src/Web/Grand.Web.Vendor/Models/MerchandiseReturn/MerchandiseReturnListModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/MerchandiseReturn/MerchandiseReturnListModel.cs@@ -3,27 +3,26 @@ using Grand.Infrastructure.Models;using Microsoft.AspNetCore.Mvc.Rendering;using System.ComponentModel.DataAnnotations;-namespace Grand.Web.Vendor.Models.MerchandiseReturn+namespace Grand.Web.Vendor.Models.MerchandiseReturn;++public class MerchandiseReturnListModel : BaseModel{- public class MerchandiseReturnListModel : BaseModel- {- [GrandResourceDisplayName("Admin.Orders.MerchandiseReturns.List.SearchCustomerEmail")]- public string SearchCustomerEmail { get; set; }+ [GrandResourceDisplayName("Admin.Orders.MerchandiseReturns.List.SearchCustomerEmail")]+ public string SearchCustomerEmail { get; set; }- [GrandResourceDisplayName("Admin.Orders.MerchandiseReturns.List.SearchMerchandiseReturnStatus")]- public int SearchMerchandiseReturnStatusId { get; set; }+ [GrandResourceDisplayName("Admin.Orders.MerchandiseReturns.List.SearchMerchandiseReturnStatus")]+ public int SearchMerchandiseReturnStatusId { get; set; }- [GrandResourceDisplayName("Admin.Orders.MerchandiseReturns.List.GoDirectlyToId")]- public int GoDirectlyToId { get; set; }+ [GrandResourceDisplayName("Admin.Orders.MerchandiseReturns.List.GoDirectlyToId")]+ public int GoDirectlyToId { get; set; }- [GrandResourceDisplayName("Admin.Orders.MerchandiseReturns.List.StartDate")]- [UIHint("DateNullable")]- public DateTime? StartDate { get; set; }+ [GrandResourceDisplayName("Admin.Orders.MerchandiseReturns.List.StartDate")]+ [UIHint("DateNullable")]+ public DateTime? StartDate { get; set; }- [GrandResourceDisplayName("Admin.Orders.MerchandiseReturns.List.EndDate")]- [UIHint("DateNullable")]- public DateTime? EndDate { get; set; }+ [GrandResourceDisplayName("Admin.Orders.MerchandiseReturns.List.EndDate")]+ [UIHint("DateNullable")]+ public DateTime? EndDate { get; set; }- public IList<SelectListItem> MerchandiseReturnStatus { get; set; } = new List<SelectListItem>();- }+ public IList<SelectListItem> MerchandiseReturnStatus { get; set; } = new List<SelectListItem>();}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/MerchandiseReturn/MerchandiseReturnModel.cs b/src/Web/Grand.Web.Vendor/Models/MerchandiseReturn/MerchandiseReturnModel.csindex 20d0b20a5..74e93d358 100644--- a/src/Web/Grand.Web.Vendor/Models/MerchandiseReturn/MerchandiseReturnModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/MerchandiseReturn/MerchandiseReturnModel.cs@@ -2,94 +2,101 @@using Grand.Infrastructure.Models;using Grand.Web.Vendor.Models.Common;-namespace Grand.Web.Vendor.Models.MerchandiseReturn+namespace Grand.Web.Vendor.Models.MerchandiseReturn;++public class MerchandiseReturnModel : BaseEntityModel{- public class MerchandiseReturnModel : BaseEntityModel- {- [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.ID")]- public override string Id { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.ID")]+ public override string Id { get; set; }- [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.ID")]- public int ReturnNumber { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.ID")]+ public int ReturnNumber { get; set; }- [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.Order")]- public string OrderId { get; set; }- public int OrderNumber { get; set; }- public string OrderCode { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.Order")]+ public string OrderId { get; set; }- [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.ExternalId")]- public string ExternalId { get; set; }+ public int OrderNumber { get; set; }+ public string OrderCode { get; set; }- [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.Customer")]- public string CustomerId { get; set; }- [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.Customer")]- public string CustomerInfo { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.ExternalId")]+ public string ExternalId { get; set; }- [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.Total")]- public string Total { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.Customer")]+ public string CustomerId { get; set; }- [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.CustomerComments")]- public string CustomerComments { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.Customer")]+ public string CustomerInfo { get; set; }- [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.StaffNotes")]- public string StaffNotes { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.Total")]+ public string Total { get; set; }- [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.Status")]- public int MerchandiseReturnStatusId { get; set; }- [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.Status")]- public string MerchandiseReturnStatusStr { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.CustomerComments")]+ public string CustomerComments { get; set; }- [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.CreatedOn")]- public DateTime CreatedOn { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.StaffNotes")]+ public string StaffNotes { get; set; }- [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.Quantity")]- public int Quantity { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.Status")]+ public int MerchandiseReturnStatusId { get; set; }- [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.PickupDate")]- public DateTime PickupDate { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.Status")]+ public string MerchandiseReturnStatusStr { get; set; }- [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.PickupAddress")]- public AddressModel PickupAddress { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.CreatedOn")]+ public DateTime CreatedOn { get; set; }- public List<MerchandiseReturnItemModel> Items { get; set; } = new();+ [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.Quantity")]+ public int Quantity { get; set; }- [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.NotifyCustomer")]- public bool NotifyCustomer { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.PickupDate")]+ public DateTime PickupDate { get; set; }- //merchandise return notes- [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.MerchandiseReturnNotes.Fields.DisplayToCustomer")]- public bool AddMerchandiseReturnNoteDisplayToCustomer { get; set; }- [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.MerchandiseReturnNotes.Fields.Note")]- public string AddMerchandiseReturnNoteMessage { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.Fields.PickupAddress")]+ public AddressModel PickupAddress { get; set; }- public class MerchandiseReturnItemModel : BaseEntityModel- {- public string ProductId { get; set; }+ public List<MerchandiseReturnItemModel> Items { get; set; } = new();- public string ProductName { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.NotifyCustomer")]+ public bool NotifyCustomer { get; set; }- public string ProductSku { get; set; }+ //merchandise return notes+ [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.MerchandiseReturnNotes.Fields.DisplayToCustomer")]+ public bool AddMerchandiseReturnNoteDisplayToCustomer { get; set; }- public string UnitPrice { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.MerchandiseReturnNotes.Fields.Note")]+ public string AddMerchandiseReturnNoteMessage { get; set; }- public int Quantity { get; set; }+ public class MerchandiseReturnItemModel : BaseEntityModel+ {+ public string ProductId { get; set; }++ public string ProductName { get; set; }++ public string ProductSku { get; set; }- public string ReasonForReturn { get; set; }+ public string UnitPrice { get; set; }++ public int Quantity { get; set; }- public string RequestedAction { get; set; }- }+ public string ReasonForReturn { get; set; }++ public string RequestedAction { get; set; }+ }++ public class MerchandiseReturnNote : BaseEntityModel+ {+ public string MerchandiseReturnId { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.MerchandiseReturnNotes.Fields.DisplayToCustomer")]+ public bool DisplayToCustomer { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.MerchandiseReturnNotes.Fields.Note")]+ public string Note { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.MerchandiseReturnNotes.Fields.CreatedOn")]+ public DateTime CreatedOn { get; set; }- public class MerchandiseReturnNote : BaseEntityModel- {- public string MerchandiseReturnId { get; set; }- [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.MerchandiseReturnNotes.Fields.DisplayToCustomer")]- public bool DisplayToCustomer { get; set; }- [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.MerchandiseReturnNotes.Fields.Note")]- public string Note { get; set; }- [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.MerchandiseReturnNotes.Fields.CreatedOn")]- public DateTime CreatedOn { get; set; }- [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.MerchandiseReturnNotes.Fields.CreatedByCustomer")]- public bool CreatedByCustomer { get; set; }- }+ [GrandResourceDisplayName("Vendor.Orders.MerchandiseReturns.MerchandiseReturnNotes.Fields.CreatedByCustomer")]+ public bool CreatedByCustomer { get; set; }}}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Orders/OrderListModel.cs b/src/Web/Grand.Web.Vendor/Models/Orders/OrderListModel.csindex d1ee5c2d4..e0c1b74ce 100644--- a/src/Web/Grand.Web.Vendor/Models/Orders/OrderListModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Orders/OrderListModel.cs@@ -3,65 +3,64 @@ using Grand.Infrastructure.Models;using Microsoft.AspNetCore.Mvc.Rendering;using System.ComponentModel.DataAnnotations;-namespace Grand.Web.Vendor.Models.Orders+namespace Grand.Web.Vendor.Models.Orders;++public class OrderListModel : BaseModel{- public class OrderListModel : BaseModel- {- [GrandResourceDisplayName("Vendor.Orders.List.StartDate")]- [UIHint("DateNullable")]- public DateTime? StartDate { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.List.StartDate")]+ [UIHint("DateNullable")]+ public DateTime? StartDate { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.List.EndDate")]+ [UIHint("DateNullable")]+ public DateTime? EndDate { get; set; }++ public string CustomerId { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.List.BillingEmail")]+ public string BillingEmail { get; set; }- [GrandResourceDisplayName("Vendor.Orders.List.EndDate")]- [UIHint("DateNullable")]- public DateTime? EndDate { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.List.BillingLastName")]+ public string BillingLastName { get; set; }- public string CustomerId { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.List.OrderStatus")]+ public int OrderStatusId { get; set; }- [GrandResourceDisplayName("Vendor.Orders.List.BillingEmail")]- public string BillingEmail { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.List.PaymentStatus")]+ public int PaymentStatusId { get; set; }- [GrandResourceDisplayName("Vendor.Orders.List.BillingLastName")]- public string BillingLastName { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.List.ShippingStatus")]+ public int ShippingStatusId { get; set; }- [GrandResourceDisplayName("Vendor.Orders.List.OrderStatus")]- public int OrderStatusId { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.List.PaymentMethod")]+ public string PaymentMethodSystemName { get; set; }- [GrandResourceDisplayName("Vendor.Orders.List.PaymentStatus")]- public int PaymentStatusId { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.List.Warehouse")]+ public string WarehouseId { get; set; }- [GrandResourceDisplayName("Vendor.Orders.List.ShippingStatus")]- public int ShippingStatusId { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.List.Product")]+ public string ProductId { get; set; }- [GrandResourceDisplayName("Vendor.Orders.List.PaymentMethod")]- public string PaymentMethodSystemName { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.List.BillingCountry")]+ public string BillingCountryId { get; set; }- [GrandResourceDisplayName("Vendor.Orders.List.Warehouse")]- public string WarehouseId { get; set; }- [GrandResourceDisplayName("Vendor.Orders.List.Product")]- public string ProductId { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.List.OrderGuid")]- [GrandResourceDisplayName("Vendor.Orders.List.BillingCountry")]- public string BillingCountryId { get; set; }-+ public string OrderGuid { get; set; }- [GrandResourceDisplayName("Vendor.Orders.List.OrderGuid")]-- public string OrderGuid { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.List.GoDirectlyToNumber")]- [GrandResourceDisplayName("Vendor.Orders.List.GoDirectlyToNumber")]-- public string GoDirectlyToNumber { get; set; }+ public string GoDirectlyToNumber { get; set; }- [GrandResourceDisplayName("Vendor.Orders.List.OrderTagId")]- public string OrderTag { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.List.OrderTagId")]+ public string OrderTag { get; set; }- public IList<SelectListItem> AvailableOrderStatuses { get; set; } = new List<SelectListItem>();- public IList<SelectListItem> AvailablePaymentStatuses { get; set; } = new List<SelectListItem>();- public IList<SelectListItem> AvailableShippingStatuses { get; set; } = new List<SelectListItem>();- public IList<SelectListItem> AvailableWarehouses { get; set; } = new List<SelectListItem>();- public IList<SelectListItem> AvailablePaymentMethods { get; set; } = new List<SelectListItem>();- public IList<SelectListItem> AvailableCountries { get; set; } = new List<SelectListItem>();- public IList<SelectListItem> AvailableOrderTags { get; set; } = new List<SelectListItem>();- }+ public IList<SelectListItem> AvailableOrderStatuses { get; set; } = new List<SelectListItem>();+ public IList<SelectListItem> AvailablePaymentStatuses { get; set; } = new List<SelectListItem>();+ public IList<SelectListItem> AvailableShippingStatuses { get; set; } = new List<SelectListItem>();+ public IList<SelectListItem> AvailableWarehouses { get; set; } = new List<SelectListItem>();+ public IList<SelectListItem> AvailablePaymentMethods { get; set; } = new List<SelectListItem>();+ public IList<SelectListItem> AvailableCountries { get; set; } = new List<SelectListItem>();+ public IList<SelectListItem> AvailableOrderTags { get; set; } = new List<SelectListItem>();}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Orders/OrderModel.cs b/src/Web/Grand.Web.Vendor/Models/Orders/OrderModel.csindex 1471e9f17..c222e756f 100644--- a/src/Web/Grand.Web.Vendor/Models/Orders/OrderModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Orders/OrderModel.cs@@ -6,134 +6,144 @@ using Grand.Infrastructure.Models;using Grand.Web.Vendor.Models.Common;using System.ComponentModel.DataAnnotations;-namespace Grand.Web.Vendor.Models.Orders+namespace Grand.Web.Vendor.Models.Orders;++public class OrderModel : BaseEntityModel{- public class OrderModel : BaseEntityModel+ //identifiers+ [GrandResourceDisplayName("Vendor.Orders.Fields.ID")]+ public override string Id { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Fields.ID")]+ public int OrderNumber { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Fields.Code")]+ public string Code { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Fields.OrderGuid")]+ public Guid OrderGuid { get; set; }++ //store+ [GrandResourceDisplayName("Vendor.Orders.Fields.Store")]+ public string StoreName { get; set; }++ //customer info+ [GrandResourceDisplayName("Vendor.Orders.Fields.Customer")]+ public string CustomerInfo { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Fields.CustomerEmail")]+ public string CustomerEmail { get; set; }++ public string CustomerFullName { get; set; }++ //order status+ [GrandResourceDisplayName("Admin.Orders.Fields.OrderStatus")]+ public string OrderStatus { get; set; }++ public int OrderStatusId { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Fields.Currency")]+ public string CurrencyCode { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Fields.CurrencyRate")]+ [UIHint("DoubleN4")]+ public double CurrencyRate { get; set; }++ public TaxDisplayType TaxDisplayType { get; set; }++ //payment info+ [GrandResourceDisplayName("Vendor.Orders.Fields.PaymentStatus")]+ public string PaymentStatus { get; set; }++ public PaymentStatus PaymentStatusEnum { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Fields.PaymentMethod")]+ public string PaymentMethod { get; set; }++ //shipping info+ public bool IsShippable { get; set; }+ public bool PickUpInStore { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Fields.PickupAddress")]+ public AddressModel PickupAddress { get; set; }+++ [GrandResourceDisplayName("Vendor.Orders.Fields.ShippingAddress")]+ public AddressModel ShippingAddress { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Fields.ShippingMethod")]+ public string ShippingMethod { get; set; }++ public string ShippingAdditionDescription { get; set; }+ public string ShippingAddressGoogleMapsUrl { get; set; }+ public bool CanAddNewShipments { get; set; }++ //billing info+ [GrandResourceDisplayName("Vendor.Orders.Fields.BillingAddress")]+ public AddressModel BillingAddress { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Fields.VatNumber")]+ public string VatNumber { get; set; }++ //items+ public bool HasDownloadableProducts { get; set; }+ public IList<OrderItemModel> Items { get; set; } = new List<OrderItemModel>();++ //creation date+ [GrandResourceDisplayName("Vendor.Orders.Fields.CreatedOn")]+ public DateTime CreatedOn { get; set; }++ //checkout attributes+ public string CheckoutAttributeInfo { get; set; }+++ #region Nested Classes++ public class OrderItemModel : BaseEntityModel{- //identifiers- [GrandResourceDisplayName("Vendor.Orders.Fields.ID")]- public override string Id { get; set; }-- [GrandResourceDisplayName("Vendor.Orders.Fields.ID")]- public int OrderNumber { get; set; }- [GrandResourceDisplayName("Vendor.Orders.Fields.Code")]- public string Code { get; set; }-- [GrandResourceDisplayName("Vendor.Orders.Fields.OrderGuid")]- public Guid OrderGuid { get; set; }-- //store- [GrandResourceDisplayName("Vendor.Orders.Fields.Store")]- public string StoreName { get; set; }-- //customer info- [GrandResourceDisplayName("Vendor.Orders.Fields.Customer")]- public string CustomerInfo { get; set; }- [GrandResourceDisplayName("Vendor.Orders.Fields.CustomerEmail")]- public string CustomerEmail { get; set; }- public string CustomerFullName { get; set; }-- //order status- [GrandResourceDisplayName("Admin.Orders.Fields.OrderStatus")]- public string OrderStatus { get; set; }- public int OrderStatusId { get; set; }- [GrandResourceDisplayName("Vendor.Orders.Fields.Currency")]- public string CurrencyCode { get; set; }- [GrandResourceDisplayName("Vendor.Orders.Fields.CurrencyRate")]-- [UIHint("DoubleN4")]- public double CurrencyRate { get; set; }- public TaxDisplayType TaxDisplayType { get; set; }- //payment info- [GrandResourceDisplayName("Vendor.Orders.Fields.PaymentStatus")]- public string PaymentStatus { get; set; }- public PaymentStatus PaymentStatusEnum { get; set; }- [GrandResourceDisplayName("Vendor.Orders.Fields.PaymentMethod")]- public string PaymentMethod { get; set; }-- //shipping info- public bool IsShippable { get; set; }- public bool PickUpInStore { get; set; }-- [GrandResourceDisplayName("Vendor.Orders.Fields.PickupAddress")]- public AddressModel PickupAddress { get; set; }--- [GrandResourceDisplayName("Vendor.Orders.Fields.ShippingAddress")]- public AddressModel ShippingAddress { get; set; }- [GrandResourceDisplayName("Vendor.Orders.Fields.ShippingMethod")]- public string ShippingMethod { get; set; }- public string ShippingAdditionDescription { get; set; }- public string ShippingAddressGoogleMapsUrl { get; set; }- public bool CanAddNewShipments { get; set; }-- //billing info- [GrandResourceDisplayName("Vendor.Orders.Fields.BillingAddress")]- public AddressModel BillingAddress { get; set; }- [GrandResourceDisplayName("Vendor.Orders.Fields.VatNumber")]- public string VatNumber { get; set; }-- //items- public bool HasDownloadableProducts { get; set; }- public IList<OrderItemModel> Items { get; set; } = new List<OrderItemModel>();-- //creation date- [GrandResourceDisplayName("Vendor.Orders.Fields.CreatedOn")]- public DateTime CreatedOn { get; set; }-- //checkout attributes- public string CheckoutAttributeInfo { get; set; }---- #region Nested Classes-- public class OrderItemModel : BaseEntityModel- {- public string ProductId { get; set; }- public string ProductName { get; set; }- public string VendorName { get; set; }- public string Sku { get; set; }-- public string PictureThumbnailUrl { get; set; }-- public string UnitPriceInclTax { get; set; }- public string UnitPriceExclTax { get; set; }- public double UnitPriceInclTaxValue { get; set; }- public double UnitPriceExclTaxValue { get; set; }-- public int Quantity { get; set; }- public int OpenQty { get; set; }- public int CancelQty { get; set; }- public int ShipQty { get; set; }- public int ReturnQty { get; set; }-- public string DiscountInclTax { get; set; }- public string DiscountExclTax { get; set; }- public double DiscountInclTaxValue { get; set; }- public double DiscountExclTaxValue { get; set; }-- public string SubTotalInclTax { get; set; }- public string SubTotalExclTax { get; set; }- public double SubTotalInclTaxValue { get; set; }- public double SubTotalExclTaxValue { get; set; }-- public string AttributeInfo { get; set; }- public string RecurringInfo { get; set; }-- public IList<string> MerchandiseReturnIds { get; set; } = new List<string>();- public IList<string> PurchasedGiftVoucherIds { get; set; } = new List<string>();-- public bool IsDownload { get; set; }- public int DownloadCount { get; set; }- public DownloadActivationType DownloadActivationType { get; set; }- public bool IsDownloadActivated { get; set; }- public Guid LicenseDownloadGuid { get; set; }-- public string Commission { get; set; }- public double CommissionValue { get; set; }- }-- #endregion+ public string ProductId { get; set; }+ public string ProductName { get; set; }+ public string VendorName { get; set; }+ public string Sku { get; set; }++ public string PictureThumbnailUrl { get; set; }++ public string UnitPriceInclTax { get; set; }+ public string UnitPriceExclTax { get; set; }+ public double UnitPriceInclTaxValue { get; set; }+ public double UnitPriceExclTaxValue { get; set; }++ public int Quantity { get; set; }+ public int OpenQty { get; set; }+ public int CancelQty { get; set; }+ public int ShipQty { get; set; }+ public int ReturnQty { get; set; }++ public string DiscountInclTax { get; set; }+ public string DiscountExclTax { get; set; }+ public double DiscountInclTaxValue { get; set; }+ public double DiscountExclTaxValue { get; set; }++ public string SubTotalInclTax { get; set; }+ public string SubTotalExclTax { get; set; }+ public double SubTotalInclTaxValue { get; set; }+ public double SubTotalExclTaxValue { get; set; }++ public string AttributeInfo { get; set; }+ public string RecurringInfo { get; set; }++ public IList<string> MerchandiseReturnIds { get; set; } = new List<string>();+ public IList<string> PurchasedGiftVoucherIds { get; set; } = new List<string>();++ public bool IsDownload { get; set; }+ public int DownloadCount { get; set; }+ public DownloadActivationType DownloadActivationType { get; set; }+ public bool IsDownloadActivated { get; set; }+ public Guid LicenseDownloadGuid { get; set; }++ public string Commission { get; set; }+ public double CommissionValue { get; set; }}-}++ #endregion+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Report/BestCustomerReportLineModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/BestCustomerReportLineModel.csindex 54720cb5d..e54b20ecd 100644--- a/src/Web/Grand.Web.Vendor/Models/Report/BestCustomerReportLineModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Report/BestCustomerReportLineModel.cs@@ -1,18 +1,18 @@using Grand.Infrastructure.ModelBinding;using Grand.Infrastructure.Models;-namespace Grand.Web.Vendor.Models.Report+namespace Grand.Web.Vendor.Models.Report;++public class BestCustomerReportLineModel : BaseModel{- public class BestCustomerReportLineModel : BaseModel- {- public string CustomerId { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Customers.BestBy.Fields.Customer")]- public string CustomerName { get; set; }+ public string CustomerId { get; set; }++ [GrandResourceDisplayName("Vendor.Reports.Customers.BestBy.Fields.Customer")]+ public string CustomerName { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Customers.BestBy.Fields.OrderTotal")]- public string OrderTotal { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Customers.BestBy.Fields.OrderTotal")]+ public string OrderTotal { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Customers.BestBy.Fields.OrderCount")]- public double OrderCount { get; set; }- }+ [GrandResourceDisplayName("Vendor.Reports.Customers.BestBy.Fields.OrderCount")]+ public double OrderCount { get; set; }}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Report/BestCustomersReportModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/BestCustomersReportModel.csindex 39ba65f2d..883b52633 100644--- a/src/Web/Grand.Web.Vendor/Models/Report/BestCustomersReportModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Report/BestCustomersReportModel.cs@@ -3,21 +3,20 @@ using Grand.Infrastructure.Models;using Microsoft.AspNetCore.Mvc.Rendering;using System.ComponentModel.DataAnnotations;-namespace Grand.Web.Vendor.Models.Report+namespace Grand.Web.Vendor.Models.Report;++public class BestCustomersReportModel : BaseModel{- public class BestCustomersReportModel : BaseModel- {- [GrandResourceDisplayName("Vendor.Reports.Customer.BestBy.StartDate")]- [UIHint("DateNullable")]- public DateTime? StartDate { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Customer.BestBy.StartDate")]+ [UIHint("DateNullable")]+ public DateTime? StartDate { get; set; }++ [GrandResourceDisplayName("Vendor.Reports.Customer.BestBy.EndDate")]+ [UIHint("DateNullable")]+ public DateTime? EndDate { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Customer.BestBy.EndDate")]- [UIHint("DateNullable")]- public DateTime? EndDate { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Customer.BestBy.PaymentStatus")]+ public int PaymentStatusId { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Customer.BestBy.PaymentStatus")]- public int PaymentStatusId { get; set; }-- public IList<SelectListItem> AvailablePaymentStatuses { get; set; } = new List<SelectListItem>();- }+ public IList<SelectListItem> AvailablePaymentStatuses { get; set; } = new List<SelectListItem>();}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Report/BestsellersReportLineModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/BestsellersReportLineModel.csindex e6b57a2bc..fdafce6fa 100644--- a/src/Web/Grand.Web.Vendor/Models/Report/BestsellersReportLineModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Report/BestsellersReportLineModel.cs@@ -1,18 +1,18 @@using Grand.Infrastructure.ModelBinding;using Grand.Infrastructure.Models;-namespace Grand.Web.Vendor.Models.Report+namespace Grand.Web.Vendor.Models.Report;++public class BestsellersReportLineModel : BaseModel{- public class BestsellersReportLineModel : BaseModel- {- public string ProductId { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Bestsellers.Fields.Name")]- public string ProductName { get; set; }+ public string ProductId { get; set; }++ [GrandResourceDisplayName("Vendor.Reports.Bestsellers.Fields.Name")]+ public string ProductName { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Bestsellers.Fields.TotalAmount")]- public string TotalAmount { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Bestsellers.Fields.TotalAmount")]+ public string TotalAmount { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Bestsellers.Fields.TotalQuantity")]- public double TotalQuantity { get; set; }- }+ [GrandResourceDisplayName("Vendor.Reports.Bestsellers.Fields.TotalQuantity")]+ public double TotalQuantity { get; set; }}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Report/BestsellersReportModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/BestsellersReportModel.csindex fd98e5d93..a844f8352 100644--- a/src/Web/Grand.Web.Vendor/Models/Report/BestsellersReportModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Report/BestsellersReportModel.cs@@ -3,27 +3,27 @@ using Grand.Infrastructure.Models;using Microsoft.AspNetCore.Mvc.Rendering;using System.ComponentModel.DataAnnotations;-namespace Grand.Web.Vendor.Models.Report+namespace Grand.Web.Vendor.Models.Report;++public class BestsellersReportModel : BaseModel{- public class BestsellersReportModel : BaseModel- {- [GrandResourceDisplayName("Vendor.Reports.Bestsellers.Store")]- public string StoreId { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Bestsellers.Store")]+ public string StoreId { get; set; }++ [GrandResourceDisplayName("Vendor.Reports.Bestsellers.StartDate")]+ [UIHint("DateNullable")]+ public DateTime? StartDate { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Bestsellers.StartDate")]- [UIHint("DateNullable")]- public DateTime? StartDate { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Bestsellers.EndDate")]+ [UIHint("DateNullable")]+ public DateTime? EndDate { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Bestsellers.EndDate")]- [UIHint("DateNullable")]- public DateTime? EndDate { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Bestsellers.PaymentStatus")]+ public int PaymentStatusId { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Bestsellers.PaymentStatus")]- public int PaymentStatusId { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Bestsellers.BillingCountry")]- public string BillingCountryId { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Bestsellers.BillingCountry")]+ public string BillingCountryId { get; set; }- public IList<SelectListItem> AvailablePaymentStatuses { get; set; } = new List<SelectListItem>();- public IList<SelectListItem> AvailableCountries { get; set; } = new List<SelectListItem>();- }+ public IList<SelectListItem> AvailablePaymentStatuses { get; set; } = new List<SelectListItem>();+ public IList<SelectListItem> AvailableCountries { get; set; } = new List<SelectListItem>();}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Report/CountryReportLineModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/CountryReportLineModel.csindex 7047d9313..4f7c58db4 100644--- a/src/Web/Grand.Web.Vendor/Models/Report/CountryReportLineModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Report/CountryReportLineModel.cs@@ -1,17 +1,16 @@using Grand.Infrastructure.ModelBinding;using Grand.Infrastructure.Models;-namespace Grand.Web.Vendor.Models.Report+namespace Grand.Web.Vendor.Models.Report;++public class CountryReportLineModel : BaseModel{- public class CountryReportLineModel : BaseModel- {- [GrandResourceDisplayName("Vendor.Reports.Country.Fields.CountryName")]- public string CountryName { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Country.Fields.CountryName")]+ public string CountryName { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Country.Fields.TotalOrders")]- public int TotalOrders { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Country.Fields.TotalOrders")]+ public int TotalOrders { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Country.Fields.SumOrders")]- public string SumOrders { get; set; }- }+ [GrandResourceDisplayName("Vendor.Reports.Country.Fields.SumOrders")]+ public string SumOrders { get; set; }}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Report/CountryReportModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/CountryReportModel.csindex 8ab90dacb..94deed08f 100644--- a/src/Web/Grand.Web.Vendor/Models/Report/CountryReportModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Report/CountryReportModel.cs@@ -3,20 +3,20 @@ using Grand.Infrastructure.Models;using Microsoft.AspNetCore.Mvc.Rendering;using System.ComponentModel.DataAnnotations;-namespace Grand.Web.Vendor.Models.Report+namespace Grand.Web.Vendor.Models.Report;++public class CountryReportModel : BaseModel{- public class CountryReportModel : BaseModel- {- [GrandResourceDisplayName("Vendor.Reports.Country.StartDate")]- [UIHint("DateNullable")]- public DateTime? StartDate { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Country.StartDate")]+ [UIHint("DateNullable")]+ public DateTime? StartDate { get; set; }++ [GrandResourceDisplayName("Vendor.Reports.Country.EndDate")]+ [UIHint("DateNullable")]+ public DateTime? EndDate { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Country.EndDate")]- [UIHint("DateNullable")]- public DateTime? EndDate { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Country.PaymentStatus")]+ public int PaymentStatusId { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Country.PaymentStatus")]- public int PaymentStatusId { get; set; }- public IList<SelectListItem> AvailablePaymentStatuses { get; set; } = new List<SelectListItem>();- }+ public IList<SelectListItem> AvailablePaymentStatuses { get; set; } = new List<SelectListItem>();}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Report/CustomerReportsModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/CustomerReportsModel.csindex 45ae4e6cd..bdea6ab9f 100644--- a/src/Web/Grand.Web.Vendor/Models/Report/CustomerReportsModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Report/CustomerReportsModel.cs@@ -3,21 +3,20 @@ using Grand.Infrastructure.Models;using Microsoft.AspNetCore.Mvc.Rendering;using System.ComponentModel.DataAnnotations;-namespace Grand.Web.Vendor.Models.Report+namespace Grand.Web.Vendor.Models.Report;++public class CustomerReportsModel : BaseModel{- public class CustomerReportsModel : BaseModel- {- [GrandResourceDisplayName("Vendor.Reports.Customer.BestBy.StartDate")]- [UIHint("DateNullable")]- public DateTime? StartDate { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Customer.BestBy.StartDate")]+ [UIHint("DateNullable")]+ public DateTime? StartDate { get; set; }++ [GrandResourceDisplayName("Vendor.Reports.Customer.BestBy.EndDate")]+ [UIHint("DateNullable")]+ public DateTime? EndDate { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Customer.BestBy.EndDate")]- [UIHint("DateNullable")]- public DateTime? EndDate { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Customer.BestBy.PaymentStatus")]+ public int PaymentStatusId { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Customer.BestBy.PaymentStatus")]- public int PaymentStatusId { get; set; }-- public IList<SelectListItem> AvailablePaymentStatuses { get; set; } = new List<SelectListItem>();- }+ public IList<SelectListItem> AvailablePaymentStatuses { get; set; } = new List<SelectListItem>();}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Report/LowStockProductModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/LowStockProductModel.csindex cc15ba250..450118c8b 100644--- a/src/Web/Grand.Web.Vendor/Models/Report/LowStockProductModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Report/LowStockProductModel.cs@@ -1,22 +1,21 @@using Grand.Infrastructure.ModelBinding;using Grand.Infrastructure.Models;-namespace Grand.Web.Vendor.Models.Report+namespace Grand.Web.Vendor.Models.Report;++public class LowStockProductModel : BaseEntityModel{- public class LowStockProductModel : BaseEntityModel- {- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Name")]- public string Name { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Name")]+ public string Name { get; set; }- public string Attributes { get; set; }+ public string Attributes { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ManageInventoryMethod")]- public string ManageInventoryMethod { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ManageInventoryMethod")]+ public string ManageInventoryMethod { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.StockQuantity")]- public int StockQuantity { get; set; }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.StockQuantity")]+ public int StockQuantity { get; set; }- [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Published")]- public bool Published { get; set; }- }+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Published")]+ public bool Published { get; set; }}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Report/NeverSoldReportLineModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/NeverSoldReportLineModel.csindex fb27de842..10b87ce77 100644--- a/src/Web/Grand.Web.Vendor/Models/Report/NeverSoldReportLineModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Report/NeverSoldReportLineModel.cs@@ -1,13 +1,12 @@using Grand.Infrastructure.ModelBinding;using Grand.Infrastructure.Models;-namespace Grand.Web.Vendor.Models.Report+namespace Grand.Web.Vendor.Models.Report;++public class NeverSoldReportLineModel : BaseModel{- public class NeverSoldReportLineModel : BaseModel- {- public string ProductId { get; set; }-- [GrandResourceDisplayName("Vendor.Reports.NeverSold.Fields.Name")]- public string ProductName { get; set; }- }+ public string ProductId { get; set; }++ [GrandResourceDisplayName("Vendor.Reports.NeverSold.Fields.Name")]+ public string ProductName { get; set; }}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Report/NeverSoldReportModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/NeverSoldReportModel.csindex bd33a68b1..d61ed979c 100644--- a/src/Web/Grand.Web.Vendor/Models/Report/NeverSoldReportModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Report/NeverSoldReportModel.cs@@ -2,16 +2,15 @@using Grand.Infrastructure.Models;using System.ComponentModel.DataAnnotations;-namespace Grand.Web.Vendor.Models.Report+namespace Grand.Web.Vendor.Models.Report;++public class NeverSoldReportModel : BaseModel{- public class NeverSoldReportModel : BaseModel- {- [GrandResourceDisplayName("Vendor.Reports.NeverSold.StartDate")]- [UIHint("DateNullable")]- public DateTime? StartDate { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.NeverSold.StartDate")]+ [UIHint("DateNullable")]+ public DateTime? StartDate { get; set; }- [GrandResourceDisplayName("Vendor.Reports.NeverSold.EndDate")]- [UIHint("DateNullable")]- public DateTime? EndDate { get; set; }- }+ [GrandResourceDisplayName("Vendor.Reports.NeverSold.EndDate")]+ [UIHint("DateNullable")]+ public DateTime? EndDate { get; set; }}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Report/OrderAverageReportLineSummaryModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/OrderAverageReportLineSummaryModel.csindex 43fd03189..0cc738515 100644--- a/src/Web/Grand.Web.Vendor/Models/Report/OrderAverageReportLineSummaryModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Report/OrderAverageReportLineSummaryModel.cs@@ -1,23 +1,22 @@using Grand.Infrastructure.ModelBinding;using Grand.Infrastructure.Models;-namespace Grand.Web.Vendor.Models.Report+namespace Grand.Web.Vendor.Models.Report;++public class OrderAverageReportLineSummaryModel : BaseModel{- public class OrderAverageReportLineSummaryModel : BaseModel- {- [GrandResourceDisplayName("Vendor.Reports.Average.SumTodayOrders")]- public string SumTodayOrders { get; set; }-- [GrandResourceDisplayName("Vendor.Reports.Average.SumThisWeekOrders")]- public string SumThisWeekOrders { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Average.SumTodayOrders")]+ public string SumTodayOrders { get; set; }++ [GrandResourceDisplayName("Vendor.Reports.Average.SumThisWeekOrders")]+ public string SumThisWeekOrders { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Average.SumThisMonthOrders")]- public string SumThisMonthOrders { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Average.SumThisMonthOrders")]+ public string SumThisMonthOrders { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Average.SumThisYearOrders")]- public string SumThisYearOrders { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Average.SumThisYearOrders")]+ public string SumThisYearOrders { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Average.SumAllTimeOrders")]- public string SumAllTimeOrders { get; set; }- }-}+ [GrandResourceDisplayName("Vendor.Reports.Average.SumAllTimeOrders")]+ public string SumAllTimeOrders { get; set; }+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Report/OrderIncompleteReportLineModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/OrderIncompleteReportLineModel.csindex 68bf8b952..e6e6cf176 100644--- a/src/Web/Grand.Web.Vendor/Models/Report/OrderIncompleteReportLineModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Report/OrderIncompleteReportLineModel.cs@@ -1,20 +1,19 @@using Grand.Infrastructure.ModelBinding;using Grand.Infrastructure.Models;-namespace Grand.Web.Vendor.Models.Report+namespace Grand.Web.Vendor.Models.Report;++public class OrderIncompleteReportLineModel : BaseModel{- public class OrderIncompleteReportLineModel : BaseModel- {- [GrandResourceDisplayName("Vendor.Reports.Incomplete.Item")]- public string Item { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Incomplete.Item")]+ public string Item { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Incomplete.Total")]- public string Total { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Incomplete.Total")]+ public string Total { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Incomplete.Count")]- public int Count { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Incomplete.Count")]+ public int Count { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Incomplete.View")]- public string ViewLink { get; set; }- }-}+ [GrandResourceDisplayName("Vendor.Reports.Incomplete.View")]+ public string ViewLink { get; set; }+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Report/OrderPeriodReportLineModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/OrderPeriodReportLineModel.csindex bd0789ceb..d918288d3 100644--- a/src/Web/Grand.Web.Vendor/Models/Report/OrderPeriodReportLineModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Report/OrderPeriodReportLineModel.cs@@ -1,19 +1,16 @@using Grand.Infrastructure.ModelBinding;using Grand.Infrastructure.Models;+namespace Grand.Web.Vendor.Models.Report;-namespace Grand.Web.Vendor.Models.Report+public class OrderPeriodReportLineModel : BaseModel{- public class OrderPeriodReportLineModel : BaseModel- {- [GrandResourceDisplayName("Vendor.Reports.Period.Name")]- public string Period { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Period.Name")]+ public string Period { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Period.Count")]- public int Count { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Period.Count")]+ public int Count { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Period.Amount")]- public double Amount { get; set; }-- }+ [GrandResourceDisplayName("Vendor.Reports.Period.Amount")]+ public double Amount { get; set; }}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Report/RegisteredCustomerReportLineModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/RegisteredCustomerReportLineModel.csindex c093e5799..973cbf057 100644--- a/src/Web/Grand.Web.Vendor/Models/Report/RegisteredCustomerReportLineModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Report/RegisteredCustomerReportLineModel.cs@@ -1,14 +1,13 @@using Grand.Infrastructure.ModelBinding;using Grand.Infrastructure.Models;-namespace Grand.Web.Vendor.Models.Report+namespace Grand.Web.Vendor.Models.Report;++public class RegisteredCustomerReportLineModel : BaseModel{- public class RegisteredCustomerReportLineModel : BaseModel- {- [GrandResourceDisplayName("Vendor.Reports.Customers.RegisteredCustomers.Fields.Period")]- public string Period { get; set; }+ [GrandResourceDisplayName("Vendor.Reports.Customers.RegisteredCustomers.Fields.Period")]+ public string Period { get; set; }- [GrandResourceDisplayName("Vendor.Reports.Customers.RegisteredCustomers.Fields.Customers")]- public int Customers { get; set; }- }+ [GrandResourceDisplayName("Vendor.Reports.Customers.RegisteredCustomers.Fields.Customers")]+ public int Customers { get; set; }}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Shipment/AddShipmentModel.cs b/src/Web/Grand.Web.Vendor/Models/Shipment/AddShipmentModel.csindex e4988f7c4..06e969bb1 100644--- a/src/Web/Grand.Web.Vendor/Models/Shipment/AddShipmentModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Shipment/AddShipmentModel.cs@@ -5,10 +5,10 @@ public class AddShipmentModelpublic string OrderId { get; set; }public string TrackingNumber { get; set; }public string AdminComment { get; set; }-+public IList<ShipmentItemModel> Items { get; set; } = new List<ShipmentItemModel>();- public class ShipmentItemModel+ public class ShipmentItemModel{public string OrderItemId { get; set; }public int QuantityToAdd { get; set; }diff --git a/src/Web/Grand.Web.Vendor/Models/Shipment/ShipmentListModel.cs b/src/Web/Grand.Web.Vendor/Models/Shipment/ShipmentListModel.csindex 62b1a1c46..b99871d9d 100644--- a/src/Web/Grand.Web.Vendor/Models/Shipment/ShipmentListModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Shipment/ShipmentListModel.cs@@ -3,33 +3,33 @@ using Grand.Infrastructure.Models;using Microsoft.AspNetCore.Mvc.Rendering;using System.ComponentModel.DataAnnotations;-namespace Grand.Web.Vendor.Models.Shipment+namespace Grand.Web.Vendor.Models.Shipment;++public class ShipmentListModel : BaseModel{- public class ShipmentListModel : BaseModel- {- [GrandResourceDisplayName("Vendor.Orders.Shipments.List.StartDate")]- [UIHint("DateNullable")]- public DateTime? StartDate { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.Shipments.List.StartDate")]+ [UIHint("DateNullable")]+ public DateTime? StartDate { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Shipments.List.EndDate")]+ [UIHint("DateNullable")]+ public DateTime? EndDate { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Shipments.List.TrackingNumber")]++ public string TrackingNumber { get; set; }+- [GrandResourceDisplayName("Vendor.Orders.Shipments.List.EndDate")]- [UIHint("DateNullable")]- public DateTime? EndDate { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.Shipments.List.City")]- [GrandResourceDisplayName("Vendor.Orders.Shipments.List.TrackingNumber")]-- public string TrackingNumber { get; set; }-+ public string City { get; set; }- [GrandResourceDisplayName("Vendor.Orders.Shipments.List.City")]-- public string City { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.Shipments.List.LoadNotShipped")]+ public bool LoadNotShipped { get; set; }- [GrandResourceDisplayName("Vendor.Orders.Shipments.List.LoadNotShipped")]- public bool LoadNotShipped { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.Shipments.List.Warehouse")]+ public string WarehouseId { get; set; }- [GrandResourceDisplayName("Vendor.Orders.Shipments.List.Warehouse")]- public string WarehouseId { get; set; }- public IList<SelectListItem> AvailableWarehouses { get; set; } = new List<SelectListItem>();- }+ public IList<SelectListItem> AvailableWarehouses { get; set; } = new List<SelectListItem>();}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Shipment/ShipmentModel.cs b/src/Web/Grand.Web.Vendor/Models/Shipment/ShipmentModel.csindex 5b3505838..f151cda35 100644--- a/src/Web/Grand.Web.Vendor/Models/Shipment/ShipmentModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Shipment/ShipmentModel.cs@@ -1,114 +1,132 @@using Grand.Infrastructure.ModelBinding;using Grand.Infrastructure.Models;-namespace Grand.Web.Vendor.Models.Shipment+namespace Grand.Web.Vendor.Models.Shipment;++public class ShipmentModel : BaseEntityModel{- public class ShipmentModel : BaseEntityModel+ [GrandResourceDisplayName("Vendor.Orders.Shipments.ID")]+ public override string Id { get; set; }++ public int ShipmentNumber { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Shipments.OrderID")]+ public string OrderId { get; set; }++ public int OrderNumber { get; set; }+ public string OrderCode { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Shipments.TotalWeight")]+ public string TotalWeight { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Shipments.TrackingNumber")]+ public string TrackingNumber { get; set; }++ public string TrackingNumberUrl { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Shipments.ShippedDate")]+ public DateTime? ShippedDate { get; set; }++ public bool CanShip { get; set; }+ public DateTime? ShippedDateUtc { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Shipments.DeliveryDate")]+ public DateTime? DeliveryDate { get; set; }++ public bool CanDeliver { get; set; }+ public DateTime? DeliveryDateUtc { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Shipments.AdminComment")]+ public string AdminComment { get; set; }++ public List<ShipmentItemModel> Items { get; set; } = new();++ public IList<ShipmentStatusEventModel> ShipmentStatusEvents { get; set; } = new List<ShipmentStatusEventModel>();++ //shipment notes+ [GrandResourceDisplayName("Vendor.Orders.Shipments.ShipmentNotes.Fields.DisplayToCustomer")]+ public bool AddShipmentNoteDisplayToCustomer { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Shipments.ShipmentNotes.Fields.Note")]++ public string AddShipmentNoteMessage { get; set; }+++ #region Nested classes++ public class ShipmentItemModel : BaseEntityModel{- [GrandResourceDisplayName("Vendor.Orders.Shipments.ID")]- public override string Id { get; set; }- public int ShipmentNumber { get; set; }-- [GrandResourceDisplayName("Vendor.Orders.Shipments.OrderID")]- public string OrderId { get; set; }- public int OrderNumber { get; set; }- public string OrderCode { get; set; }- [GrandResourceDisplayName("Vendor.Orders.Shipments.TotalWeight")]- public string TotalWeight { get; set; }- [GrandResourceDisplayName("Vendor.Orders.Shipments.TrackingNumber")]- public string TrackingNumber { get; set; }- public string TrackingNumberUrl { get; set; }-- [GrandResourceDisplayName("Vendor.Orders.Shipments.ShippedDate")]- public DateTime? ShippedDate { get; set; }- public bool CanShip { get; set; }- public DateTime? ShippedDateUtc { get; set; }-- [GrandResourceDisplayName("Vendor.Orders.Shipments.DeliveryDate")]- public DateTime? DeliveryDate { get; set; }- public bool CanDeliver { get; set; }- public DateTime? DeliveryDateUtc { get; set; }-- [GrandResourceDisplayName("Vendor.Orders.Shipments.AdminComment")]- public string AdminComment { get; set; }-- public List<ShipmentItemModel> Items { get; set; } = new();-- public IList<ShipmentStatusEventModel> ShipmentStatusEvents { get; set; } = new List<ShipmentStatusEventModel>();-- //shipment notes- [GrandResourceDisplayName("Vendor.Orders.Shipments.ShipmentNotes.Fields.DisplayToCustomer")]- public bool AddShipmentNoteDisplayToCustomer { get; set; }- [GrandResourceDisplayName("Vendor.Orders.Shipments.ShipmentNotes.Fields.Note")]+ public string OrderItemId { get; set; }+ public string ProductId { get; set; }- public string AddShipmentNoteMessage { get; set; }-+ [GrandResourceDisplayName("Vendor.Orders.Shipments.Products.ProductName")]+ public string ProductName { get; set; }+ public string Sku { get; set; }+ public string AttributeInfo { get; set; }+ public string RentalInfo { get; set; }+ public bool ShipSeparately { get; set; }- #region Nested classes+ //weight of one item (product)+ [GrandResourceDisplayName("Vendor.Orders.Shipments.Products.ItemWeight")]+ public string ItemWeight { get; set; }- public class ShipmentItemModel : BaseEntityModel- {- public string OrderItemId { get; set; }- public string ProductId { get; set; }- [GrandResourceDisplayName("Vendor.Orders.Shipments.Products.ProductName")]- public string ProductName { get; set; }- public string Sku { get; set; }- public string AttributeInfo { get; set; }- public string RentalInfo { get; set; }- public bool ShipSeparately { get; set; }-- //weight of one item (product)- [GrandResourceDisplayName("Vendor.Orders.Shipments.Products.ItemWeight")]- public string ItemWeight { get; set; }- [GrandResourceDisplayName("Vendor.Orders.Shipments.Products.ItemDimensions")]- public string ItemDimensions { get; set; }-- public int QuantityToAdd { get; set; }- public int QuantityOrdered { get; set; }- [GrandResourceDisplayName("Vendor.Orders.Shipments.Products.QtyShipped")]- public int QuantityInThisShipment { get; set; }- public int QuantityInAllShipments { get; set; }-- public string ShippedFromWarehouse { get; set; }- public bool AllowToChooseWarehouse { get; set; }- //used before a shipment is created- public List<WarehouseInfo> AvailableWarehouses { get; set; } = new();- public string WarehouseId { get; set; }+ [GrandResourceDisplayName("Vendor.Orders.Shipments.Products.ItemDimensions")]+ public string ItemDimensions { get; set; }- #region Nested Classes- public class WarehouseInfo : BaseModel- {- public string WarehouseId { get; set; }- public string WarehouseCode { get; set; }- public string WarehouseName { get; set; }- public int StockQuantity { get; set; }- public int ReservedQuantity { get; set; }- }-- #endregion- }+ public int QuantityToAdd { get; set; }+ public int QuantityOrdered { get; set; }- public class ShipmentNote : BaseEntityModel- {- public string ShipmentId { get; set; }- [GrandResourceDisplayName("Vendor.Orders.Shipments.ShipmentNotes.Fields.DisplayToCustomer")]- public bool DisplayToCustomer { get; set; }- [GrandResourceDisplayName("Vendor.Orders.Shipments.ShipmentNotes.Fields.Note")]- public string Note { get; set; }- [GrandResourceDisplayName("Vendor.Orders.Shipments.ShipmentNotes.Fields.CreatedOn")]- public DateTime CreatedOn { get; set; }- [GrandResourceDisplayName("Vendor.Orders.Shipments.ShipmentNotes.Fields.CreatedByCustomer")]- public bool CreatedByCustomer { get; set; }- }+ [GrandResourceDisplayName("Vendor.Orders.Shipments.Products.QtyShipped")]+ public int QuantityInThisShipment { get; set; }++ public int QuantityInAllShipments { get; set; }++ public string ShippedFromWarehouse { get; set; }- public class ShipmentStatusEventModel : BaseModel+ public bool AllowToChooseWarehouse { get; set; }++ //used before a shipment is created+ public List<WarehouseInfo> AvailableWarehouses { get; set; } = new();+ public string WarehouseId { get; set; }++ #region Nested Classes++ public class WarehouseInfo : BaseModel{- public string EventName { get; set; }- public string Location { get; set; }- public DateTime? Date { get; set; }+ public string WarehouseId { get; set; }+ public string WarehouseCode { get; set; }+ public string WarehouseName { get; set; }+ public int StockQuantity { get; set; }+ public int ReservedQuantity { get; set; }}#endregion}++ public class ShipmentNote : BaseEntityModel+ {+ public string ShipmentId { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Shipments.ShipmentNotes.Fields.DisplayToCustomer")]+ public bool DisplayToCustomer { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Shipments.ShipmentNotes.Fields.Note")]+ public string Note { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Shipments.ShipmentNotes.Fields.CreatedOn")]+ public DateTime CreatedOn { get; set; }++ [GrandResourceDisplayName("Vendor.Orders.Shipments.ShipmentNotes.Fields.CreatedByCustomer")]+ public bool CreatedByCustomer { get; set; }+ }++ public class ShipmentStatusEventModel : BaseModel+ {+ public string EventName { get; set; }+ public string Location { get; set; }+ public DateTime? Date { get; set; }+ }++ #endregion}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Shipment/ShipmentTrackingModel.cs b/src/Web/Grand.Web.Vendor/Models/Shipment/ShipmentTrackingModel.csindex 2ecc464b9..a29d76995 100644--- a/src/Web/Grand.Web.Vendor/Models/Shipment/ShipmentTrackingModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Shipment/ShipmentTrackingModel.cs@@ -1,3 +1,3 @@namespace Grand.Web.Vendor.Models.Shipment;-public record ShipmentTrackingModel(string Id, string TrackingNumber);+public record ShipmentTrackingModel(string Id, string TrackingNumber);\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/Vendor/VendorModel.cs b/src/Web/Grand.Web.Vendor/Models/Vendor/VendorModel.csindex 9a412886f..08bd4c99c 100644--- a/src/Web/Grand.Web.Vendor/Models/Vendor/VendorModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/Vendor/VendorModel.cs@@ -1,80 +1,79 @@-using Grand.Web.Common.Models;-using Grand.Infrastructure.ModelBinding;+using Grand.Infrastructure.ModelBinding;using Grand.Infrastructure.Models;+using Grand.Web.Common.Models;using Grand.Web.Vendor.Models.Common;-namespace Grand.Web.Vendor.Models.Vendor+namespace Grand.Web.Vendor.Models.Vendor;++public class VendorModel : BaseEntityModel, ILocalizedModel<VendorLocalizedModel>{- public class VendorModel : BaseEntityModel, ILocalizedModel<VendorLocalizedModel>- {- [GrandResourceDisplayName("Vendor.Fields.Name")]+ [GrandResourceDisplayName("Vendor.Fields.Name")]++ public string Name { get; set; }- public string Name { get; set; }+ [GrandResourceDisplayName("Vendor.Fields.Email")]- [GrandResourceDisplayName("Vendor.Fields.Email")]+ public string Email { get; set; }- public string Email { get; set; }+ [GrandResourceDisplayName("Vendor.Fields.Description")]- [GrandResourceDisplayName("Vendor.Fields.Description")]+ public string Description { get; set; }- public string Description { get; set; }-- [GrandResourceDisplayName("Vendor.Fields.MetaKeywords")]+ [GrandResourceDisplayName("Vendor.Fields.MetaKeywords")]- public string MetaKeywords { get; set; }+ public string MetaKeywords { get; set; }- [GrandResourceDisplayName("Vendor.Fields.MetaDescription")]+ [GrandResourceDisplayName("Vendor.Fields.MetaDescription")]- public string MetaDescription { get; set; }+ public string MetaDescription { get; set; }- [GrandResourceDisplayName("Vendor.Fields.MetaTitle")]+ [GrandResourceDisplayName("Vendor.Fields.MetaTitle")]- public string MetaTitle { get; set; }+ public string MetaTitle { get; set; }- [GrandResourceDisplayName("Vendor.Fields.SeName")]+ [GrandResourceDisplayName("Vendor.Fields.SeName")]- public string SeName { get; set; }+ public string SeName { get; set; }- [GrandResourceDisplayName("Vendor.Fields.PageSize")]- public int PageSize { get; set; }+ [GrandResourceDisplayName("Vendor.Fields.PageSize")]+ public int PageSize { get; set; }- [GrandResourceDisplayName("Vendor.Fields.AllowCustomersToSelectPageSize")]- public bool AllowCustomersToSelectPageSize { get; set; }+ [GrandResourceDisplayName("Vendor.Fields.AllowCustomersToSelectPageSize")]+ public bool AllowCustomersToSelectPageSize { get; set; }- [GrandResourceDisplayName("Vendor.Fields.PageSizeOptions")]- public string PageSizeOptions { get; set; }+ [GrandResourceDisplayName("Vendor.Fields.PageSizeOptions")]+ public string PageSizeOptions { get; set; }- public IList<VendorLocalizedModel> Locales { get; set; } = new List<VendorLocalizedModel>();+ public AddressModel Address { get; set; } = new();- public AddressModel Address { get; set; } = new();- }+ public IList<VendorLocalizedModel> Locales { get; set; } = new List<VendorLocalizedModel>();+}- public class VendorLocalizedModel : ILocalizedModelLocal, ISlugModelLocal- {- public string LanguageId { get; set; }+public class VendorLocalizedModel : ILocalizedModelLocal, ISlugModelLocal+{+ [GrandResourceDisplayName("Vendor.Fields.Name")]- [GrandResourceDisplayName("Vendor.Fields.Name")]+ public string Name { get; set; }- public string Name { get; set; }+ [GrandResourceDisplayName("Vendor.Fields.Description")]- [GrandResourceDisplayName("Vendor.Fields.Description")]+ public string Description { get; set; }- public string Description { get; set; }+ [GrandResourceDisplayName("Vendor.Fields.MetaKeywords")]- [GrandResourceDisplayName("Vendor.Fields.MetaKeywords")]+ public string MetaKeywords { get; set; }- public string MetaKeywords { get; set; }+ [GrandResourceDisplayName("Vendor.Fields.MetaDescription")]- [GrandResourceDisplayName("Vendor.Fields.MetaDescription")]+ public string MetaDescription { get; set; }- public string MetaDescription { get; set; }+ [GrandResourceDisplayName("Vendor.Fields.MetaTitle")]- [GrandResourceDisplayName("Vendor.Fields.MetaTitle")]+ public string MetaTitle { get; set; }- public string MetaTitle { get; set; }+ public string LanguageId { get; set; }- [GrandResourceDisplayName("Vendor.Fields.SeName")]+ [GrandResourceDisplayName("Vendor.Fields.SeName")]- public string SeName { get; set; }- }+ public string SeName { get; set; }}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/VendorReview/VendorReviewListModel.cs b/src/Web/Grand.Web.Vendor/Models/VendorReview/VendorReviewListModel.csindex 561597028..d6cc5cded 100644--- a/src/Web/Grand.Web.Vendor/Models/VendorReview/VendorReviewListModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/VendorReview/VendorReviewListModel.cs@@ -2,20 +2,18 @@using Grand.Infrastructure.Models;using System.ComponentModel.DataAnnotations;-namespace Grand.Web.Vendor.Models.VendorReview-{- public class VendorReviewListModel : BaseModel- {- [GrandResourceDisplayName("Vendor.VendorReviews.List.CreatedOnFrom")]- [UIHint("DateNullable")]- public DateTime? CreatedOnFrom { get; set; }+namespace Grand.Web.Vendor.Models.VendorReview;- [GrandResourceDisplayName("Vendor.VendorReviews.List.CreatedOnTo")]- [UIHint("DateNullable")]- public DateTime? CreatedOnTo { get; set; }+public class VendorReviewListModel : BaseModel+{+ [GrandResourceDisplayName("Vendor.VendorReviews.List.CreatedOnFrom")]+ [UIHint("DateNullable")]+ public DateTime? CreatedOnFrom { get; set; }- [GrandResourceDisplayName("Vendor.VendorReviews.List.SearchText")]- public string SearchText { get; set; }+ [GrandResourceDisplayName("Vendor.VendorReviews.List.CreatedOnTo")]+ [UIHint("DateNullable")]+ public DateTime? CreatedOnTo { get; set; }- }+ [GrandResourceDisplayName("Vendor.VendorReviews.List.SearchText")]+ public string SearchText { get; set; }}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Models/VendorReview/VendorReviewModel.cs b/src/Web/Grand.Web.Vendor/Models/VendorReview/VendorReviewModel.csindex a3ecd68ff..533e7388c 100644--- a/src/Web/Grand.Web.Vendor/Models/VendorReview/VendorReviewModel.cs+++ b/src/Web/Grand.Web.Vendor/Models/VendorReview/VendorReviewModel.cs@@ -1,28 +1,28 @@using Grand.Infrastructure.ModelBinding;using Grand.Infrastructure.Models;-namespace Grand.Web.Vendor.Models.VendorReview+namespace Grand.Web.Vendor.Models.VendorReview;++public class VendorReviewModel : BaseEntityModel{- public class VendorReviewModel : BaseEntityModel- {- [GrandResourceDisplayName("Vendor.VendorReviews.Fields.Customer")]- public string CustomerId { get; set; }- [GrandResourceDisplayName("Vendor.VendorReviews.Fields.Customer")]- public string CustomerInfo { get; set; }+ [GrandResourceDisplayName("Vendor.VendorReviews.Fields.Customer")]+ public string CustomerId { get; set; }++ [GrandResourceDisplayName("Vendor.VendorReviews.Fields.Customer")]+ public string CustomerInfo { get; set; }- [GrandResourceDisplayName("Vendor.VendorReviews.Fields.Title")]- public string Title { get; set; }+ [GrandResourceDisplayName("Vendor.VendorReviews.Fields.Title")]+ public string Title { get; set; }- [GrandResourceDisplayName("Vendor.VendorReviews.Fields.ReviewText")]- public string ReviewText { get; set; }+ [GrandResourceDisplayName("Vendor.VendorReviews.Fields.ReviewText")]+ public string ReviewText { get; set; }- [GrandResourceDisplayName("Vendor.VendorReviews.Fields.Rating")]- public int Rating { get; set; }+ [GrandResourceDisplayName("Vendor.VendorReviews.Fields.Rating")]+ public int Rating { get; set; }- [GrandResourceDisplayName("Vendor.VendorReviews.Fields.IsApproved")]- public bool IsApproved { get; set; }+ [GrandResourceDisplayName("Vendor.VendorReviews.Fields.IsApproved")]+ public bool IsApproved { get; set; }- [GrandResourceDisplayName("Vendor.VendorReviews.Fields.CreatedOn")]- public DateTime CreatedOn { get; set; }- }-}+ [GrandResourceDisplayName("Vendor.VendorReviews.Fields.CreatedOn")]+ public DateTime CreatedOn { get; set; }+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Program.cs b/src/Web/Grand.Web.Vendor/Program.csindex 86b4ee692..d6007cb4c 100644--- a/src/Web/Grand.Web.Vendor/Program.cs+++ b/src/Web/Grand.Web.Vendor/Program.cs@@ -1,3 +1,4 @@+using Grand.Infrastructure;using Grand.Web.Common.Extensions;using Microsoft.AspNetCore.Builder;using Microsoft.Extensions.Hosting;@@ -14,7 +15,7 @@ builder.Host.UseDefaultServiceProvider((_, options) =>builder.Configuration.AddAppSettingsJsonFile(args);//add services-Grand.Infrastructure.StartupBase.ConfigureServices(builder.Services, builder.Configuration);+StartupBase.ConfigureServices(builder.Services, builder.Configuration);builder.ConfigureApplicationSettings();@@ -22,7 +23,7 @@ builder.ConfigureApplicationSettings();var app = builder.Build();//request pipeline-Grand.Infrastructure.StartupBase.ConfigureRequestPipeline(app, builder.Environment);+StartupBase.ConfigureRequestPipeline(app, builder.Environment);//run app-app.Run();+app.Run();\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Services/MerchandiseReturnViewModelService.cs b/src/Web/Grand.Web.Vendor/Services/MerchandiseReturnViewModelService.csindex 4f440787e..d4793e4ce 100644--- a/src/Web/Grand.Web.Vendor/Services/MerchandiseReturnViewModelService.cs+++ b/src/Web/Grand.Web.Vendor/Services/MerchandiseReturnViewModelService.cs@@ -6,324 +6,343 @@ using Grand.Business.Core.Interfaces.Common.Directory;using Grand.Business.Core.Interfaces.Common.Localization;using Grand.Business.Core.Interfaces.Customers;using Grand.Business.Core.Interfaces.Messages;-using Grand.Web.Common.Extensions;using Grand.Domain.Common;using Grand.Domain.Directory;using Grand.Domain.Localization;using Grand.Domain.Orders;using Grand.Infrastructure;+using Grand.Web.Common.Extensions;using Grand.Web.Vendor.Extensions;using Grand.Web.Vendor.Interfaces;using Grand.Web.Vendor.Models.Common;using Grand.Web.Vendor.Models.MerchandiseReturn;using Microsoft.AspNetCore.Mvc.Rendering;-namespace Grand.Web.Vendor.Services+namespace Grand.Web.Vendor.Services;++public class MerchandiseReturnViewModelService : IMerchandiseReturnViewModelService{- public class MerchandiseReturnViewModelService : IMerchandiseReturnViewModelService- {- #region Fields-- private readonly IOrderService _orderService;- private readonly IWorkContext _workContext;- private readonly IProductService _productService;- private readonly IDateTimeService _dateTimeService;- private readonly ICustomerService _customerService;- private readonly ITranslationService _translationService;- private readonly IMessageProviderService _messageProviderService;- private readonly LanguageSettings _languageSettings;- private readonly IMerchandiseReturnService _merchandiseReturnService;- private readonly IPriceFormatter _priceFormatter;- private readonly AddressSettings _addressSettings;- private readonly OrderSettings _orderSettings;- private readonly ICountryService _countryService;- private readonly IAddressAttributeService _addressAttributeService;- private readonly IAddressAttributeParser _addressAttributeParser;-- #endregion Fields-- #region Constructors-- public MerchandiseReturnViewModelService(- IOrderService orderService,- IWorkContext workContext,- IProductService productService,- ICustomerService customerService,- IDateTimeService dateTimeService,- ITranslationService translationService,- IMessageProviderService messageProviderService,- LanguageSettings languageSettings,- IMerchandiseReturnService merchandiseReturnService,- IPriceFormatter priceFormatter,- AddressSettings addressSettings,- ICountryService countryService,- IAddressAttributeService addressAttributeService,- IAddressAttributeParser addressAttributeParser,- OrderSettings orderSettings)- {- _orderService = orderService;- _workContext = workContext;- _productService = productService;- _customerService = customerService;- _dateTimeService = dateTimeService;- _translationService = translationService;- _messageProviderService = messageProviderService;- _languageSettings = languageSettings;- _merchandiseReturnService = merchandiseReturnService;- _priceFormatter = priceFormatter;- _addressSettings = addressSettings;- _countryService = countryService;- _addressAttributeService = addressAttributeService;- _addressAttributeParser = addressAttributeParser;- _orderSettings = orderSettings;- }+ #region Constructors- #endregion+ public MerchandiseReturnViewModelService(+ IOrderService orderService,+ IWorkContext workContext,+ IProductService productService,+ ICustomerService customerService,+ IDateTimeService dateTimeService,+ ITranslationService translationService,+ IMessageProviderService messageProviderService,+ LanguageSettings languageSettings,+ IMerchandiseReturnService merchandiseReturnService,+ IPriceFormatter priceFormatter,+ AddressSettings addressSettings,+ ICountryService countryService,+ IAddressAttributeService addressAttributeService,+ IAddressAttributeParser addressAttributeParser,+ OrderSettings orderSettings)+ {+ _orderService = orderService;+ _workContext = workContext;+ _productService = productService;+ _customerService = customerService;+ _dateTimeService = dateTimeService;+ _translationService = translationService;+ _messageProviderService = messageProviderService;+ _languageSettings = languageSettings;+ _merchandiseReturnService = merchandiseReturnService;+ _priceFormatter = priceFormatter;+ _addressSettings = addressSettings;+ _countryService = countryService;+ _addressAttributeService = addressAttributeService;+ _addressAttributeParser = addressAttributeParser;+ _orderSettings = orderSettings;+ }- public virtual async Task<MerchandiseReturnModel> PrepareMerchandiseReturnModel(MerchandiseReturnModel model,- MerchandiseReturn merchandiseReturn, bool excludeProperties)- {- ArgumentNullException.ThrowIfNull(model);- ArgumentNullException.ThrowIfNull(merchandiseReturn);+ #endregion- var order = await _orderService.GetOrderById(merchandiseReturn.OrderId);- double unitPriceInclTaxInCustomerCurrency = 0;- foreach (var item in merchandiseReturn.MerchandiseReturnItems)- {- var orderItem = order.OrderItems.First(x => x.Id == item.OrderItemId);- unitPriceInclTaxInCustomerCurrency += orderItem.UnitPriceInclTax * item.Quantity;- }-- model.Total = _priceFormatter.FormatPrice(unitPriceInclTaxInCustomerCurrency);- model.Quantity = merchandiseReturn.MerchandiseReturnItems.Sum(x => x.Quantity);- model.Id = merchandiseReturn.Id;- model.OrderId = order.Id;- model.OrderNumber = order.OrderNumber;- model.OrderCode = order.Code;- model.ReturnNumber = merchandiseReturn.ReturnNumber;- model.CustomerId = merchandiseReturn.CustomerId;- model.NotifyCustomer = merchandiseReturn.NotifyCustomer;- var customer = await _customerService.GetCustomerById(merchandiseReturn.CustomerId);- if (customer != null)- model.CustomerInfo = !string.IsNullOrEmpty(customer.Email) ? customer.Email : _translationService.GetResource("Admin.Customers.Guest");- else- model.CustomerInfo = _translationService.GetResource("Admin.Customers.Guest");-- model.MerchandiseReturnStatusStr = merchandiseReturn.MerchandiseReturnStatus.ToString();- model.CreatedOn = _dateTimeService.ConvertToUserTime(merchandiseReturn.CreatedOnUtc, DateTimeKind.Utc);- model.PickupDate = merchandiseReturn.PickupDate;- model.UserFields = merchandiseReturn.UserFields;+ public virtual async Task<MerchandiseReturnModel> PrepareMerchandiseReturnModel(MerchandiseReturnModel model,+ MerchandiseReturn merchandiseReturn, bool excludeProperties)+ {+ ArgumentNullException.ThrowIfNull(model);+ ArgumentNullException.ThrowIfNull(merchandiseReturn);- if (!excludeProperties)- {- var addr = new AddressModel();- model.PickupAddress = await PrepareAddressModel(addr, merchandiseReturn.PickupAddress, false);- model.CustomerComments = merchandiseReturn.CustomerComments;- model.ExternalId = merchandiseReturn.ExternalId;- model.StaffNotes = merchandiseReturn.StaffNotes;- model.MerchandiseReturnStatusId = merchandiseReturn.MerchandiseReturnStatusId;- }-- return model;- }- public virtual async Task<(IList<MerchandiseReturnModel> merchandiseReturnModels, int totalCount)> PrepareMerchandiseReturnModel(MerchandiseReturnListModel model, int pageIndex, int pageSize)+ var order = await _orderService.GetOrderById(merchandiseReturn.OrderId);+ double unitPriceInclTaxInCustomerCurrency = 0;+ foreach (var item in merchandiseReturn.MerchandiseReturnItems){- var customerId = string.Empty;- if (!string.IsNullOrEmpty(model.SearchCustomerEmail))- {- var customer = await _customerService.GetCustomerByEmail(model.SearchCustomerEmail);- customerId = customer != null ? customer.Id : "00000000-0000-0000-0000-000000000000";- }- DateTime? startDateValue = model.StartDate == null ? null- : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);-- DateTime? endDateValue = model.EndDate == null ? null- : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone);-- var merchandiseReturns = await _merchandiseReturnService.SearchMerchandiseReturns(- customerId: customerId,- vendorId: _workContext.CurrentVendor.Id,- rs: model.SearchMerchandiseReturnStatusId >= 0 ? (MerchandiseReturnStatus?)model.SearchMerchandiseReturnStatusId : null,- pageIndex: pageIndex - 1,- pageSize: pageSize,- createdFromUtc: startDateValue,- createdToUtc: endDateValue);- var merchandiseReturnModels = new List<MerchandiseReturnModel>();- foreach (var rr in merchandiseReturns)- {- var merchandiseReturnModel = new MerchandiseReturnModel();- merchandiseReturnModels.Add(await PrepareMerchandiseReturnModel(merchandiseReturnModel, rr, true));- }- return (merchandiseReturnModels, merchandiseReturns.TotalCount);- }- private async Task<AddressModel> PrepareAddressModel(AddressModel model, Address address, bool excludeProperties)- {- if (address != null)- {- if (!excludeProperties)- {- model = await address.ToModel(_countryService);- }- }-- model ??= new AddressModel();-- model.FirstNameEnabled = true;- model.FirstNameRequired = true;- model.LastNameEnabled = true;- model.LastNameRequired = true;- model.EmailEnabled = true;- model.EmailRequired = true;- model.CompanyEnabled = _addressSettings.CompanyEnabled;- model.CompanyRequired = _addressSettings.CompanyRequired;- model.VatNumberEnabled = _addressSettings.VatNumberEnabled;- model.VatNumberRequired = _addressSettings.VatNumberRequired;- model.CountryEnabled = _addressSettings.CountryEnabled;- model.StateProvinceEnabled = _addressSettings.StateProvinceEnabled;- model.CityEnabled = _addressSettings.CityEnabled;- model.CityRequired = _addressSettings.CityRequired;- model.StreetAddressEnabled = _addressSettings.StreetAddressEnabled;- model.StreetAddressRequired = _addressSettings.StreetAddressRequired;- model.StreetAddress2Enabled = _addressSettings.StreetAddress2Enabled;- model.StreetAddress2Required = _addressSettings.StreetAddress2Required;- model.ZipPostalCodeEnabled = _addressSettings.ZipPostalCodeEnabled;- model.ZipPostalCodeRequired = _addressSettings.ZipPostalCodeRequired;- model.PhoneEnabled = _addressSettings.PhoneEnabled;- model.PhoneRequired = _addressSettings.PhoneRequired;- model.FaxEnabled = _addressSettings.FaxEnabled;- model.FaxRequired = _addressSettings.FaxRequired;- model.NoteEnabled = _addressSettings.NoteEnabled;-- //countries- model.AvailableCountries.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Address.SelectCountry"), Value = "" });- foreach (var c in await _countryService.GetAllCountries(showHidden: true))- model.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id, Selected = c.Id == model.CountryId });- //states- var states = !string.IsNullOrEmpty(model.CountryId) ? (await _countryService.GetCountryById(model.CountryId))?.StateProvinces : new List<StateProvince>();- if (states is { Count: > 0 })- {- foreach (var s in states)- model.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id, Selected = s.Id == model.StateProvinceId });- }- //customer attribute services- await model.PrepareCustomAddressAttributes(address, _addressAttributeService, _addressAttributeParser);-- return model;+ var orderItem = order.OrderItems.First(x => x.Id == item.OrderItemId);+ unitPriceInclTaxInCustomerCurrency += orderItem.UnitPriceInclTax * item.Quantity;}- private async Task NotifyCustomer(MerchandiseReturn merchandiseReturn)+ model.Total = _priceFormatter.FormatPrice(unitPriceInclTaxInCustomerCurrency);+ model.Quantity = merchandiseReturn.MerchandiseReturnItems.Sum(x => x.Quantity);+ model.Id = merchandiseReturn.Id;+ model.OrderId = order.Id;+ model.OrderNumber = order.OrderNumber;+ model.OrderCode = order.Code;+ model.ReturnNumber = merchandiseReturn.ReturnNumber;+ model.CustomerId = merchandiseReturn.CustomerId;+ model.NotifyCustomer = merchandiseReturn.NotifyCustomer;+ var customer = await _customerService.GetCustomerById(merchandiseReturn.CustomerId);+ if (customer != null)+ model.CustomerInfo = !string.IsNullOrEmpty(customer.Email)+ ? customer.Email+ : _translationService.GetResource("Admin.Customers.Guest");+ else+ model.CustomerInfo = _translationService.GetResource("Admin.Customers.Guest");++ model.MerchandiseReturnStatusStr = merchandiseReturn.MerchandiseReturnStatus.ToString();+ model.CreatedOn = _dateTimeService.ConvertToUserTime(merchandiseReturn.CreatedOnUtc, DateTimeKind.Utc);+ model.PickupDate = merchandiseReturn.PickupDate;+ model.UserFields = merchandiseReturn.UserFields;++ if (!excludeProperties){- var order = await _orderService.GetOrderById(merchandiseReturn.OrderId);- await _messageProviderService.SendMerchandiseReturnStatusChangedCustomerMessage(merchandiseReturn, order, _languageSettings.DefaultAdminLanguageId);+ var addr = new AddressModel();+ model.PickupAddress = await PrepareAddressModel(addr, merchandiseReturn.PickupAddress, false);+ model.CustomerComments = merchandiseReturn.CustomerComments;+ model.ExternalId = merchandiseReturn.ExternalId;+ model.StaffNotes = merchandiseReturn.StaffNotes;+ model.MerchandiseReturnStatusId = merchandiseReturn.MerchandiseReturnStatusId;}-- public virtual MerchandiseReturnListModel PrepareReturnRequestListModel()++ return model;+ }++ public virtual async Task<(IList<MerchandiseReturnModel> merchandiseReturnModels, int totalCount)>+ PrepareMerchandiseReturnModel(MerchandiseReturnListModel model, int pageIndex, int pageSize)+ {+ var customerId = string.Empty;+ if (!string.IsNullOrEmpty(model.SearchCustomerEmail)){- var model = new MerchandiseReturnListModel- {- //Merchandise return status- MerchandiseReturnStatus = MerchandiseReturnStatus.Pending.ToSelectList(_translationService, _workContext, false).ToList()- };- model.MerchandiseReturnStatus.Insert(0, new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "-1" });-- return model;+ var customer = await _customerService.GetCustomerByEmail(model.SearchCustomerEmail);+ customerId = customer != null ? customer.Id : "00000000-0000-0000-0000-000000000000";}- public virtual async Task<IList<MerchandiseReturnModel.MerchandiseReturnItemModel>> PrepareMerchandiseReturnItemModel(string merchandiseReturnId)- {- var merchandiseReturn = await _merchandiseReturnService.GetMerchandiseReturnById(merchandiseReturnId);- var items = new List<MerchandiseReturnModel.MerchandiseReturnItemModel>();- var order = await _orderService.GetOrderById(merchandiseReturn.OrderId);- foreach (var item in merchandiseReturn.MerchandiseReturnItems)- {- var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == item.OrderItemId);- items.Add(new MerchandiseReturnModel.MerchandiseReturnItemModel- {- ProductId = orderItem?.ProductId,- ProductName = (await _productService.GetProductByIdIncludeArch(orderItem?.ProductId)).Name,- ProductSku = orderItem?.Sku,- Quantity = item.Quantity,- UnitPrice = _priceFormatter.FormatPrice(orderItem!.UnitPriceInclTax),- ReasonForReturn = item.ReasonForReturn,- RequestedAction = item.RequestedAction- });- }- return items;- }- public virtual async Task<MerchandiseReturn> UpdateMerchandiseReturnModel(MerchandiseReturn merchandiseReturn, MerchandiseReturnModel model, List<CustomAttribute> customAddressAttributes)+ DateTime? startDateValue = model.StartDate == null+ ? null+ : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);++ DateTime? endDateValue = model.EndDate == null+ ? null+ : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone);++ var merchandiseReturns = await _merchandiseReturnService.SearchMerchandiseReturns(+ customerId: customerId,+ vendorId: _workContext.CurrentVendor.Id,+ rs: model.SearchMerchandiseReturnStatusId >= 0+ ? (MerchandiseReturnStatus?)model.SearchMerchandiseReturnStatusId+ : null,+ pageIndex: pageIndex - 1,+ pageSize: pageSize,+ createdFromUtc: startDateValue,+ createdToUtc: endDateValue);+ var merchandiseReturnModels = new List<MerchandiseReturnModel>();+ foreach (var rr in merchandiseReturns){- merchandiseReturn.CustomerComments = model.CustomerComments;- merchandiseReturn.StaffNotes = model.StaffNotes;- merchandiseReturn.MerchandiseReturnStatusId = model.MerchandiseReturnStatusId;- merchandiseReturn.ExternalId = model.ExternalId;- merchandiseReturn.UserFields = model.UserFields;-- if (_orderSettings.MerchandiseReturns_AllowToSpecifyPickupDate)- merchandiseReturn.PickupDate = model.PickupDate;- if (_orderSettings.MerchandiseReturns_AllowToSpecifyPickupAddress)- {- merchandiseReturn.PickupAddress = model.PickupAddress.ToEntity();- if (merchandiseReturn.PickupAddress != null)- merchandiseReturn.PickupAddress.Attributes = customAddressAttributes;- }- merchandiseReturn.NotifyCustomer = model.NotifyCustomer;- await _merchandiseReturnService.UpdateMerchandiseReturn(merchandiseReturn);- if (model.NotifyCustomer)- await NotifyCustomer(merchandiseReturn);- return merchandiseReturn;+ var merchandiseReturnModel = new MerchandiseReturnModel();+ merchandiseReturnModels.Add(await PrepareMerchandiseReturnModel(merchandiseReturnModel, rr, true));}- public virtual async Task DeleteMerchandiseReturn(MerchandiseReturn merchandiseReturn)++ return (merchandiseReturnModels, merchandiseReturns.TotalCount);+ }++ public virtual MerchandiseReturnListModel PrepareReturnRequestListModel()+ {+ var model = new MerchandiseReturnListModel {+ //Merchandise return status+ MerchandiseReturnStatus = MerchandiseReturnStatus.Pending+ .ToSelectList(_translationService, _workContext, false).ToList()+ };+ model.MerchandiseReturnStatus.Insert(0,+ new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "-1" });++ return model;+ }++ public virtual async Task<IList<MerchandiseReturnModel.MerchandiseReturnItemModel>>+ PrepareMerchandiseReturnItemModel(string merchandiseReturnId)+ {+ var merchandiseReturn = await _merchandiseReturnService.GetMerchandiseReturnById(merchandiseReturnId);+ var items = new List<MerchandiseReturnModel.MerchandiseReturnItemModel>();+ var order = await _orderService.GetOrderById(merchandiseReturn.OrderId);++ foreach (var item in merchandiseReturn.MerchandiseReturnItems){- await _merchandiseReturnService.DeleteMerchandiseReturn(merchandiseReturn);+ var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == item.OrderItemId);+ items.Add(new MerchandiseReturnModel.MerchandiseReturnItemModel {+ ProductId = orderItem?.ProductId,+ ProductName = (await _productService.GetProductByIdIncludeArch(orderItem?.ProductId)).Name,+ ProductSku = orderItem?.Sku,+ Quantity = item.Quantity,+ UnitPrice = _priceFormatter.FormatPrice(orderItem!.UnitPriceInclTax),+ ReasonForReturn = item.ReasonForReturn,+ RequestedAction = item.RequestedAction+ });}- public virtual async Task<IList<MerchandiseReturnModel.MerchandiseReturnNote>> PrepareMerchandiseReturnNotes(MerchandiseReturn merchandiseReturn)+ return items;+ }++ public virtual async Task<MerchandiseReturn> UpdateMerchandiseReturnModel(MerchandiseReturn merchandiseReturn,+ MerchandiseReturnModel model, List<CustomAttribute> customAddressAttributes)+ {+ merchandiseReturn.CustomerComments = model.CustomerComments;+ merchandiseReturn.StaffNotes = model.StaffNotes;+ merchandiseReturn.MerchandiseReturnStatusId = model.MerchandiseReturnStatusId;+ merchandiseReturn.ExternalId = model.ExternalId;+ merchandiseReturn.UserFields = model.UserFields;++ if (_orderSettings.MerchandiseReturns_AllowToSpecifyPickupDate)+ merchandiseReturn.PickupDate = model.PickupDate;+ if (_orderSettings.MerchandiseReturns_AllowToSpecifyPickupAddress){- //merchandise return notes- var merchandiseReturnNoteModels = new List<MerchandiseReturnModel.MerchandiseReturnNote>();- foreach (var merchandiseReturnNote in (await _merchandiseReturnService.GetMerchandiseReturnNotes(merchandiseReturn.Id))- .OrderByDescending(on => on.CreatedOnUtc))- {- merchandiseReturnNoteModels.Add(new MerchandiseReturnModel.MerchandiseReturnNote- {- Id = merchandiseReturnNote.Id,- MerchandiseReturnId = merchandiseReturn.Id,- DisplayToCustomer = merchandiseReturnNote.DisplayToCustomer,- Note = merchandiseReturnNote.Note,- CreatedOn = _dateTimeService.ConvertToUserTime(merchandiseReturnNote.CreatedOnUtc, DateTimeKind.Utc),- CreatedByCustomer = merchandiseReturnNote.CreatedByCustomer- });- }- return merchandiseReturnNoteModels;+ merchandiseReturn.PickupAddress = model.PickupAddress.ToEntity();+ if (merchandiseReturn.PickupAddress != null)+ merchandiseReturn.PickupAddress.Attributes = customAddressAttributes;}- public virtual async Task InsertMerchandiseReturnNote(MerchandiseReturn merchandiseReturn, bool displayToCustomer, string message)+ merchandiseReturn.NotifyCustomer = model.NotifyCustomer;+ await _merchandiseReturnService.UpdateMerchandiseReturn(merchandiseReturn);+ if (model.NotifyCustomer)+ await NotifyCustomer(merchandiseReturn);+ return merchandiseReturn;+ }++ public virtual async Task DeleteMerchandiseReturn(MerchandiseReturn merchandiseReturn)+ {+ await _merchandiseReturnService.DeleteMerchandiseReturn(merchandiseReturn);+ }++ public virtual async Task<IList<MerchandiseReturnModel.MerchandiseReturnNote>> PrepareMerchandiseReturnNotes(+ MerchandiseReturn merchandiseReturn)+ {+ //merchandise return notes+ var merchandiseReturnNoteModels = new List<MerchandiseReturnModel.MerchandiseReturnNote>();+ foreach (var merchandiseReturnNote in (await _merchandiseReturnService.GetMerchandiseReturnNotes(+ merchandiseReturn.Id))+ .OrderByDescending(on => on.CreatedOnUtc))+ merchandiseReturnNoteModels.Add(new MerchandiseReturnModel.MerchandiseReturnNote {+ Id = merchandiseReturnNote.Id,+ MerchandiseReturnId = merchandiseReturn.Id,+ DisplayToCustomer = merchandiseReturnNote.DisplayToCustomer,+ Note = merchandiseReturnNote.Note,+ CreatedOn = _dateTimeService.ConvertToUserTime(merchandiseReturnNote.CreatedOnUtc, DateTimeKind.Utc),+ CreatedByCustomer = merchandiseReturnNote.CreatedByCustomer+ });+ return merchandiseReturnNoteModels;+ }++ public virtual async Task InsertMerchandiseReturnNote(MerchandiseReturn merchandiseReturn, bool displayToCustomer,+ string message)+ {+ var merchandiseReturnNote = new MerchandiseReturnNote {+ DisplayToCustomer = displayToCustomer,+ Note = message,+ MerchandiseReturnId = merchandiseReturn.Id+ };+ await _merchandiseReturnService.InsertMerchandiseReturnNote(merchandiseReturnNote);++ //new merchandise return notification+ if (displayToCustomer){- var merchandiseReturnNote = new MerchandiseReturnNote- {- DisplayToCustomer = displayToCustomer,- Note = message,- MerchandiseReturnId = merchandiseReturn.Id- };- await _merchandiseReturnService.InsertMerchandiseReturnNote(merchandiseReturnNote);-- //new merchandise return notification- if (displayToCustomer)- {- var order = await _orderService.GetOrderById(merchandiseReturn.OrderId);- await _messageProviderService.SendNewMerchandiseReturnNoteAddedCustomerMessage(merchandiseReturn, merchandiseReturnNote, order);- }+ var order = await _orderService.GetOrderById(merchandiseReturn.OrderId);+ await _messageProviderService.SendNewMerchandiseReturnNoteAddedCustomerMessage(merchandiseReturn,+ merchandiseReturnNote, order);}+ }- public virtual async Task DeleteMerchandiseReturnNote(MerchandiseReturn merchandiseReturn, string id)- {- var merchandiseReturnNote = (await _merchandiseReturnService.GetMerchandiseReturnNotes(merchandiseReturn.Id)).FirstOrDefault(on => on.Id == id);- if (merchandiseReturnNote == null)- throw new ArgumentException("No merchandise return note found with the specified id");+ public virtual async Task DeleteMerchandiseReturnNote(MerchandiseReturn merchandiseReturn, string id)+ {+ var merchandiseReturnNote =+ (await _merchandiseReturnService.GetMerchandiseReturnNotes(merchandiseReturn.Id)).FirstOrDefault(on =>+ on.Id == id);+ if (merchandiseReturnNote == null)+ throw new ArgumentException("No merchandise return note found with the specified id");- merchandiseReturnNote.MerchandiseReturnId = merchandiseReturn.Id;- await _merchandiseReturnService.DeleteMerchandiseReturnNote(merchandiseReturnNote);- }+ merchandiseReturnNote.MerchandiseReturnId = merchandiseReturn.Id;+ await _merchandiseReturnService.DeleteMerchandiseReturnNote(merchandiseReturnNote);}-}++ private async Task<AddressModel> PrepareAddressModel(AddressModel model, Address address, bool excludeProperties)+ {+ if (address != null)+ if (!excludeProperties)+ model = await address.ToModel(_countryService);++ model ??= new AddressModel();++ model.FirstNameEnabled = true;+ model.FirstNameRequired = true;+ model.LastNameEnabled = true;+ model.LastNameRequired = true;+ model.EmailEnabled = true;+ model.EmailRequired = true;+ model.CompanyEnabled = _addressSettings.CompanyEnabled;+ model.CompanyRequired = _addressSettings.CompanyRequired;+ model.VatNumberEnabled = _addressSettings.VatNumberEnabled;+ model.VatNumberRequired = _addressSettings.VatNumberRequired;+ model.CountryEnabled = _addressSettings.CountryEnabled;+ model.StateProvinceEnabled = _addressSettings.StateProvinceEnabled;+ model.CityEnabled = _addressSettings.CityEnabled;+ model.CityRequired = _addressSettings.CityRequired;+ model.StreetAddressEnabled = _addressSettings.StreetAddressEnabled;+ model.StreetAddressRequired = _addressSettings.StreetAddressRequired;+ model.StreetAddress2Enabled = _addressSettings.StreetAddress2Enabled;+ model.StreetAddress2Required = _addressSettings.StreetAddress2Required;+ model.ZipPostalCodeEnabled = _addressSettings.ZipPostalCodeEnabled;+ model.ZipPostalCodeRequired = _addressSettings.ZipPostalCodeRequired;+ model.PhoneEnabled = _addressSettings.PhoneEnabled;+ model.PhoneRequired = _addressSettings.PhoneRequired;+ model.FaxEnabled = _addressSettings.FaxEnabled;+ model.FaxRequired = _addressSettings.FaxRequired;+ model.NoteEnabled = _addressSettings.NoteEnabled;++ //countries+ model.AvailableCountries.Add(new SelectListItem+ { Text = _translationService.GetResource("Admin.Address.SelectCountry"), Value = "" });+ foreach (var c in await _countryService.GetAllCountries(showHidden: true))+ model.AvailableCountries.Add(new SelectListItem+ { Text = c.Name, Value = c.Id, Selected = c.Id == model.CountryId });+ //states+ var states = !string.IsNullOrEmpty(model.CountryId)+ ? (await _countryService.GetCountryById(model.CountryId))?.StateProvinces+ : new List<StateProvince>();+ if (states is { Count: > 0 })+ foreach (var s in states)+ model.AvailableStates.Add(new SelectListItem+ { Text = s.Name, Value = s.Id, Selected = s.Id == model.StateProvinceId });+ //customer attribute services+ await model.PrepareCustomAddressAttributes(address, _addressAttributeService, _addressAttributeParser);++ return model;+ }++ private async Task NotifyCustomer(MerchandiseReturn merchandiseReturn)+ {+ var order = await _orderService.GetOrderById(merchandiseReturn.OrderId);+ await _messageProviderService.SendMerchandiseReturnStatusChangedCustomerMessage(merchandiseReturn, order,+ _languageSettings.DefaultAdminLanguageId);+ }++ #region Fields++ private readonly IOrderService _orderService;+ private readonly IWorkContext _workContext;+ private readonly IProductService _productService;+ private readonly IDateTimeService _dateTimeService;+ private readonly ICustomerService _customerService;+ private readonly ITranslationService _translationService;+ private readonly IMessageProviderService _messageProviderService;+ private readonly LanguageSettings _languageSettings;+ private readonly IMerchandiseReturnService _merchandiseReturnService;+ private readonly IPriceFormatter _priceFormatter;+ private readonly AddressSettings _addressSettings;+ private readonly OrderSettings _orderSettings;+ private readonly ICountryService _countryService;+ private readonly IAddressAttributeService _addressAttributeService;+ private readonly IAddressAttributeParser _addressAttributeParser;++ #endregion Fields+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Services/OrderViewModelService.cs b/src/Web/Grand.Web.Vendor/Services/OrderViewModelService.csindex a7ccb64e4..7d54d1dd6 100644--- a/src/Web/Grand.Web.Vendor/Services/OrderViewModelService.cs+++ b/src/Web/Grand.Web.Vendor/Services/OrderViewModelService.cs@@ -25,554 +25,546 @@ using Grand.Web.Vendor.Models.Orders;using Microsoft.AspNetCore.Mvc.Rendering;using System.Net;-namespace Grand.Web.Vendor.Services+namespace Grand.Web.Vendor.Services;++public class OrderViewModelService : IOrderViewModelService{- public class OrderViewModelService : IOrderViewModelService+ #region Ctor++ public OrderViewModelService(IOrderService orderService,+ IDateTimeService dateTimeService,+ IPriceFormatter priceFormatter,+ ITranslationService translationService,+ IWorkContext workContext,+ ICurrencyService currencyService,+ IPaymentService paymentService,+ ICountryService countryService,+ IProductService productService,+ IGiftVoucherService giftVoucherService,+ IDownloadService downloadService,+ IStoreService storeService,+ IVendorService vendorService,+ IAddressAttributeParser addressAttributeParser,+ IPictureService pictureService,+ IMerchandiseReturnService merchandiseReturnService,+ ICustomerService customerService,+ IWarehouseService warehouseService,+ CurrencySettings currencySettings,+ TaxSettings taxSettings,+ AddressSettings addressSettings,+ IOrderTagService orderTagService,+ IOrderStatusService orderStatusService){- #region Fields-- private readonly IOrderService _orderService;- private readonly IDateTimeService _dateTimeService;- private readonly IPriceFormatter _priceFormatter;- private readonly ITranslationService _translationService;- private readonly IWorkContext _workContext;- private readonly ICurrencyService _currencyService;- private readonly IPaymentService _paymentService;- private readonly ICountryService _countryService;- private readonly IProductService _productService;- private readonly IGiftVoucherService _giftVoucherService;- private readonly IDownloadService _downloadService;- private readonly IStoreService _storeService;- private readonly IVendorService _vendorService;- private readonly IAddressAttributeParser _addressAttributeParser;- private readonly IPictureService _pictureService;- private readonly IMerchandiseReturnService _merchandiseReturnService;- private readonly ICustomerService _customerService;- private readonly IWarehouseService _warehouseService;- private readonly CurrencySettings _currencySettings;- private readonly TaxSettings _taxSettings;- private readonly AddressSettings _addressSettings;- private readonly IOrderTagService _orderTagService;- private readonly IOrderStatusService _orderStatusService;+ _orderService = orderService;+ _dateTimeService = dateTimeService;+ _priceFormatter = priceFormatter;+ _translationService = translationService;+ _workContext = workContext;+ _currencyService = currencyService;+ _paymentService = paymentService;+ _countryService = countryService;+ _productService = productService;+ _giftVoucherService = giftVoucherService;+ _downloadService = downloadService;+ _storeService = storeService;+ _vendorService = vendorService;+ _addressAttributeParser = addressAttributeParser;+ _pictureService = pictureService;+ _merchandiseReturnService = merchandiseReturnService;+ _warehouseService = warehouseService;+ _currencySettings = currencySettings;+ _taxSettings = taxSettings;+ _addressSettings = addressSettings;+ _customerService = customerService;+ _orderTagService = orderTagService;+ _orderStatusService = orderStatusService;+ }- #endregion+ #endregion- #region Ctor-- public OrderViewModelService(IOrderService orderService,- IDateTimeService dateTimeService,- IPriceFormatter priceFormatter,- ITranslationService translationService,- IWorkContext workContext,- ICurrencyService currencyService,- IPaymentService paymentService,- ICountryService countryService,- IProductService productService,- IGiftVoucherService giftVoucherService,- IDownloadService downloadService,- IStoreService storeService,- IVendorService vendorService,- IAddressAttributeParser addressAttributeParser,- IPictureService pictureService,- IMerchandiseReturnService merchandiseReturnService,- ICustomerService customerService,- IWarehouseService warehouseService,- CurrencySettings currencySettings,- TaxSettings taxSettings,- AddressSettings addressSettings,- IOrderTagService orderTagService,- IOrderStatusService orderStatusService)+ public virtual async Task<OrderListModel> PrepareOrderListModel(+ int? orderStatusId = null,+ int? paymentStatusId = null,+ int? shippingStatusId = null,+ DateTime? startDate = null,+ string code = null)+ {+ //order statuses+ var statuses = await _orderStatusService.GetAll();+ var model = new OrderListModel {+ AvailableOrderStatuses = statuses+ .Select(x => new SelectListItem { Value = x.StatusId.ToString(), Text = x.Name }).ToList()+ };+ model.AvailableOrderStatuses.Insert(0,+ new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = " " });+ if (orderStatusId.HasValue){- _orderService = orderService;- _dateTimeService = dateTimeService;- _priceFormatter = priceFormatter;- _translationService = translationService;- _workContext = workContext;- _currencyService = currencyService;- _paymentService = paymentService;- _countryService = countryService;- _productService = productService;- _giftVoucherService = giftVoucherService;- _downloadService = downloadService;- _storeService = storeService;- _vendorService = vendorService;- _addressAttributeParser = addressAttributeParser;- _pictureService = pictureService;- _merchandiseReturnService = merchandiseReturnService;- _warehouseService = warehouseService;- _currencySettings = currencySettings;- _taxSettings = taxSettings;- _addressSettings = addressSettings;- _customerService = customerService;- _orderTagService = orderTagService;- _orderStatusService = orderStatusService;+ //pre-select value?+ var item = model.AvailableOrderStatuses.FirstOrDefault(x => x.Value == orderStatusId.Value.ToString());+ if (item != null)+ item.Selected = true;}- #endregion+ //payment statuses+ model.AvailablePaymentStatuses =+ PaymentStatus.Pending.ToSelectList(_translationService, _workContext, false).ToList();+ model.AvailablePaymentStatuses.Insert(0,+ new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = " " });+ if (paymentStatusId.HasValue)+ {+ //pre-select value?+ var item = model.AvailablePaymentStatuses.FirstOrDefault(x =>+ x.Value == paymentStatusId.Value.ToString());+ if (item != null)+ item.Selected = true;+ }- public virtual async Task<OrderListModel> PrepareOrderListModel(- int? orderStatusId = null,- int? paymentStatusId = null,- int? shippingStatusId = null,- DateTime? startDate = null,- string code = null)+ //order's tags+ model.AvailableOrderTags.Add(new SelectListItem+ { Text = _translationService.GetResource("Vendor.Common.All"), Value = " " });+ foreach (var s in await _orderTagService.GetAllOrderTags())+ model.AvailableOrderTags.Add(new SelectListItem { Text = s.Name, Value = s.Id });++ //shipping statuses+ model.AvailableShippingStatuses =+ ShippingStatus.Pending.ToSelectList(_translationService, _workContext, false).ToList();+ model.AvailableShippingStatuses.Insert(0,+ new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = " " });+ if (shippingStatusId.HasValue){- //order statuses- var statuses = await _orderStatusService.GetAll();- var model = new OrderListModel {- AvailableOrderStatuses = statuses- .Select(x => new SelectListItem { Value = x.StatusId.ToString(), Text = x.Name }).ToList()- };- model.AvailableOrderStatuses.Insert(0,- new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = " " });- if (orderStatusId.HasValue)- {- //pre-select value?- var item = model.AvailableOrderStatuses.FirstOrDefault(x => x.Value == orderStatusId.Value.ToString());- if (item != null)- item.Selected = true;- }+ //pre-select value?+ var item = model.AvailableShippingStatuses.FirstOrDefault(x =>+ x.Value == shippingStatusId.Value.ToString());+ if (item != null)+ item.Selected = true;+ }- //payment statuses- model.AvailablePaymentStatuses =- PaymentStatus.Pending.ToSelectList(_translationService, _workContext, false).ToList();- model.AvailablePaymentStatuses.Insert(0,- new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = " " });- if (paymentStatusId.HasValue)- {- //pre-select value?- var item = model.AvailablePaymentStatuses.FirstOrDefault(x =>- x.Value == paymentStatusId.Value.ToString());- if (item != null)- item.Selected = true;- }+ //warehouses+ model.AvailableWarehouses.Add(new SelectListItem+ { Text = _translationService.GetResource("Vendor.Common.All"), Value = " " });+ foreach (var w in await _warehouseService.GetAllWarehouses())+ model.AvailableWarehouses.Add(new SelectListItem { Text = w.Name, Value = w.Id });- //order's tags- model.AvailableOrderTags.Add(new SelectListItem- { Text = _translationService.GetResource("Vendor.Common.All"), Value = " " });- foreach (var s in await _orderTagService.GetAllOrderTags())- {- model.AvailableOrderTags.Add(new SelectListItem { Text = s.Name, Value = s.Id });- }+ //payment methods+ model.AvailablePaymentMethods.Add(new SelectListItem+ { Text = _translationService.GetResource("Vendor.Common.All"), Value = " " });+ foreach (var pm in _paymentService.LoadAllPaymentMethods())+ model.AvailablePaymentMethods.Add(new SelectListItem { Text = pm.FriendlyName, Value = pm.SystemName });- //shipping statuses- model.AvailableShippingStatuses =- ShippingStatus.Pending.ToSelectList(_translationService, _workContext, false).ToList();- model.AvailableShippingStatuses.Insert(0,- new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = " " });- if (shippingStatusId.HasValue)- {- //pre-select value?- var item = model.AvailableShippingStatuses.FirstOrDefault(x =>- x.Value == shippingStatusId.Value.ToString());- if (item != null)- item.Selected = true;- }-- //warehouses- model.AvailableWarehouses.Add(new SelectListItem- { Text = _translationService.GetResource("Vendor.Common.All"), Value = " " });- foreach (var w in await _warehouseService.GetAllWarehouses())- model.AvailableWarehouses.Add(new SelectListItem { Text = w.Name, Value = w.Id });-- //payment methods- model.AvailablePaymentMethods.Add(new SelectListItem- { Text = _translationService.GetResource("Vendor.Common.All"), Value = " " });- foreach (var pm in _paymentService.LoadAllPaymentMethods())- model.AvailablePaymentMethods.Add(new SelectListItem { Text = pm.FriendlyName, Value = pm.SystemName });-- //billing countries- foreach (var c in await _countryService.GetAllCountriesForBilling(showHidden: true))- {- model.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id });- }+ //billing countries+ foreach (var c in await _countryService.GetAllCountriesForBilling(showHidden: true))+ model.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id });- model.AvailableCountries.Insert(0,- new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = " " });-- if (startDate.HasValue)- model.StartDate = startDate.Value;+ model.AvailableCountries.Insert(0,+ new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = " " });- if (!string.IsNullOrEmpty(code))- model.GoDirectlyToNumber = code;+ if (startDate.HasValue)+ model.StartDate = startDate.Value;- return model;- }+ if (!string.IsNullOrEmpty(code))+ model.GoDirectlyToNumber = code;- public virtual async Task<(IEnumerable<OrderModel> orderModels, int totalCount)> PrepareOrderModel(- OrderListModel model, int pageIndex, int pageSize)- {- DateTime? startDateValue = model.StartDate == null- ? null- : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);-- DateTime? endDateValue = model.EndDate == null- ? null- : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);-- int? orderStatus = model.OrderStatusId > 0 ? model.OrderStatusId : null;- PaymentStatus? paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)model.PaymentStatusId : null;- ShippingStatus? shippingStatus =- model.ShippingStatusId > 0 ? (ShippingStatus?)model.ShippingStatusId : null;-- //load orders- var orders = await _orderService.SearchOrders(- vendorId: _workContext.CurrentVendor.Id,- customerId: model.CustomerId,- productId: model.ProductId,- warehouseId: model.WarehouseId,- paymentMethodSystemName: model.PaymentMethodSystemName,- createdFromUtc: startDateValue,- createdToUtc: endDateValue,- os: orderStatus,- ps: paymentStatus,- ss: shippingStatus,- billingEmail: model.BillingEmail,- billingLastName: model.BillingLastName,- billingCountryId: model.BillingCountryId,- orderGuid: model.OrderGuid,- orderCode: model.GoDirectlyToNumber,- pageIndex: pageIndex - 1,- pageSize: pageSize,- orderTagId: model.OrderTag);-- var primaryStoreCurrency = await _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId);- if (primaryStoreCurrency == null)- throw new Exception("Cannot load primary store currency");-- var status = await _orderStatusService.GetAll();- var items = new List<OrderModel>();- foreach (var x in orders)- {- var store = await _storeService.GetStoreById(x.StoreId);- items.Add(new OrderModel {- Id = x.Id,- OrderNumber = x.OrderNumber,- Code = x.Code,- StoreName = store != null ? store.Shortcut : "Unknown",- CurrencyCode = x.CustomerCurrencyCode,- OrderStatus = status.FirstOrDefault(y => y.StatusId == x.OrderStatusId)?.Name,- OrderStatusId = x.OrderStatusId,- PaymentStatus = x.PaymentStatusId.GetTranslationEnum(_translationService, _workContext),- CustomerEmail = x.BillingAddress?.Email,- CustomerFullName = $"{x.BillingAddress?.FirstName} {x.BillingAddress?.LastName}",- CreatedOn = _dateTimeService.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc)- });- }+ return model;+ }- return (items, orders.TotalCount);- }- public virtual async Task PrepareOrderDetailsModel(OrderModel model, Order order)+ public virtual async Task<(IEnumerable<OrderModel> orderModels, int totalCount)> PrepareOrderModel(+ OrderListModel model, int pageIndex, int pageSize)+ {+ DateTime? startDateValue = model.StartDate == null+ ? null+ : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);++ DateTime? endDateValue = model.EndDate == null+ ? null+ : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);++ int? orderStatus = model.OrderStatusId > 0 ? model.OrderStatusId : null;+ var paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)model.PaymentStatusId : null;+ var shippingStatus =+ model.ShippingStatusId > 0 ? (ShippingStatus?)model.ShippingStatusId : null;++ //load orders+ var orders = await _orderService.SearchOrders(+ vendorId: _workContext.CurrentVendor.Id,+ customerId: model.CustomerId,+ productId: model.ProductId,+ warehouseId: model.WarehouseId,+ paymentMethodSystemName: model.PaymentMethodSystemName,+ createdFromUtc: startDateValue,+ createdToUtc: endDateValue,+ os: orderStatus,+ ps: paymentStatus,+ ss: shippingStatus,+ billingEmail: model.BillingEmail,+ billingLastName: model.BillingLastName,+ billingCountryId: model.BillingCountryId,+ orderGuid: model.OrderGuid,+ orderCode: model.GoDirectlyToNumber,+ pageIndex: pageIndex - 1,+ pageSize: pageSize,+ orderTagId: model.OrderTag);++ var primaryStoreCurrency = await _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId);+ if (primaryStoreCurrency == null)+ throw new Exception("Cannot load primary store currency");++ var status = await _orderStatusService.GetAll();+ var items = new List<OrderModel>();+ foreach (var x in orders){- ArgumentNullException.ThrowIfNull(order);- ArgumentNullException.ThrowIfNull(model);-- model.Id = order.Id;- model.OrderNumber = order.OrderNumber;- model.Code = order.Code;- model.OrderStatusId = order.OrderStatusId;- model.OrderGuid = order.OrderGuid;-- var status = await _orderStatusService.GetAll();- model.OrderStatus = status.FirstOrDefault(x => x.StatusId == order.OrderStatusId)?.Name;-- var store = await _storeService.GetStoreById(order.StoreId);- model.StoreName = store != null ? store.Shortcut : "Unknown";- model.UserFields = order.UserFields;-- var customer = await _customerService.GetCustomerById(order.CustomerId);- if (customer != null)- model.CustomerInfo = !string.IsNullOrEmpty(customer.Email)- ? customer.Email- : _translationService.GetResource("Vendor.Customers.Guest");-- model.VatNumber = order.VatNumber;- model.CreatedOn = _dateTimeService.ConvertToUserTime(order.CreatedOnUtc, DateTimeKind.Utc);- model.TaxDisplayType = _taxSettings.TaxDisplayType;-- #region Order totals-- var primaryStoreCurrency = await _currencyService.GetCurrencyByCode(order.PrimaryCurrencyCode) ??- await _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId);-- if (primaryStoreCurrency == null)- throw new Exception("Cannot load primary store currency");-- var orderCurrency = await _currencyService.GetCurrencyByCode(order.CustomerCurrencyCode);- if (orderCurrency == null)- throw new Exception("Cannot load order currency");-- model.CurrencyRate = order.CurrencyRate;- model.CurrencyCode = order.CustomerCurrencyCode;-- #endregion-- #region Payment info-- //payment method info- var pm = _paymentService.LoadPaymentMethodBySystemName(order.PaymentMethodSystemName);- model.PaymentMethod = pm != null ? pm.FriendlyName : order.PaymentMethodSystemName;- model.PaymentStatus = order.PaymentStatusId.GetTranslationEnum(_translationService, _workContext);- model.PaymentStatusEnum = order.PaymentStatusId;-- #endregion-- #region Billing & shipping info-- model.BillingAddress = await order.BillingAddress.ToModel(_countryService);- model.BillingAddress.FormattedCustomAddressAttributes =- await _addressAttributeParser.FormatAttributes(_workContext.WorkingLanguage,- order.BillingAddress.Attributes);- model.BillingAddress.NameEnabled = _addressSettings.NameEnabled;- model.BillingAddress.FirstNameEnabled = true;- model.BillingAddress.FirstNameRequired = true;- model.BillingAddress.LastNameEnabled = true;- model.BillingAddress.LastNameRequired = true;- model.BillingAddress.EmailEnabled = true;- model.BillingAddress.EmailRequired = true;- model.BillingAddress.CompanyEnabled = _addressSettings.CompanyEnabled;- model.BillingAddress.CompanyRequired = _addressSettings.CompanyRequired;- model.BillingAddress.VatNumberEnabled = _addressSettings.VatNumberEnabled;- model.BillingAddress.VatNumberRequired = _addressSettings.VatNumberRequired;- model.BillingAddress.CountryEnabled = _addressSettings.CountryEnabled;- model.BillingAddress.StateProvinceEnabled = _addressSettings.StateProvinceEnabled;- model.BillingAddress.CityEnabled = _addressSettings.CityEnabled;- model.BillingAddress.CityRequired = _addressSettings.CityRequired;- model.BillingAddress.StreetAddressEnabled = _addressSettings.StreetAddressEnabled;- model.BillingAddress.StreetAddressRequired = _addressSettings.StreetAddressRequired;- model.BillingAddress.StreetAddress2Enabled = _addressSettings.StreetAddress2Enabled;- model.BillingAddress.StreetAddress2Required = _addressSettings.StreetAddress2Required;- model.BillingAddress.ZipPostalCodeEnabled = _addressSettings.ZipPostalCodeEnabled;- model.BillingAddress.ZipPostalCodeRequired = _addressSettings.ZipPostalCodeRequired;- model.BillingAddress.PhoneEnabled = _addressSettings.PhoneEnabled;- model.BillingAddress.PhoneRequired = _addressSettings.PhoneRequired;- model.BillingAddress.FaxEnabled = _addressSettings.FaxEnabled;- model.BillingAddress.FaxRequired = _addressSettings.FaxRequired;- model.BillingAddress.NoteEnabled = _addressSettings.NoteEnabled;-- if (order.ShippingStatusId != ShippingStatus.ShippingNotRequired)- {- model.IsShippable = true;+ var store = await _storeService.GetStoreById(x.StoreId);+ items.Add(new OrderModel {+ Id = x.Id,+ OrderNumber = x.OrderNumber,+ Code = x.Code,+ StoreName = store != null ? store.Shortcut : "Unknown",+ CurrencyCode = x.CustomerCurrencyCode,+ OrderStatus = status.FirstOrDefault(y => y.StatusId == x.OrderStatusId)?.Name,+ OrderStatusId = x.OrderStatusId,+ PaymentStatus = x.PaymentStatusId.GetTranslationEnum(_translationService, _workContext),+ CustomerEmail = x.BillingAddress?.Email,+ CustomerFullName = $"{x.BillingAddress?.FirstName} {x.BillingAddress?.LastName}",+ CreatedOn = _dateTimeService.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc)+ });+ }- model.PickUpInStore = order.PickUpInStore;- if (!order.PickUpInStore)- {- if (order.ShippingAddress != null)- {- model.ShippingAddress = await order.ShippingAddress.ToModel(_countryService);- model.ShippingAddress.FormattedCustomAddressAttributes =- await _addressAttributeParser.FormatAttributes(_workContext.WorkingLanguage,- order.ShippingAddress.Attributes);- model.ShippingAddress.NameEnabled = _addressSettings.NameEnabled;- model.ShippingAddress.FirstNameEnabled = true;- model.ShippingAddress.FirstNameRequired = true;- model.ShippingAddress.LastNameEnabled = true;- model.ShippingAddress.LastNameRequired = true;- model.ShippingAddress.EmailEnabled = true;- model.ShippingAddress.EmailRequired = true;- model.ShippingAddress.CompanyEnabled = _addressSettings.CompanyEnabled;- model.ShippingAddress.CompanyRequired = _addressSettings.CompanyRequired;- model.ShippingAddress.VatNumberEnabled = _addressSettings.VatNumberEnabled;- model.ShippingAddress.VatNumberRequired = _addressSettings.VatNumberRequired;- model.ShippingAddress.CountryEnabled = _addressSettings.CountryEnabled;- model.ShippingAddress.StateProvinceEnabled = _addressSettings.StateProvinceEnabled;- model.ShippingAddress.CityEnabled = _addressSettings.CityEnabled;- model.ShippingAddress.CityRequired = _addressSettings.CityRequired;- model.ShippingAddress.StreetAddressEnabled = _addressSettings.StreetAddressEnabled;- model.ShippingAddress.StreetAddressRequired = _addressSettings.StreetAddressRequired;- model.ShippingAddress.StreetAddress2Enabled = _addressSettings.StreetAddress2Enabled;- model.ShippingAddress.StreetAddress2Required = _addressSettings.StreetAddress2Required;- model.ShippingAddress.ZipPostalCodeEnabled = _addressSettings.ZipPostalCodeEnabled;- model.ShippingAddress.ZipPostalCodeRequired = _addressSettings.ZipPostalCodeRequired;- model.ShippingAddress.PhoneEnabled = _addressSettings.PhoneEnabled;- model.ShippingAddress.PhoneRequired = _addressSettings.PhoneRequired;- model.ShippingAddress.FaxEnabled = _addressSettings.FaxEnabled;- model.ShippingAddress.FaxRequired = _addressSettings.FaxRequired;- model.ShippingAddress.NoteEnabled = _addressSettings.NoteEnabled;-- model.ShippingAddressGoogleMapsUrl =- $"https://maps.google.com/maps?f=q&hl=en&ie=UTF8&oe=UTF8&geocode=&q={WebUtility.UrlEncode(order.ShippingAddress.Address1 + " " + order.ShippingAddress.ZipPostalCode + " " + order.ShippingAddress.City + " " + (!string.IsNullOrEmpty(order.ShippingAddress.CountryId) ? (await _countryService.GetCountryById(order.ShippingAddress.CountryId))?.Name : ""))}";- }- }- else- {- if (order.PickupPoint is { Address: not null })- {- model.PickupAddress = await order.PickupPoint.Address.ToModel(_countryService);- var country = await _countryService.GetCountryById(order.PickupPoint.Address.CountryId);- if (country != null)- model.PickupAddress.CountryName = country.Name;- }- }+ return (items, orders.TotalCount);+ }- model.ShippingMethod = order.ShippingMethod;- model.ShippingAdditionDescription = order.ShippingOptionAttributeDescription;- model.CanAddNewShipments = false;+ public virtual async Task PrepareOrderDetailsModel(OrderModel model, Order order)+ {+ ArgumentNullException.ThrowIfNull(order);+ ArgumentNullException.ThrowIfNull(model);- foreach (var orderItem in order.OrderItems)- {- //we can ship only shippable products- if (!orderItem.IsShipEnabled)- continue;+ model.Id = order.Id;+ model.OrderNumber = order.OrderNumber;+ model.Code = order.Code;+ model.OrderStatusId = order.OrderStatusId;+ model.OrderGuid = order.OrderGuid;- if (orderItem.OpenQty <= 0)- continue;+ var status = await _orderStatusService.GetAll();+ model.OrderStatus = status.FirstOrDefault(x => x.StatusId == order.OrderStatusId)?.Name;- model.CanAddNewShipments = true;- }- }+ var store = await _storeService.GetStoreById(order.StoreId);+ model.StoreName = store != null ? store.Shortcut : "Unknown";+ model.UserFields = order.UserFields;++ var customer = await _customerService.GetCustomerById(order.CustomerId);+ if (customer != null)+ model.CustomerInfo = !string.IsNullOrEmpty(customer.Email)+ ? customer.Email+ : _translationService.GetResource("Vendor.Customers.Guest");- #endregion+ model.VatNumber = order.VatNumber;+ model.CreatedOn = _dateTimeService.ConvertToUserTime(order.CreatedOnUtc, DateTimeKind.Utc);+ model.TaxDisplayType = _taxSettings.TaxDisplayType;- #region Products+ #region Order totals- model.CheckoutAttributeInfo = order.CheckoutAttributeDescription;- var hasDownloadableItems = false;- var products = order.OrderItems- .Where(orderItem => orderItem.VendorId == _workContext.CurrentVendor.Id)- .ToList();+ var primaryStoreCurrency = await _currencyService.GetCurrencyByCode(order.PrimaryCurrencyCode) ??+ await _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId);- foreach (var orderItem in products)+ if (primaryStoreCurrency == null)+ throw new Exception("Cannot load primary store currency");++ var orderCurrency = await _currencyService.GetCurrencyByCode(order.CustomerCurrencyCode);+ if (orderCurrency == null)+ throw new Exception("Cannot load order currency");++ model.CurrencyRate = order.CurrencyRate;+ model.CurrencyCode = order.CustomerCurrencyCode;++ #endregion++ #region Payment info++ //payment method info+ var pm = _paymentService.LoadPaymentMethodBySystemName(order.PaymentMethodSystemName);+ model.PaymentMethod = pm != null ? pm.FriendlyName : order.PaymentMethodSystemName;+ model.PaymentStatus = order.PaymentStatusId.GetTranslationEnum(_translationService, _workContext);+ model.PaymentStatusEnum = order.PaymentStatusId;++ #endregion++ #region Billing & shipping info++ model.BillingAddress = await order.BillingAddress.ToModel(_countryService);+ model.BillingAddress.FormattedCustomAddressAttributes =+ await _addressAttributeParser.FormatAttributes(_workContext.WorkingLanguage,+ order.BillingAddress.Attributes);+ model.BillingAddress.NameEnabled = _addressSettings.NameEnabled;+ model.BillingAddress.FirstNameEnabled = true;+ model.BillingAddress.FirstNameRequired = true;+ model.BillingAddress.LastNameEnabled = true;+ model.BillingAddress.LastNameRequired = true;+ model.BillingAddress.EmailEnabled = true;+ model.BillingAddress.EmailRequired = true;+ model.BillingAddress.CompanyEnabled = _addressSettings.CompanyEnabled;+ model.BillingAddress.CompanyRequired = _addressSettings.CompanyRequired;+ model.BillingAddress.VatNumberEnabled = _addressSettings.VatNumberEnabled;+ model.BillingAddress.VatNumberRequired = _addressSettings.VatNumberRequired;+ model.BillingAddress.CountryEnabled = _addressSettings.CountryEnabled;+ model.BillingAddress.StateProvinceEnabled = _addressSettings.StateProvinceEnabled;+ model.BillingAddress.CityEnabled = _addressSettings.CityEnabled;+ model.BillingAddress.CityRequired = _addressSettings.CityRequired;+ model.BillingAddress.StreetAddressEnabled = _addressSettings.StreetAddressEnabled;+ model.BillingAddress.StreetAddressRequired = _addressSettings.StreetAddressRequired;+ model.BillingAddress.StreetAddress2Enabled = _addressSettings.StreetAddress2Enabled;+ model.BillingAddress.StreetAddress2Required = _addressSettings.StreetAddress2Required;+ model.BillingAddress.ZipPostalCodeEnabled = _addressSettings.ZipPostalCodeEnabled;+ model.BillingAddress.ZipPostalCodeRequired = _addressSettings.ZipPostalCodeRequired;+ model.BillingAddress.PhoneEnabled = _addressSettings.PhoneEnabled;+ model.BillingAddress.PhoneRequired = _addressSettings.PhoneRequired;+ model.BillingAddress.FaxEnabled = _addressSettings.FaxEnabled;+ model.BillingAddress.FaxRequired = _addressSettings.FaxRequired;+ model.BillingAddress.NoteEnabled = _addressSettings.NoteEnabled;++ if (order.ShippingStatusId != ShippingStatus.ShippingNotRequired)+ {+ model.IsShippable = true;++ model.PickUpInStore = order.PickUpInStore;+ if (!order.PickUpInStore){- var product = await _productService.GetProductByIdIncludeArch(orderItem.ProductId);-- if (product == null) continue;-- if (product.IsDownload)- hasDownloadableItems = true;-- var orderItemModel = new OrderModel.OrderItemModel {- Id = orderItem.Id,- ProductId = orderItem.ProductId,- ProductName = product.Name,- Sku = orderItem.Sku,- Quantity = orderItem.Quantity,- OpenQty = orderItem.OpenQty,- CancelQty = orderItem.CancelQty,- ReturnQty = orderItem.ReturnQty,- ShipQty = orderItem.ShipQty,- IsDownload = product.IsDownload,- DownloadCount = orderItem.DownloadCount,- DownloadActivationType = product.DownloadActivationTypeId,- IsDownloadActivated = orderItem.IsDownloadActivated- };- //picture- var orderItemPicture =- await product.GetProductPicture(orderItem.Attributes, _productService, _pictureService);- orderItemModel.PictureThumbnailUrl = await _pictureService.GetPictureUrl(orderItemPicture, 75);-- //license file- if (!string.IsNullOrEmpty(orderItem.LicenseDownloadId))+ if (order.ShippingAddress != null){- var licenseDownload = await _downloadService.GetDownloadById(orderItem.LicenseDownloadId);- if (licenseDownload != null)- {- orderItemModel.LicenseDownloadGuid = licenseDownload.DownloadGuid;- }+ model.ShippingAddress = await order.ShippingAddress.ToModel(_countryService);+ model.ShippingAddress.FormattedCustomAddressAttributes =+ await _addressAttributeParser.FormatAttributes(_workContext.WorkingLanguage,+ order.ShippingAddress.Attributes);+ model.ShippingAddress.NameEnabled = _addressSettings.NameEnabled;+ model.ShippingAddress.FirstNameEnabled = true;+ model.ShippingAddress.FirstNameRequired = true;+ model.ShippingAddress.LastNameEnabled = true;+ model.ShippingAddress.LastNameRequired = true;+ model.ShippingAddress.EmailEnabled = true;+ model.ShippingAddress.EmailRequired = true;+ model.ShippingAddress.CompanyEnabled = _addressSettings.CompanyEnabled;+ model.ShippingAddress.CompanyRequired = _addressSettings.CompanyRequired;+ model.ShippingAddress.VatNumberEnabled = _addressSettings.VatNumberEnabled;+ model.ShippingAddress.VatNumberRequired = _addressSettings.VatNumberRequired;+ model.ShippingAddress.CountryEnabled = _addressSettings.CountryEnabled;+ model.ShippingAddress.StateProvinceEnabled = _addressSettings.StateProvinceEnabled;+ model.ShippingAddress.CityEnabled = _addressSettings.CityEnabled;+ model.ShippingAddress.CityRequired = _addressSettings.CityRequired;+ model.ShippingAddress.StreetAddressEnabled = _addressSettings.StreetAddressEnabled;+ model.ShippingAddress.StreetAddressRequired = _addressSettings.StreetAddressRequired;+ model.ShippingAddress.StreetAddress2Enabled = _addressSettings.StreetAddress2Enabled;+ model.ShippingAddress.StreetAddress2Required = _addressSettings.StreetAddress2Required;+ model.ShippingAddress.ZipPostalCodeEnabled = _addressSettings.ZipPostalCodeEnabled;+ model.ShippingAddress.ZipPostalCodeRequired = _addressSettings.ZipPostalCodeRequired;+ model.ShippingAddress.PhoneEnabled = _addressSettings.PhoneEnabled;+ model.ShippingAddress.PhoneRequired = _addressSettings.PhoneRequired;+ model.ShippingAddress.FaxEnabled = _addressSettings.FaxEnabled;+ model.ShippingAddress.FaxRequired = _addressSettings.FaxRequired;+ model.ShippingAddress.NoteEnabled = _addressSettings.NoteEnabled;++ model.ShippingAddressGoogleMapsUrl =+ $"https://maps.google.com/maps?f=q&hl=en&ie=UTF8&oe=UTF8&geocode=&q={WebUtility.UrlEncode(order.ShippingAddress.Address1 + " " + order.ShippingAddress.ZipPostalCode + " " + order.ShippingAddress.City + " " + (!string.IsNullOrEmpty(order.ShippingAddress.CountryId) ? (await _countryService.GetCountryById(order.ShippingAddress.CountryId))?.Name : ""))}";}-- //vendor- var vendor = await _vendorService.GetVendorById(orderItem.VendorId);- orderItemModel.VendorName = vendor != null ? vendor.Name : "";-- //unit price- orderItemModel.UnitPriceInclTaxValue = orderItem.UnitPriceInclTax;- orderItemModel.UnitPriceExclTaxValue = orderItem.UnitPriceExclTax;- orderItemModel.UnitPriceInclTax =- _priceFormatter.FormatPrice(orderItem.UnitPriceInclTax, orderCurrency);- orderItemModel.UnitPriceExclTax =- _priceFormatter.FormatPrice(orderItem.UnitPriceExclTax, orderCurrency);- //discounts- orderItemModel.DiscountInclTaxValue = orderItem.DiscountAmountInclTax;- orderItemModel.DiscountExclTaxValue = orderItem.DiscountAmountExclTax;- orderItemModel.DiscountInclTax =- _priceFormatter.FormatPrice(orderItem.DiscountAmountInclTax, orderCurrency);- orderItemModel.DiscountExclTax =- _priceFormatter.FormatPrice(orderItem.DiscountAmountExclTax, orderCurrency);- //subtotal- orderItemModel.SubTotalInclTaxValue = orderItem.PriceInclTax;- orderItemModel.SubTotalExclTaxValue = orderItem.PriceExclTax;- orderItemModel.SubTotalInclTax = _priceFormatter.FormatPrice(orderItem.PriceInclTax, orderCurrency);- orderItemModel.SubTotalExclTax = _priceFormatter.FormatPrice(orderItem.PriceExclTax, orderCurrency);-- if (order.PrimaryCurrencyCode != order.CustomerCurrencyCode)+ }+ else+ {+ if (order.PickupPoint is { Address: not null }){- orderItemModel.UnitPriceInclTax +=- $" ({_priceFormatter.FormatPrice(orderItem.UnitPriceInclTax / order.CurrencyRate, primaryStoreCurrency)})";- orderItemModel.UnitPriceExclTax +=- $" ({_priceFormatter.FormatPrice(orderItem.UnitPriceExclTax / order.CurrencyRate, primaryStoreCurrency)})";- orderItemModel.DiscountInclTax +=- $" ({_priceFormatter.FormatPrice(orderItem.DiscountAmountInclTax / order.CurrencyRate, primaryStoreCurrency)})";- orderItemModel.DiscountExclTax +=- $" ({_priceFormatter.FormatPrice(orderItem.DiscountAmountExclTax / order.CurrencyRate, primaryStoreCurrency)})";- orderItemModel.SubTotalInclTax +=- $" ({_priceFormatter.FormatPrice(orderItem.PriceInclTax / order.CurrencyRate, primaryStoreCurrency)})";- orderItemModel.SubTotalExclTax +=- $" ({_priceFormatter.FormatPrice(orderItem.PriceExclTax / order.CurrencyRate, primaryStoreCurrency)})";+ model.PickupAddress = await order.PickupPoint.Address.ToModel(_countryService);+ var country = await _countryService.GetCountryById(order.PickupPoint.Address.CountryId);+ if (country != null)+ model.PickupAddress.CountryName = country.Name;}-- // commission- orderItemModel.CommissionValue = orderItem.Commission;- orderItemModel.Commission = _priceFormatter.FormatPrice(orderItem.Commission, orderCurrency);-- orderItemModel.AttributeInfo = orderItem.AttributeDescription;- if (product.IsRecurring)- orderItemModel.RecurringInfo = string.Format(- _translationService.GetResource("Vendor.Orders.Products.RecurringPeriod"),- product.RecurringCycleLength,- product.RecurringCyclePeriodId.GetTranslationEnum(_translationService, _workContext),- product.RecurringTotalCycles);-- //merchandise returns- orderItemModel.MerchandiseReturnIds =- (await _merchandiseReturnService.SearchMerchandiseReturns(orderItemId: orderItem.Id))- .Select(rr => rr.Id).ToList();- //gift vouchers- orderItemModel.PurchasedGiftVoucherIds =- (await _giftVoucherService.GetGiftVouchersByPurchasedWithOrderItemId(orderItem.Id))- .Select(gc => gc.Id).ToList();-- model.Items.Add(orderItemModel);}- model.HasDownloadableProducts = hasDownloadableItems;+ model.ShippingMethod = order.ShippingMethod;+ model.ShippingAdditionDescription = order.ShippingOptionAttributeDescription;+ model.CanAddNewShipments = false;- #endregion+ foreach (var orderItem in order.OrderItems)+ {+ //we can ship only shippable products+ if (!orderItem.IsShipEnabled)+ continue;++ if (orderItem.OpenQty <= 0)+ continue;++ model.CanAddNewShipments = true;+ }}-- public virtual async Task<IList<Order>> PrepareOrders(OrderListModel model)++ #endregion++ #region Products++ model.CheckoutAttributeInfo = order.CheckoutAttributeDescription;+ var hasDownloadableItems = false;+ var products = order.OrderItems+ .Where(orderItem => orderItem.VendorId == _workContext.CurrentVendor.Id)+ .ToList();++ foreach (var orderItem in products){- DateTime? startDateValue = model.StartDate == null- ? null- : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);-- DateTime? endDateValue = model.EndDate == null- ? null- : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);-- int? orderStatus = model.OrderStatusId > 0 ? model.OrderStatusId : null;- PaymentStatus? paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)model.PaymentStatusId : null;- ShippingStatus? shippingStatus =- model.ShippingStatusId > 0 ? (ShippingStatus?)model.ShippingStatusId : null;-- //load orders- var orders = await _orderService.SearchOrders(- vendorId: _workContext.CurrentVendor.Id,- productId: model.ProductId,- warehouseId: model.WarehouseId,- paymentMethodSystemName: model.PaymentMethodSystemName,- createdFromUtc: startDateValue,- createdToUtc: endDateValue,- os: orderStatus,- ps: paymentStatus,- ss: shippingStatus,- billingEmail: model.BillingEmail,- billingLastName: model.BillingLastName,- billingCountryId: model.BillingCountryId,- orderGuid: model.OrderGuid);-- return orders;+ var product = await _productService.GetProductByIdIncludeArch(orderItem.ProductId);++ if (product == null) continue;++ if (product.IsDownload)+ hasDownloadableItems = true;++ var orderItemModel = new OrderModel.OrderItemModel {+ Id = orderItem.Id,+ ProductId = orderItem.ProductId,+ ProductName = product.Name,+ Sku = orderItem.Sku,+ Quantity = orderItem.Quantity,+ OpenQty = orderItem.OpenQty,+ CancelQty = orderItem.CancelQty,+ ReturnQty = orderItem.ReturnQty,+ ShipQty = orderItem.ShipQty,+ IsDownload = product.IsDownload,+ DownloadCount = orderItem.DownloadCount,+ DownloadActivationType = product.DownloadActivationTypeId,+ IsDownloadActivated = orderItem.IsDownloadActivated+ };+ //picture+ var orderItemPicture =+ await product.GetProductPicture(orderItem.Attributes, _productService, _pictureService);+ orderItemModel.PictureThumbnailUrl = await _pictureService.GetPictureUrl(orderItemPicture, 75);++ //license file+ if (!string.IsNullOrEmpty(orderItem.LicenseDownloadId))+ {+ var licenseDownload = await _downloadService.GetDownloadById(orderItem.LicenseDownloadId);+ if (licenseDownload != null) orderItemModel.LicenseDownloadGuid = licenseDownload.DownloadGuid;+ }++ //vendor+ var vendor = await _vendorService.GetVendorById(orderItem.VendorId);+ orderItemModel.VendorName = vendor != null ? vendor.Name : "";++ //unit price+ orderItemModel.UnitPriceInclTaxValue = orderItem.UnitPriceInclTax;+ orderItemModel.UnitPriceExclTaxValue = orderItem.UnitPriceExclTax;+ orderItemModel.UnitPriceInclTax =+ _priceFormatter.FormatPrice(orderItem.UnitPriceInclTax, orderCurrency);+ orderItemModel.UnitPriceExclTax =+ _priceFormatter.FormatPrice(orderItem.UnitPriceExclTax, orderCurrency);+ //discounts+ orderItemModel.DiscountInclTaxValue = orderItem.DiscountAmountInclTax;+ orderItemModel.DiscountExclTaxValue = orderItem.DiscountAmountExclTax;+ orderItemModel.DiscountInclTax =+ _priceFormatter.FormatPrice(orderItem.DiscountAmountInclTax, orderCurrency);+ orderItemModel.DiscountExclTax =+ _priceFormatter.FormatPrice(orderItem.DiscountAmountExclTax, orderCurrency);+ //subtotal+ orderItemModel.SubTotalInclTaxValue = orderItem.PriceInclTax;+ orderItemModel.SubTotalExclTaxValue = orderItem.PriceExclTax;+ orderItemModel.SubTotalInclTax = _priceFormatter.FormatPrice(orderItem.PriceInclTax, orderCurrency);+ orderItemModel.SubTotalExclTax = _priceFormatter.FormatPrice(orderItem.PriceExclTax, orderCurrency);++ if (order.PrimaryCurrencyCode != order.CustomerCurrencyCode)+ {+ orderItemModel.UnitPriceInclTax +=+ $" ({_priceFormatter.FormatPrice(orderItem.UnitPriceInclTax / order.CurrencyRate, primaryStoreCurrency)})";+ orderItemModel.UnitPriceExclTax +=+ $" ({_priceFormatter.FormatPrice(orderItem.UnitPriceExclTax / order.CurrencyRate, primaryStoreCurrency)})";+ orderItemModel.DiscountInclTax +=+ $" ({_priceFormatter.FormatPrice(orderItem.DiscountAmountInclTax / order.CurrencyRate, primaryStoreCurrency)})";+ orderItemModel.DiscountExclTax +=+ $" ({_priceFormatter.FormatPrice(orderItem.DiscountAmountExclTax / order.CurrencyRate, primaryStoreCurrency)})";+ orderItemModel.SubTotalInclTax +=+ $" ({_priceFormatter.FormatPrice(orderItem.PriceInclTax / order.CurrencyRate, primaryStoreCurrency)})";+ orderItemModel.SubTotalExclTax +=+ $" ({_priceFormatter.FormatPrice(orderItem.PriceExclTax / order.CurrencyRate, primaryStoreCurrency)})";+ }++ // commission+ orderItemModel.CommissionValue = orderItem.Commission;+ orderItemModel.Commission = _priceFormatter.FormatPrice(orderItem.Commission, orderCurrency);++ orderItemModel.AttributeInfo = orderItem.AttributeDescription;+ if (product.IsRecurring)+ orderItemModel.RecurringInfo = string.Format(+ _translationService.GetResource("Vendor.Orders.Products.RecurringPeriod"),+ product.RecurringCycleLength,+ product.RecurringCyclePeriodId.GetTranslationEnum(_translationService, _workContext),+ product.RecurringTotalCycles);++ //merchandise returns+ orderItemModel.MerchandiseReturnIds =+ (await _merchandiseReturnService.SearchMerchandiseReturns(orderItemId: orderItem.Id))+ .Select(rr => rr.Id).ToList();+ //gift vouchers+ orderItemModel.PurchasedGiftVoucherIds =+ (await _giftVoucherService.GetGiftVouchersByPurchasedWithOrderItemId(orderItem.Id))+ .Select(gc => gc.Id).ToList();++ model.Items.Add(orderItemModel);}+ model.HasDownloadableProducts = hasDownloadableItems;++ #endregion}++ public virtual async Task<IList<Order>> PrepareOrders(OrderListModel model)+ {+ DateTime? startDateValue = model.StartDate == null+ ? null+ : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);++ DateTime? endDateValue = model.EndDate == null+ ? null+ : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);++ int? orderStatus = model.OrderStatusId > 0 ? model.OrderStatusId : null;+ var paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)model.PaymentStatusId : null;+ var shippingStatus =+ model.ShippingStatusId > 0 ? (ShippingStatus?)model.ShippingStatusId : null;++ //load orders+ var orders = await _orderService.SearchOrders(+ vendorId: _workContext.CurrentVendor.Id,+ productId: model.ProductId,+ warehouseId: model.WarehouseId,+ paymentMethodSystemName: model.PaymentMethodSystemName,+ createdFromUtc: startDateValue,+ createdToUtc: endDateValue,+ os: orderStatus,+ ps: paymentStatus,+ ss: shippingStatus,+ billingEmail: model.BillingEmail,+ billingLastName: model.BillingLastName,+ billingCountryId: model.BillingCountryId,+ orderGuid: model.OrderGuid);++ return orders;+ }++ #region Fields++ private readonly IOrderService _orderService;+ private readonly IDateTimeService _dateTimeService;+ private readonly IPriceFormatter _priceFormatter;+ private readonly ITranslationService _translationService;+ private readonly IWorkContext _workContext;+ private readonly ICurrencyService _currencyService;+ private readonly IPaymentService _paymentService;+ private readonly ICountryService _countryService;+ private readonly IProductService _productService;+ private readonly IGiftVoucherService _giftVoucherService;+ private readonly IDownloadService _downloadService;+ private readonly IStoreService _storeService;+ private readonly IVendorService _vendorService;+ private readonly IAddressAttributeParser _addressAttributeParser;+ private readonly IPictureService _pictureService;+ private readonly IMerchandiseReturnService _merchandiseReturnService;+ private readonly ICustomerService _customerService;+ private readonly IWarehouseService _warehouseService;+ private readonly CurrencySettings _currencySettings;+ private readonly TaxSettings _taxSettings;+ private readonly AddressSettings _addressSettings;+ private readonly IOrderTagService _orderTagService;+ private readonly IOrderStatusService _orderStatusService;++ #endregion}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Services/ProductViewModelService.cs b/src/Web/Grand.Web.Vendor/Services/ProductViewModelService.csindex d19379645..d44c75e79 100644--- a/src/Web/Grand.Web.Vendor/Services/ProductViewModelService.cs+++ b/src/Web/Grand.Web.Vendor/Services/ProductViewModelService.cs@@ -21,1676 +21,1502 @@ using Grand.Domain.Seo;using Grand.Domain.Tax;using Grand.Infrastructure;using Grand.SharedKernel.Extensions;-using Grand.Web.Vendor.Interfaces;-using Grand.Web.Vendor.Models.Catalog;using Grand.Web.Common.Extensions;using Grand.Web.Vendor.Extensions;+using Grand.Web.Vendor.Interfaces;+using Grand.Web.Vendor.Models.Catalog;using Microsoft.AspNetCore.Mvc.Rendering;+using System.Net;+using ProductExtensions = Grand.Domain.Catalog.ProductExtensions;-namespace Grand.Web.Vendor.Services-{- public class ProductViewModelService : IProductViewModelService- {- private readonly IProductService _productService;- private readonly IInventoryManageService _inventoryManageService;- private readonly IPictureService _pictureService;- private readonly IProductAttributeService _productAttributeService;- private readonly ICurrencyService _currencyService;- private readonly IMeasureService _measureService;- private readonly IDateTimeService _dateTimeService;- private readonly ICollectionService _collectionService;- private readonly IProductCollectionService _productCollectionService;- private readonly ICategoryService _categoryService;- private readonly IProductCategoryService _productCategoryService;- private readonly ITranslationService _translationService;- private readonly IProductLayoutService _productLayoutService;- private readonly ISpecificationAttributeService _specificationAttributeService;- private readonly IWorkContext _workContext;- private readonly IWarehouseService _warehouseService;- private readonly IDeliveryDateService _deliveryDateService;- private readonly ITaxCategoryService _taxCategoryService;- private readonly ICustomerService _customerService;- private readonly IStoreService _storeService;- private readonly ISlugService _slugService;- private readonly IOutOfStockSubscriptionService _outOfStockSubscriptionService;- private readonly IStockQuantityService _stockQuantityService;- private readonly ILanguageService _languageService;- private readonly IProductAttributeFormatter _productAttributeFormatter;- private readonly IAuctionService _auctionService;- private readonly IPriceFormatter _priceFormatter;- private readonly CurrencySettings _currencySettings;- private readonly MeasureSettings _measureSettings;- private readonly TaxSettings _taxSettings;- private readonly SeoSettings _seoSettings;-- public ProductViewModelService(- IProductService productService,- IInventoryManageService inventoryManageService,- IPictureService pictureService,- IProductAttributeService productAttributeService,- ICurrencyService currencyService,- IMeasureService measureService,- IDateTimeService dateTimeService,- ICollectionService collectionService,- IProductCollectionService productCollectionService,- ICategoryService categoryService,- IProductCategoryService productCategoryService,- ITranslationService translationService,- IProductLayoutService productLayoutService,- ISpecificationAttributeService specificationAttributeService,- IWorkContext workContext,- IWarehouseService warehouseService,- IDeliveryDateService deliveryDateService,- ITaxCategoryService taxCategoryService,- ICustomerService customerService,- IStoreService storeService,- ISlugService slugService,- IOutOfStockSubscriptionService outOfStockSubscriptionService,- ILanguageService languageService,- IProductAttributeFormatter productAttributeFormatter,- IStockQuantityService stockQuantityService,- IAuctionService auctionService,- IPriceFormatter priceFormatter,- CurrencySettings currencySettings,- MeasureSettings measureSettings,- TaxSettings taxSettings, SeoSettings seoSettings)- {- _productService = productService;- _inventoryManageService = inventoryManageService;- _pictureService = pictureService;- _productAttributeService = productAttributeService;- _currencyService = currencyService;- _measureService = measureService;- _dateTimeService = dateTimeService;- _collectionService = collectionService;- _productCollectionService = productCollectionService;- _categoryService = categoryService;- _productCategoryService = productCategoryService;- _translationService = translationService;- _productLayoutService = productLayoutService;- _specificationAttributeService = specificationAttributeService;- _workContext = workContext;- _warehouseService = warehouseService;- _deliveryDateService = deliveryDateService;- _taxCategoryService = taxCategoryService;- _customerService = customerService;- _storeService = storeService;- _slugService = slugService;- _outOfStockSubscriptionService = outOfStockSubscriptionService;- _stockQuantityService = stockQuantityService;- _languageService = languageService;- _productAttributeFormatter = productAttributeFormatter;- _auctionService = auctionService;- _priceFormatter = priceFormatter;- _currencySettings = currencySettings;- _measureSettings = measureSettings;- _taxSettings = taxSettings;- _seoSettings = seoSettings;- }-- protected virtual async Task UpdatePictureSeoNames(Product product)- {- var picturesename = _pictureService.GetPictureSeName(product.Name);- foreach (var pp in product.ProductPictures)- {- var picture = await _pictureService.GetPictureById(pp.PictureId);- if (picture != null)- await _pictureService.SetSeoFilename(picture, picturesename);- }- }-- protected virtual async Task<List<string>> GetChildCategoryIds(string parentCategoryId)- {- var categoriesIds = new List<string>();- var categories = await _categoryService.GetAllCategoriesByParentCategoryId(parentCategoryId, true);- foreach (var category in categories)- {- categoriesIds.Add(category.Id);- categoriesIds.AddRange(await GetChildCategoryIds(category.Id));- }-- return categoriesIds;- }+namespace Grand.Web.Vendor.Services;- protected virtual T PrepareAddProductModel<T>() where T : ProductModel.AddProductModel, new()- {- var model = new T {- //product types- AvailableProductTypes = ProductType.SimpleProduct- .ToSelectList(_translationService, _workContext, false).ToList()- };+public class ProductViewModelService : IProductViewModelService+{+ private readonly IAuctionService _auctionService;+ private readonly ICategoryService _categoryService;+ private readonly ICollectionService _collectionService;+ private readonly ICurrencyService _currencyService;+ private readonly CurrencySettings _currencySettings;+ private readonly ICustomerService _customerService;+ private readonly IDateTimeService _dateTimeService;+ private readonly IDeliveryDateService _deliveryDateService;+ private readonly IInventoryManageService _inventoryManageService;+ private readonly ILanguageService _languageService;+ private readonly IMeasureService _measureService;+ private readonly MeasureSettings _measureSettings;+ private readonly IOutOfStockSubscriptionService _outOfStockSubscriptionService;+ private readonly IPictureService _pictureService;+ private readonly IPriceFormatter _priceFormatter;+ private readonly IProductAttributeFormatter _productAttributeFormatter;+ private readonly IProductAttributeService _productAttributeService;+ private readonly IProductCategoryService _productCategoryService;+ private readonly IProductCollectionService _productCollectionService;+ private readonly IProductLayoutService _productLayoutService;+ private readonly IProductService _productService;+ private readonly SeoSettings _seoSettings;+ private readonly ISlugService _slugService;+ private readonly ISpecificationAttributeService _specificationAttributeService;+ private readonly IStockQuantityService _stockQuantityService;+ private readonly IStoreService _storeService;+ private readonly ITaxCategoryService _taxCategoryService;+ private readonly TaxSettings _taxSettings;+ private readonly ITranslationService _translationService;+ private readonly IWarehouseService _warehouseService;+ private readonly IWorkContext _workContext;++ public ProductViewModelService(+ IProductService productService,+ IInventoryManageService inventoryManageService,+ IPictureService pictureService,+ IProductAttributeService productAttributeService,+ ICurrencyService currencyService,+ IMeasureService measureService,+ IDateTimeService dateTimeService,+ ICollectionService collectionService,+ IProductCollectionService productCollectionService,+ ICategoryService categoryService,+ IProductCategoryService productCategoryService,+ ITranslationService translationService,+ IProductLayoutService productLayoutService,+ ISpecificationAttributeService specificationAttributeService,+ IWorkContext workContext,+ IWarehouseService warehouseService,+ IDeliveryDateService deliveryDateService,+ ITaxCategoryService taxCategoryService,+ ICustomerService customerService,+ IStoreService storeService,+ ISlugService slugService,+ IOutOfStockSubscriptionService outOfStockSubscriptionService,+ ILanguageService languageService,+ IProductAttributeFormatter productAttributeFormatter,+ IStockQuantityService stockQuantityService,+ IAuctionService auctionService,+ IPriceFormatter priceFormatter,+ CurrencySettings currencySettings,+ MeasureSettings measureSettings,+ TaxSettings taxSettings, SeoSettings seoSettings)+ {+ _productService = productService;+ _inventoryManageService = inventoryManageService;+ _pictureService = pictureService;+ _productAttributeService = productAttributeService;+ _currencyService = currencyService;+ _measureService = measureService;+ _dateTimeService = dateTimeService;+ _collectionService = collectionService;+ _productCollectionService = productCollectionService;+ _categoryService = categoryService;+ _productCategoryService = productCategoryService;+ _translationService = translationService;+ _productLayoutService = productLayoutService;+ _specificationAttributeService = specificationAttributeService;+ _workContext = workContext;+ _warehouseService = warehouseService;+ _deliveryDateService = deliveryDateService;+ _taxCategoryService = taxCategoryService;+ _customerService = customerService;+ _storeService = storeService;+ _slugService = slugService;+ _outOfStockSubscriptionService = outOfStockSubscriptionService;+ _stockQuantityService = stockQuantityService;+ _languageService = languageService;+ _productAttributeFormatter = productAttributeFormatter;+ _auctionService = auctionService;+ _priceFormatter = priceFormatter;+ _currencySettings = currencySettings;+ _measureSettings = measureSettings;+ _taxSettings = taxSettings;+ _seoSettings = seoSettings;+ }- model.AvailableProductTypes.Insert(0,- new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = "0" });+ public virtual async Task PrepareAddProductAttributeCombinationModel(ProductAttributeCombinationModel model,+ Product product)+ {+ ArgumentNullException.ThrowIfNull(model);+ ArgumentNullException.ThrowIfNull(product);- return model;- }+ if (product.UseMultipleWarehouses) model.UseMultipleWarehouses = product.UseMultipleWarehouses;- public virtual async Task PrepareAddProductAttributeCombinationModel(ProductAttributeCombinationModel model,- Product product)+ if (string.IsNullOrEmpty(model.Id)){- ArgumentNullException.ThrowIfNull(model);- ArgumentNullException.ThrowIfNull(product);-- if (product.UseMultipleWarehouses)+ model.ProductId = product.Id;+ var attributes = product.ProductAttributeMappings+ .Where(x => !x.IsNonCombinable())+ .ToList();+ foreach (var attribute in attributes){- model.UseMultipleWarehouses = product.UseMultipleWarehouses;- }+ var productAttribute =+ await _productAttributeService.GetProductAttributeById(attribute.ProductAttributeId);+ var attributeModel = new ProductAttributeCombinationModel.ProductAttributeModel {+ Id = attribute.Id,+ ProductAttributeId = attribute.ProductAttributeId,+ Name = productAttribute.Name,+ TextPrompt = attribute.TextPrompt,+ IsRequired = attribute.IsRequired,+ AttributeControlType = attribute.AttributeControlTypeId+ };- if (string.IsNullOrEmpty(model.Id))- {- model.ProductId = product.Id;- var attributes = product.ProductAttributeMappings- .Where(x => !x.IsNonCombinable())- .ToList();- foreach (var attribute in attributes)+ if (attribute.ShouldHaveValues()){- var productAttribute =- await _productAttributeService.GetProductAttributeById(attribute.ProductAttributeId);- var attributeModel = new ProductAttributeCombinationModel.ProductAttributeModel {- Id = attribute.Id,- ProductAttributeId = attribute.ProductAttributeId,- Name = productAttribute.Name,- TextPrompt = attribute.TextPrompt,- IsRequired = attribute.IsRequired,- AttributeControlType = attribute.AttributeControlTypeId- };-- if (attribute.ShouldHaveValues())+ //values+ var attributeValues = attribute.ProductAttributeValues;+ foreach (var attributeValue in attributeValues){- //values- var attributeValues = attribute.ProductAttributeValues;- foreach (var attributeValue in attributeValues)- {- var attributeValueModel = new ProductAttributeCombinationModel.ProductAttributeValueModel {- Id = attributeValue.Id,- Name = attributeValue.Name,- IsPreSelected = attributeValue.IsPreSelected- };- attributeModel.Values.Add(attributeValueModel);- }+ var attributeValueModel = new ProductAttributeCombinationModel.ProductAttributeValueModel {+ Id = attributeValue.Id,+ Name = attributeValue.Name,+ IsPreSelected = attributeValue.IsPreSelected+ };+ attributeModel.Values.Add(attributeValueModel);}-- model.ProductAttributes.Add(attributeModel);}- }--- if (!string.IsNullOrEmpty(model.PictureId))- {- var pictureThumbnailUrl = await _pictureService.GetPictureUrl(model.PictureId, 100, false);- model.PictureThumbnailUrl = pictureThumbnailUrl;- }- foreach (var picture in product.ProductPictures)- {- model.ProductPictureModels.Add(new ProductModel.ProductPictureModel {- Id = picture.Id,- ProductId = product.Id,- PictureId = picture.PictureId,- PictureUrl = await _pictureService.GetPictureUrl(picture.PictureId),- DisplayOrder = picture.DisplayOrder- });+ model.ProductAttributes.Add(attributeModel);}-- model.PrimaryStoreCurrencyCode =- (await _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId))?.CurrencyCode;}- public virtual async Task PrepareTierPriceModel(ProductModel.TierPriceModel model)++ if (!string.IsNullOrEmpty(model.PictureId)){- foreach (var currency in await _currencyService.GetAllCurrencies())- model.AvailableCurrencies.Add(- new SelectListItem { Text = currency.Name, Value = currency.CurrencyCode });+ var pictureThumbnailUrl = await _pictureService.GetPictureUrl(model.PictureId, 100, false);+ model.PictureThumbnailUrl = pictureThumbnailUrl;}- public virtual async Task PrepareProductAttributeValueModel(Product product,- ProductModel.ProductAttributeValueModel model)- {- //pictures- foreach (var x in product.ProductPictures.OrderBy(x => x.DisplayOrder))- {- model.ProductPictureModels.Add(new ProductModel.ProductPictureModel {- Id = x.Id,- ProductId = product.Id,- PictureId = x.PictureId,- PictureUrl = await _pictureService.GetPictureUrl(x.PictureId),- DisplayOrder = x.DisplayOrder- });- }+ foreach (var picture in product.ProductPictures)+ model.ProductPictureModels.Add(new ProductModel.ProductPictureModel {+ Id = picture.Id,+ ProductId = product.Id,+ PictureId = picture.PictureId,+ PictureUrl = await _pictureService.GetPictureUrl(picture.PictureId),+ DisplayOrder = picture.DisplayOrder+ });- var associatedProduct = await _productService.GetProductById(model.AssociatedProductId);- model.AssociatedProductName = associatedProduct != null ? associatedProduct.Name : "";- }+ model.PrimaryStoreCurrencyCode =+ (await _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId))?.CurrencyCode;+ }- public virtual async Task OutOfStockNotifications(Product product, int prevStockQuantity,- List<ProductWarehouseInventory> prevMultiWarehouseStock- )- {- if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStock &&- product.BackorderModeId == BackorderMode.NoBackorders &&- product.AllowOutOfStockSubscriptions &&- _stockQuantityService.GetTotalStockQuantity(product, total: true) > 0 &&- prevStockQuantity <= 0 && !product.UseMultipleWarehouses &&- product.Published)- {- await _outOfStockSubscriptionService.SendNotificationsToSubscribers(product, "");- }+ public virtual async Task PrepareTierPriceModel(ProductModel.TierPriceModel model)+ {+ foreach (var currency in await _currencyService.GetAllCurrencies())+ model.AvailableCurrencies.Add(+ new SelectListItem { Text = currency.Name, Value = currency.CurrencyCode });+ }- if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStock &&- product.BackorderModeId == BackorderMode.NoBackorders &&- product.AllowOutOfStockSubscriptions &&- product.UseMultipleWarehouses &&- product.Published)- {- foreach (var prevstock in prevMultiWarehouseStock)- {- if (prevstock.StockQuantity - prevstock.ReservedQuantity <= 0)- {- var actualStock =- product.ProductWarehouseInventory.FirstOrDefault(- x => x.WarehouseId == prevstock.WarehouseId);- if (actualStock != null)- {- if (actualStock.StockQuantity - actualStock.ReservedQuantity > 0)- await _outOfStockSubscriptionService.SendNotificationsToSubscribers(product,- prevstock.WarehouseId);- }- }- }+ public virtual async Task PrepareProductAttributeValueModel(Product product,+ ProductModel.ProductAttributeValueModel model)+ {+ //pictures+ foreach (var x in product.ProductPictures.OrderBy(x => x.DisplayOrder))+ model.ProductPictureModels.Add(new ProductModel.ProductPictureModel {+ Id = x.Id,+ ProductId = product.Id,+ PictureId = x.PictureId,+ PictureUrl = await _pictureService.GetPictureUrl(x.PictureId),+ DisplayOrder = x.DisplayOrder+ });- if (product.ProductWarehouseInventory.Sum(x => x.StockQuantity - x.ReservedQuantity) > 0)+ var associatedProduct = await _productService.GetProductById(model.AssociatedProductId);+ model.AssociatedProductName = associatedProduct != null ? associatedProduct.Name : "";+ }++ public virtual async Task OutOfStockNotifications(Product product, int prevStockQuantity,+ List<ProductWarehouseInventory> prevMultiWarehouseStock+ )+ {+ if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStock &&+ product.BackorderModeId == BackorderMode.NoBackorders &&+ product.AllowOutOfStockSubscriptions &&+ _stockQuantityService.GetTotalStockQuantity(product, total: true) > 0 &&+ prevStockQuantity <= 0 && !product.UseMultipleWarehouses &&+ product.Published)+ await _outOfStockSubscriptionService.SendNotificationsToSubscribers(product, "");++ if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStock &&+ product.BackorderModeId == BackorderMode.NoBackorders &&+ product.AllowOutOfStockSubscriptions &&+ product.UseMultipleWarehouses &&+ product.Published)+ {+ foreach (var prevstock in prevMultiWarehouseStock)+ if (prevstock.StockQuantity - prevstock.ReservedQuantity <= 0){- if (prevMultiWarehouseStock.Sum(x => x.StockQuantity - x.ReservedQuantity) <= 0)- {- await _outOfStockSubscriptionService.SendNotificationsToSubscribers(product, "");- }+ var actualStock =+ product.ProductWarehouseInventory.FirstOrDefault(+ x => x.WarehouseId == prevstock.WarehouseId);+ if (actualStock != null)+ if (actualStock.StockQuantity - actualStock.ReservedQuantity > 0)+ await _outOfStockSubscriptionService.SendNotificationsToSubscribers(product,+ prevstock.WarehouseId);}- }- }- public virtual async Task OutOfStockNotifications(Product product, ProductAttributeCombination combination,- ProductAttributeCombination prevcombination)- {- if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByAttributes &&- product.BackorderModeId == BackorderMode.NoBackorders &&- product.AllowOutOfStockSubscriptions &&- combination.StockQuantity > 0 &&- prevcombination.StockQuantity <= 0 && !product.UseMultipleWarehouses &&- product.Published)- {- await _outOfStockSubscriptionService.SendNotificationsToSubscribers(product, combination.Attributes,- "");- }+ if (product.ProductWarehouseInventory.Sum(x => x.StockQuantity - x.ReservedQuantity) > 0)+ if (prevMultiWarehouseStock.Sum(x => x.StockQuantity - x.ReservedQuantity) <= 0)+ await _outOfStockSubscriptionService.SendNotificationsToSubscribers(product, "");+ }+ }- if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByAttributes &&- product.BackorderModeId == BackorderMode.NoBackorders &&- product.AllowOutOfStockSubscriptions &&- product.UseMultipleWarehouses &&- product.Published)- {- foreach (var prevstock in prevcombination.WarehouseInventory)+ public virtual async Task OutOfStockNotifications(Product product, ProductAttributeCombination combination,+ ProductAttributeCombination prevcombination)+ {+ if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByAttributes &&+ product.BackorderModeId == BackorderMode.NoBackorders &&+ product.AllowOutOfStockSubscriptions &&+ combination.StockQuantity > 0 &&+ prevcombination.StockQuantity <= 0 && !product.UseMultipleWarehouses &&+ product.Published)+ await _outOfStockSubscriptionService.SendNotificationsToSubscribers(product, combination.Attributes,+ "");++ if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByAttributes &&+ product.BackorderModeId == BackorderMode.NoBackorders &&+ product.AllowOutOfStockSubscriptions &&+ product.UseMultipleWarehouses &&+ product.Published)+ {+ foreach (var prevstock in prevcombination.WarehouseInventory)+ if (prevstock.StockQuantity - prevstock.ReservedQuantity <= 0){- if (prevstock.StockQuantity - prevstock.ReservedQuantity <= 0)- {- var actualStock =- combination.WarehouseInventory.FirstOrDefault(x => x.WarehouseId == prevstock.WarehouseId);- if (actualStock != null)- {- if (actualStock.StockQuantity - actualStock.ReservedQuantity > 0)- await _outOfStockSubscriptionService.SendNotificationsToSubscribers(product,- combination.Attributes, prevstock.WarehouseId);- }- }+ var actualStock =+ combination.WarehouseInventory.FirstOrDefault(x => x.WarehouseId == prevstock.WarehouseId);+ if (actualStock != null)+ if (actualStock.StockQuantity - actualStock.ReservedQuantity > 0)+ await _outOfStockSubscriptionService.SendNotificationsToSubscribers(product,+ combination.Attributes, prevstock.WarehouseId);}- if (combination.WarehouseInventory.Sum(x => x.StockQuantity - x.ReservedQuantity) > 0)- {- if (prevcombination.WarehouseInventory.Sum(x => x.StockQuantity - x.ReservedQuantity) <= 0)- {- await _outOfStockSubscriptionService.SendNotificationsToSubscribers(product,- combination.Attributes, "");- }- }- }+ if (combination.WarehouseInventory.Sum(x => x.StockQuantity - x.ReservedQuantity) > 0)+ if (prevcombination.WarehouseInventory.Sum(x => x.StockQuantity - x.ReservedQuantity) <= 0)+ await _outOfStockSubscriptionService.SendNotificationsToSubscribers(product,+ combination.Attributes, "");}+ }- public virtual async Task PrepareProductModel(ProductModel model, Product product,- bool setPredefinedValues)- {- ArgumentNullException.ThrowIfNull(model);-- model.PrimaryStoreCurrencyCode =- (await _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId))?.CurrencyCode;- model.BaseWeightIn = (await _measureService.GetMeasureWeightById(_measureSettings.BaseWeightId))?.Name;- model.BaseDimensionIn =- (await _measureService.GetMeasureDimensionById(_measureSettings.BaseDimensionId))?.Name;-- if (product != null)- {- //date- model.CreatedOn = _dateTimeService.ConvertToUserTime(product.CreatedOnUtc, DateTimeKind.Utc);- model.UpdatedOn = product.UpdatedOnUtc.HasValue- ? _dateTimeService.ConvertToUserTime(product.UpdatedOnUtc.Value, DateTimeKind.Utc)- : null;-- //parent grouped product- var parentGroupedProduct = await _productService.GetProductById(product.ParentGroupedProductId);- if (parentGroupedProduct != null)- {- model.AssociatedToProductId = product.ParentGroupedProductId;- model.AssociatedToProductName = parentGroupedProduct.Name;- }+ public virtual async Task PrepareProductModel(ProductModel model, Product product,+ bool setPredefinedValues)+ {+ ArgumentNullException.ThrowIfNull(model);- //reservation- model.CalendarModel.ProductId = product.Id;- model.CalendarModel.Interval = product.Interval;- model.CalendarModel.IntervalUnit = (int)product.IntervalUnitId;- model.CalendarModel.IncBothDate = product.IncBothDate;+ model.PrimaryStoreCurrencyCode =+ (await _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId))?.CurrencyCode;+ model.BaseWeightIn = (await _measureService.GetMeasureWeightById(_measureSettings.BaseWeightId))?.Name;+ model.BaseDimensionIn =+ (await _measureService.GetMeasureDimensionById(_measureSettings.BaseDimensionId))?.Name;- model.AutoAddRequiredProducts = product.AutoAddRequiredProducts;- //product attributes- foreach (var productAttribute in await _productAttributeService.GetAllProductAttributes())- {- model.AvailableProductAttributes.Add(new SelectListItem {- Text = productAttribute.Name,- Value = productAttribute.Id- });- }- }+ if (product != null)+ {+ //date+ model.CreatedOn = _dateTimeService.ConvertToUserTime(product.CreatedOnUtc, DateTimeKind.Utc);+ model.UpdatedOn = product.UpdatedOnUtc.HasValue+ ? _dateTimeService.ConvertToUserTime(product.UpdatedOnUtc.Value, DateTimeKind.Utc)+ : null;- //copy product- if (product != null)+ //parent grouped product+ var parentGroupedProduct = await _productService.GetProductById(product.ParentGroupedProductId);+ if (parentGroupedProduct != null){- model.CopyProductModel.Id = product.Id;- model.CopyProductModel.Name = "Copy of " + product.Name;- model.CopyProductModel.Published = true;- model.CopyProductModel.CopyImages = true;+ model.AssociatedToProductId = product.ParentGroupedProductId;+ model.AssociatedToProductName = parentGroupedProduct.Name;}- //layouts- var layouts = await _productLayoutService.GetAllProductLayouts();- foreach (var layout in layouts)- {- model.AvailableProductLayouts.Add(new SelectListItem {- Text = layout.Name,- Value = layout.Id+ //reservation+ model.CalendarModel.ProductId = product.Id;+ model.CalendarModel.Interval = product.Interval;+ model.CalendarModel.IntervalUnit = (int)product.IntervalUnitId;+ model.CalendarModel.IncBothDate = product.IncBothDate;++ model.AutoAddRequiredProducts = product.AutoAddRequiredProducts;+ //product attributes+ foreach (var productAttribute in await _productAttributeService.GetAllProductAttributes())+ model.AvailableProductAttributes.Add(new SelectListItem {+ Text = productAttribute.Name,+ Value = productAttribute.Id});- }+ }++ //copy product+ if (product != null)+ {+ model.CopyProductModel.Id = product.Id;+ model.CopyProductModel.Name = "Copy of " + product.Name;+ model.CopyProductModel.Published = true;+ model.CopyProductModel.CopyImages = true;+ }++ //layouts+ var layouts = await _productLayoutService.GetAllProductLayouts();+ foreach (var layout in layouts)+ model.AvailableProductLayouts.Add(new SelectListItem {+ Text = layout.Name,+ Value = layout.Id+ });- //delivery dates+ //delivery dates+ model.AvailableDeliveryDates.Add(new SelectListItem {+ Text = _translationService.GetResource("Vendor.Catalog.Products.Fields.DeliveryDate.None"),+ Value = ""+ });+ var deliveryDates = await _deliveryDateService.GetAllDeliveryDates();+ foreach (var deliveryDate in deliveryDates)model.AvailableDeliveryDates.Add(new SelectListItem {- Text = _translationService.GetResource("Vendor.Catalog.Products.Fields.DeliveryDate.None"),- Value = ""+ Text = deliveryDate.Name,+ Value = deliveryDate.Id});- var deliveryDates = await _deliveryDateService.GetAllDeliveryDates();- foreach (var deliveryDate in deliveryDates)- {- model.AvailableDeliveryDates.Add(new SelectListItem {- Text = deliveryDate.Name,- Value = deliveryDate.Id- });- }- //warehouses- var warehouses = await _warehouseService.GetAllWarehouses();+ //warehouses+ var warehouses = await _warehouseService.GetAllWarehouses();+ model.AvailableWarehouses.Add(new SelectListItem {+ Text = _translationService.GetResource("Vendor.Catalog.Products.Fields.Warehouse.None"),+ Value = ""+ });+ foreach (var warehouse in warehouses)model.AvailableWarehouses.Add(new SelectListItem {- Text = _translationService.GetResource("Vendor.Catalog.Products.Fields.Warehouse.None"),- Value = ""+ Text = warehouse.Name,+ Value = warehouse.Id});- foreach (var warehouse in warehouses)- {- model.AvailableWarehouses.Add(new SelectListItem {- Text = warehouse.Name,- Value = warehouse.Id- });- }- //multiple warehouses- foreach (var warehouse in warehouses)+ //multiple warehouses+ foreach (var warehouse in warehouses)+ {+ var pwiModel = new ProductModel.ProductWarehouseInventoryModel {+ WarehouseId = warehouse.Id,+ WarehouseName = warehouse.Name,+ WarehouseCode = warehouse.Code+ };+ if (product != null){- var pwiModel = new ProductModel.ProductWarehouseInventoryModel {- WarehouseId = warehouse.Id,- WarehouseName = warehouse.Name,- WarehouseCode = warehouse.Code- };- if (product != null)+ var pwi = product.ProductWarehouseInventory.FirstOrDefault(x => x.WarehouseId == warehouse.Id);+ if (pwi != null){- var pwi = product.ProductWarehouseInventory.FirstOrDefault(x => x.WarehouseId == warehouse.Id);- if (pwi != null)- {- pwiModel.WarehouseUsed = true;- pwiModel.StockQuantity = pwi.StockQuantity;- pwiModel.ReservedQuantity = pwi.ReservedQuantity;- }+ pwiModel.WarehouseUsed = true;+ pwiModel.StockQuantity = pwi.StockQuantity;+ pwiModel.ReservedQuantity = pwi.ReservedQuantity;}-- model.ProductWarehouseInventoryModels.Add(pwiModel);}- //tax categories- var taxCategories = await _taxCategoryService.GetAllTaxCategories();+ model.ProductWarehouseInventoryModels.Add(pwiModel);+ }++ //tax categories+ var taxCategories = await _taxCategoryService.GetAllTaxCategories();+ model.AvailableTaxCategories.Add(new SelectListItem {+ Text = _translationService.GetResource("Vendor.Configuration.Tax.Settings.TaxCategories.None"),+ Value = ""+ });+ foreach (var tc in taxCategories)model.AvailableTaxCategories.Add(new SelectListItem {- Text = _translationService.GetResource("Vendor.Configuration.Tax.Settings.TaxCategories.None"),- Value = ""+ Text = tc.Name, Value = tc.Id,+ Selected = product != null && !setPredefinedValues && tc.Id == product.TaxCategoryId});- foreach (var tc in taxCategories)- model.AvailableTaxCategories.Add(new SelectListItem {- Text = tc.Name, Value = tc.Id,- Selected = product != null && !setPredefinedValues && tc.Id == product.TaxCategoryId- });-- //base-price units- var measureWeights = await _measureService.GetAllMeasureWeights();- foreach (var mw in measureWeights)- model.AvailableBasepriceUnits.Add(new SelectListItem {- Text = mw.Name, Value = mw.Id,- Selected = product != null && !setPredefinedValues && mw.Id == product.BasepriceUnitId- });- foreach (var mw in measureWeights)- model.AvailableBasepriceBaseUnits.Add(new SelectListItem {- Text = mw.Name, Value = mw.Id,- Selected = product != null && !setPredefinedValues && mw.Id == product.BasepriceBaseUnitId- });- //units- var units = await _measureService.GetAllMeasureUnits();- model.AvailableUnits.Add(new SelectListItem { Text = "---", Value = "" });- foreach (var un in units)- model.AvailableUnits.Add(new SelectListItem- { Text = un.Name, Value = un.Id, Selected = product != null && un.Id == product.UnitId });+ //base-price units+ var measureWeights = await _measureService.GetAllMeasureWeights();+ foreach (var mw in measureWeights)+ model.AvailableBasepriceUnits.Add(new SelectListItem {+ Text = mw.Name, Value = mw.Id,+ Selected = product != null && !setPredefinedValues && mw.Id == product.BasepriceUnitId+ });+ foreach (var mw in measureWeights)+ model.AvailableBasepriceBaseUnits.Add(new SelectListItem {+ Text = mw.Name, Value = mw.Id,+ Selected = product != null && !setPredefinedValues && mw.Id == product.BasepriceBaseUnitId+ });- //default values- if (setPredefinedValues)- {- model.MaxEnteredPrice = 1000;- model.RecurringCycleLength = 100;- model.RecurringTotalCycles = 10;- model.StockQuantity = 0;- model.NotifyAdminForQuantityBelow = 1;- model.OrderMinimumQuantity = 1;- model.OrderMaximumQuantity = 10000;- model.TaxCategoryId = _taxSettings.DefaultTaxCategoryId;- model.IsShipEnabled = true;- model.AllowCustomerReviews = true;- model.Published = true;- model.VisibleIndividually = true;- }+ //units+ var units = await _measureService.GetAllMeasureUnits();+ model.AvailableUnits.Add(new SelectListItem { Text = "---", Value = "" });+ foreach (var un in units)+ model.AvailableUnits.Add(new SelectListItem+ { Text = un.Name, Value = un.Id, Selected = product != null && un.Id == product.UnitId });++ //default values+ if (setPredefinedValues)+ {+ model.MaxEnteredPrice = 1000;+ model.RecurringCycleLength = 100;+ model.RecurringTotalCycles = 10;+ model.StockQuantity = 0;+ model.NotifyAdminForQuantityBelow = 1;+ model.OrderMinimumQuantity = 1;+ model.OrderMaximumQuantity = 10000;+ model.TaxCategoryId = _taxSettings.DefaultTaxCategoryId;+ model.IsShipEnabled = true;+ model.AllowCustomerReviews = true;+ model.Published = true;+ model.VisibleIndividually = true;}+ }- public virtual async Task SaveProductWarehouseInventory(Product product,- IList<ProductModel.ProductWarehouseInventoryModel> model)- {- ArgumentNullException.ThrowIfNull(product);+ public virtual async Task SaveProductWarehouseInventory(Product product,+ IList<ProductModel.ProductWarehouseInventoryModel> model)+ {+ ArgumentNullException.ThrowIfNull(product);- if (product.ManageInventoryMethodId != ManageInventoryMethod.ManageStock)- return;+ if (product.ManageInventoryMethodId != ManageInventoryMethod.ManageStock)+ return;- if (!product.UseMultipleWarehouses)- return;+ if (!product.UseMultipleWarehouses)+ return;- var warehouses = await _warehouseService.GetAllWarehouses();+ var warehouses = await _warehouseService.GetAllWarehouses();- foreach (var warehouse in warehouses)+ foreach (var warehouse in warehouses)+ {+ var whim = model.FirstOrDefault(x => x.WarehouseId == warehouse.Id);+ var existingPwI = product.ProductWarehouseInventory.FirstOrDefault(x => x.WarehouseId == warehouse.Id);+ if (existingPwI != null){- var whim = model.FirstOrDefault(x => x.WarehouseId == warehouse.Id);- var existingPwI = product.ProductWarehouseInventory.FirstOrDefault(x => x.WarehouseId == warehouse.Id);- if (existingPwI != null)+ if (whim is { WarehouseUsed: true }){- if (whim is { WarehouseUsed: true })- {- //update existing record- existingPwI.StockQuantity = whim.StockQuantity;- existingPwI.ReservedQuantity = whim.ReservedQuantity;- await _productService.UpdateProductWarehouseInventory(existingPwI, product.Id);- }- else- {- //delete. no need to store record for qty 0- await _productService.DeleteProductWarehouseInventory(existingPwI, product.Id);- }+ //update existing record+ existingPwI.StockQuantity = whim.StockQuantity;+ existingPwI.ReservedQuantity = whim.ReservedQuantity;+ await _productService.UpdateProductWarehouseInventory(existingPwI, product.Id);}else{- if (whim is { WarehouseUsed: true })- {- //no need to insert a record for qty 0- existingPwI = new ProductWarehouseInventory {- WarehouseId = warehouse.Id,- StockQuantity = whim.StockQuantity,- ReservedQuantity = whim.ReservedQuantity- };- product.ProductWarehouseInventory.Add(existingPwI);- await _productService.InsertProductWarehouseInventory(existingPwI, product.Id);- }+ //delete. no need to store record for qty 0+ await _productService.DeleteProductWarehouseInventory(existingPwI, product.Id);}}-- product.StockQuantity = product.ProductWarehouseInventory.Sum(x => x.StockQuantity);- product.ReservedQuantity = product.ProductWarehouseInventory.Sum(x => x.ReservedQuantity);- await _inventoryManageService.UpdateStockProduct(product, false);- }-- public virtual async Task PrepareProductReviewModel(ProductReviewModel model,- ProductReview productReview, bool excludeProperties, bool formatReviewText)- {- ArgumentNullException.ThrowIfNull(model);- ArgumentNullException.ThrowIfNull(model);- ArgumentNullException.ThrowIfNull(productReview);-- var product = await _productService.GetProductById(productReview.ProductId);- var customer = await _customerService.GetCustomerById(productReview.CustomerId);- var store = await _storeService.GetStoreById(productReview.StoreId);- model.Id = productReview.Id;- model.StoreName = store != null ? store.Shortcut : "";- model.ProductId = productReview.ProductId;- model.ProductName = product.Name;- model.CustomerId = productReview.CustomerId;- model.CustomerInfo = customer != null- ? !string.IsNullOrEmpty(customer.Email)- ? customer.Email- : _translationService.GetResource("Vendor.Customers.Guest")- : "";- model.Rating = productReview.Rating;- model.CreatedOn = _dateTimeService.ConvertToUserTime(productReview.CreatedOnUtc, DateTimeKind.Utc);- model.Signature = productReview.Signature;- if (!excludeProperties)+ else{- model.Title = productReview.Title;- if (formatReviewText)- {- model.ReviewText = FormatText.ConvertText(productReview.ReviewText);- model.ReplyText = FormatText.ConvertText(productReview.ReplyText);- }- else+ if (whim is { WarehouseUsed: true }){- model.ReviewText = productReview.ReviewText;- model.ReplyText = productReview.ReplyText;+ //no need to insert a record for qty 0+ existingPwI = new ProductWarehouseInventory {+ WarehouseId = warehouse.Id,+ StockQuantity = whim.StockQuantity,+ ReservedQuantity = whim.ReservedQuantity+ };+ product.ProductWarehouseInventory.Add(existingPwI);+ await _productService.InsertProductWarehouseInventory(existingPwI, product.Id);}-- model.IsApproved = productReview.IsApproved;}}- public virtual async Task<ProductListModel> PrepareProductListModel()- {- var model = new ProductListModel();-- //warehouses- model.AvailableWarehouses.Add(new SelectListItem- { Text = _translationService.GetResource("Vendor.Common.All"), Value = " " });- foreach (var wh in await _warehouseService.GetAllWarehouses())- model.AvailableWarehouses.Add(new SelectListItem { Text = wh.Name, Value = wh.Id });-- //product types- model.AvailableProductTypes = ProductType.SimpleProduct- .ToSelectList(_translationService, _workContext, false).ToList();- model.AvailableProductTypes.Insert(0,- new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = "0" });-- //"published" property- //0 - all (according to "ShowHidden" parameter)- //1 - published only- //2 - unpublished only- //4 - mark as new- model.AvailablePublishedOptions.Add(new SelectListItem {- Text = _translationService.GetResource("Vendor.Catalog.Products.List.SearchPublished.All"), Value = " "- });- model.AvailablePublishedOptions.Add(new SelectListItem {- Text = _translationService.GetResource("Vendor.Catalog.Products.List.SearchPublished.PublishedOnly"),- Value = "1"- });- model.AvailablePublishedOptions.Add(new SelectListItem {- Text = _translationService.GetResource("Vendor.Catalog.Products.List.SearchPublished.UnpublishedOnly"),- Value = "2"- });- model.AvailablePublishedOptions.Add(new SelectListItem {- Text = _translationService.GetResource("Vendor.Catalog.Products.List.SearchPublished.MarkAsNew"),- Value = "4"- });-- return model;- }-- public virtual async Task<(IEnumerable<ProductModel> productModels, int totalCount)> PrepareProductsModel(- ProductListModel model, int pageIndex, int pageSize)- {- var categoryIds = new List<string>();- if (!string.IsNullOrEmpty(model.SearchCategoryId))- categoryIds.Add(model.SearchCategoryId);-- //include subcategories- if (model.SearchIncludeSubCategories && !string.IsNullOrEmpty(model.SearchCategoryId))- categoryIds.AddRange(await GetChildCategoryIds(model.SearchCategoryId));-- //0 - all (according to "ShowHidden" parameter)- //1 - published only- //2 - unpublished only- bool? overridePublished = model.SearchPublishedId switch {- 1 => true,- 2 => false,- _ => null- };+ product.StockQuantity = product.ProductWarehouseInventory.Sum(x => x.StockQuantity);+ product.ReservedQuantity = product.ProductWarehouseInventory.Sum(x => x.ReservedQuantity);+ await _inventoryManageService.UpdateStockProduct(product, false);+ }- bool? showOnHomePage = null;- if (model.SearchPublishedId == 3)- showOnHomePage = true;-- var markedAsNewOnly = model.SearchPublishedId == 4;-- var products = (await _productService.SearchProducts(- categoryIds: categoryIds,- brandId: model.SearchBrandId,- collectionId: model.SearchCollectionId,- vendorId: _workContext.CurrentVendor.Id,- warehouseId: model.SearchWarehouseId,- productType: model.SearchProductTypeId > 0 ? (ProductType?)model.SearchProductTypeId : null,- keywords: model.SearchProductName,- pageIndex: pageIndex - 1,- pageSize: pageSize,- showHidden: true,- showOnHomePage: showOnHomePage,- overridePublished: overridePublished,- markedAsNewOnly: markedAsNewOnly- )).products;-- var items = new List<ProductModel>();- foreach (var x in products)+ public virtual async Task PrepareProductReviewModel(ProductReviewModel model,+ ProductReview productReview, bool excludeProperties, bool formatReviewText)+ {+ ArgumentNullException.ThrowIfNull(model);+ ArgumentNullException.ThrowIfNull(model);+ ArgumentNullException.ThrowIfNull(productReview);++ var product = await _productService.GetProductById(productReview.ProductId);+ var customer = await _customerService.GetCustomerById(productReview.CustomerId);+ var store = await _storeService.GetStoreById(productReview.StoreId);+ model.Id = productReview.Id;+ model.StoreName = store != null ? store.Shortcut : "";+ model.ProductId = productReview.ProductId;+ model.ProductName = product.Name;+ model.CustomerId = productReview.CustomerId;+ model.CustomerInfo = customer != null+ ? !string.IsNullOrEmpty(customer.Email)+ ? customer.Email+ : _translationService.GetResource("Vendor.Customers.Guest")+ : "";+ model.Rating = productReview.Rating;+ model.CreatedOn = _dateTimeService.ConvertToUserTime(productReview.CreatedOnUtc, DateTimeKind.Utc);+ model.Signature = productReview.Signature;+ if (!excludeProperties)+ {+ model.Title = productReview.Title;+ if (formatReviewText)+ {+ model.ReviewText = FormatText.ConvertText(productReview.ReviewText);+ model.ReplyText = FormatText.ConvertText(productReview.ReplyText);+ }+ else{- var productModel = x.ToModel(_dateTimeService);- //"Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property. "- //also it improves performance- productModel.FullDescription = "";-- //picture- var defaultProductPicture = x.ProductPictures.FirstOrDefault() ?? new ProductPicture();- productModel.PictureThumbnailUrl =- await _pictureService.GetPictureUrl(defaultProductPicture.PictureId, 100);- //product type- productModel.ProductTypeName = x.ProductTypeId.GetTranslationEnum(_translationService, _workContext);- //friendly stock quantity- //if a simple product AND "manage inventory" is "Track inventory", then display- if (x.ProductTypeId == ProductType.SimpleProduct &&- x.ManageInventoryMethodId == ManageInventoryMethod.ManageStock)- productModel.StockQuantityStr =- _stockQuantityService.GetTotalStockQuantity(x, total: true).ToString();- items.Add(productModel);+ model.ReviewText = productReview.ReviewText;+ model.ReplyText = productReview.ReplyText;}- return (items, products.TotalCount);+ model.IsApproved = productReview.IsApproved;}+ }- public virtual async Task<IList<Product>> PrepareProducts(ProductListModel model)- {- var categoryIds = new List<string>();- if (!string.IsNullOrEmpty(model.SearchCategoryId))- categoryIds.Add(model.SearchCategoryId);-- //include subcategories- if (model.SearchIncludeSubCategories && !string.IsNullOrEmpty(model.SearchCategoryId))- categoryIds.AddRange(await GetChildCategoryIds(model.SearchCategoryId));-- //0 - all (according to "ShowHidden" parameter)- //1 - published only- //2 - unpublished only- bool? overridePublished = model.SearchPublishedId switch {- 1 => true,- 2 => false,- _ => null- };-- var products = (await _productService.SearchProducts(- categoryIds: categoryIds,- brandId: model.SearchBrandId,- collectionId: model.SearchCollectionId,- vendorId: _workContext.CurrentVendor.Id,- warehouseId: model.SearchWarehouseId,- productType: model.SearchProductTypeId > 0 ? (ProductType?)model.SearchProductTypeId : null,- keywords: model.SearchProductName,- showHidden: true,- overridePublished: overridePublished- )).products;-- return products;- }+ public virtual async Task<ProductListModel> PrepareProductListModel()+ {+ var model = new ProductListModel();++ //warehouses+ model.AvailableWarehouses.Add(new SelectListItem+ { Text = _translationService.GetResource("Vendor.Common.All"), Value = " " });+ foreach (var wh in await _warehouseService.GetAllWarehouses())+ model.AvailableWarehouses.Add(new SelectListItem { Text = wh.Name, Value = wh.Id });++ //product types+ model.AvailableProductTypes = ProductType.SimpleProduct+ .ToSelectList(_translationService, _workContext, false).ToList();+ model.AvailableProductTypes.Insert(0,+ new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = "0" });++ //"published" property+ //0 - all (according to "ShowHidden" parameter)+ //1 - published only+ //2 - unpublished only+ //4 - mark as new+ model.AvailablePublishedOptions.Add(new SelectListItem {+ Text = _translationService.GetResource("Vendor.Catalog.Products.List.SearchPublished.All"), Value = " "+ });+ model.AvailablePublishedOptions.Add(new SelectListItem {+ Text = _translationService.GetResource("Vendor.Catalog.Products.List.SearchPublished.PublishedOnly"),+ Value = "1"+ });+ model.AvailablePublishedOptions.Add(new SelectListItem {+ Text = _translationService.GetResource("Vendor.Catalog.Products.List.SearchPublished.UnpublishedOnly"),+ Value = "2"+ });+ model.AvailablePublishedOptions.Add(new SelectListItem {+ Text = _translationService.GetResource("Vendor.Catalog.Products.List.SearchPublished.MarkAsNew"),+ Value = "4"+ });++ return model;+ }- public virtual async Task<Product> InsertProductModel(ProductModel model)- {- //product- var product = model.ToEntity(_dateTimeService);- product.VendorId = _workContext.CurrentVendor!.Id;- await _productService.InsertProduct(product);-- model.SeName = await product.ValidateSeName(model.SeName, product.Name, true, _seoSettings, _slugService,- _languageService);- product.SeName = model.SeName;- product.Locales = await model.Locales.ToTranslationProperty(product, x => x.Name,- _seoSettings, _slugService, _languageService);-- //search engine name- await _slugService.SaveSlug(product, model.SeName, "");- //warehouses- await SaveProductWarehouseInventory(product, model.ProductWarehouseInventoryModels);+ public virtual async Task<(IEnumerable<ProductModel> productModels, int totalCount)> PrepareProductsModel(+ ProductListModel model, int pageIndex, int pageSize)+ {+ var categoryIds = new List<string>();+ if (!string.IsNullOrEmpty(model.SearchCategoryId))+ categoryIds.Add(model.SearchCategoryId);++ //include subcategories+ if (model.SearchIncludeSubCategories && !string.IsNullOrEmpty(model.SearchCategoryId))+ categoryIds.AddRange(await GetChildCategoryIds(model.SearchCategoryId));++ //0 - all (according to "ShowHidden" parameter)+ //1 - published only+ //2 - unpublished only+ bool? overridePublished = model.SearchPublishedId switch {+ 1 => true,+ 2 => false,+ _ => null+ };++ bool? showOnHomePage = null;+ if (model.SearchPublishedId == 3)+ showOnHomePage = true;++ var markedAsNewOnly = model.SearchPublishedId == 4;++ var products = (await _productService.SearchProducts(+ categoryIds: categoryIds,+ brandId: model.SearchBrandId,+ collectionId: model.SearchCollectionId,+ vendorId: _workContext.CurrentVendor.Id,+ warehouseId: model.SearchWarehouseId,+ productType: model.SearchProductTypeId > 0 ? (ProductType?)model.SearchProductTypeId : null,+ keywords: model.SearchProductName,+ pageIndex: pageIndex - 1,+ pageSize: pageSize,+ showHidden: true,+ showOnHomePage: showOnHomePage,+ overridePublished: overridePublished,+ markedAsNewOnly: markedAsNewOnly+ )).products;++ var items = new List<ProductModel>();+ foreach (var x in products)+ {+ var productModel = x.ToModel(_dateTimeService);+ //"Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property. "+ //also it improves performance+ productModel.FullDescription = "";++ //picture+ var defaultProductPicture = x.ProductPictures.FirstOrDefault() ?? new ProductPicture();+ productModel.PictureThumbnailUrl =+ await _pictureService.GetPictureUrl(defaultProductPicture.PictureId, 100);+ //product type+ productModel.ProductTypeName = x.ProductTypeId.GetTranslationEnum(_translationService, _workContext);+ //friendly stock quantity+ //if a simple product AND "manage inventory" is "Track inventory", then display+ if (x.ProductTypeId == ProductType.SimpleProduct &&+ x.ManageInventoryMethodId == ManageInventoryMethod.ManageStock)+ productModel.StockQuantityStr =+ _stockQuantityService.GetTotalStockQuantity(x, total: true).ToString();+ items.Add(productModel);+ }++ return (items, products.TotalCount);+ }- await _productService.UpdateProduct(product);+ public virtual async Task<IList<Product>> PrepareProducts(ProductListModel model)+ {+ var categoryIds = new List<string>();+ if (!string.IsNullOrEmpty(model.SearchCategoryId))+ categoryIds.Add(model.SearchCategoryId);++ //include subcategories+ if (model.SearchIncludeSubCategories && !string.IsNullOrEmpty(model.SearchCategoryId))+ categoryIds.AddRange(await GetChildCategoryIds(model.SearchCategoryId));++ //0 - all (according to "ShowHidden" parameter)+ //1 - published only+ //2 - unpublished only+ bool? overridePublished = model.SearchPublishedId switch {+ 1 => true,+ 2 => false,+ _ => null+ };++ var products = (await _productService.SearchProducts(+ categoryIds: categoryIds,+ brandId: model.SearchBrandId,+ collectionId: model.SearchCollectionId,+ vendorId: _workContext.CurrentVendor.Id,+ warehouseId: model.SearchWarehouseId,+ productType: model.SearchProductTypeId > 0 ? (ProductType?)model.SearchProductTypeId : null,+ keywords: model.SearchProductName,+ showHidden: true,+ overridePublished: overridePublished+ )).products;++ return products;+ }- return product;- }+ public virtual async Task<Product> InsertProductModel(ProductModel model)+ {+ //product+ var product = model.ToEntity(_dateTimeService);+ product.VendorId = _workContext.CurrentVendor!.Id;+ await _productService.InsertProduct(product);- public virtual async Task<Product> UpdateProductModel(Product product, ProductModel model)- {- var prevStockQuantity = _stockQuantityService.GetTotalStockQuantity(product, total: true);- var prevMultiWarehouseStock = product.ProductWarehouseInventory.Select(i => new ProductWarehouseInventory {- WarehouseId = i.WarehouseId, StockQuantity = i.StockQuantity, ReservedQuantity = i.ReservedQuantity- })- .ToList();+ model.SeName = await product.ValidateSeName(model.SeName, product.Name, true, _seoSettings, _slugService,+ _languageService);+ product.SeName = model.SeName;+ product.Locales = await model.Locales.ToTranslationProperty(product, x => x.Name,+ _seoSettings, _slugService, _languageService);- //product- product = model.ToEntity(product, _dateTimeService);- product.AutoAddRequiredProducts = model.AutoAddRequiredProducts;- model.SeName = await product.ValidateSeName(model.SeName, product.Name, true, _seoSettings, _slugService,- _languageService);- product.SeName = model.SeName;- product.Locales = await model.Locales.ToTranslationProperty(product, x => x.Name, _seoSettings,- _slugService, _languageService);-- //search engine name- await _slugService.SaveSlug(product, model.SeName, "");- //warehouses- await SaveProductWarehouseInventory(product, model.ProductWarehouseInventoryModels);- //picture seo names- await UpdatePictureSeoNames(product);+ //search engine name+ await _slugService.SaveSlug(product, model.SeName, "");+ //warehouses+ await SaveProductWarehouseInventory(product, model.ProductWarehouseInventoryModels);- await _productService.UpdateProduct(product);+ await _productService.UpdateProduct(product);- //out of stock notifications- await OutOfStockNotifications(product, prevStockQuantity, prevMultiWarehouseStock);+ return product;+ }- return product;- }+ public virtual async Task<Product> UpdateProductModel(Product product, ProductModel model)+ {+ var prevStockQuantity = _stockQuantityService.GetTotalStockQuantity(product, total: true);+ var prevMultiWarehouseStock = product.ProductWarehouseInventory.Select(i => new ProductWarehouseInventory {+ WarehouseId = i.WarehouseId, StockQuantity = i.StockQuantity, ReservedQuantity = i.ReservedQuantity+ })+ .ToList();++ //product+ product = model.ToEntity(product, _dateTimeService);+ product.AutoAddRequiredProducts = model.AutoAddRequiredProducts;+ model.SeName = await product.ValidateSeName(model.SeName, product.Name, true, _seoSettings, _slugService,+ _languageService);+ product.SeName = model.SeName;+ product.Locales = await model.Locales.ToTranslationProperty(product, x => x.Name, _seoSettings,+ _slugService, _languageService);++ //search engine name+ await _slugService.SaveSlug(product, model.SeName, "");+ //warehouses+ await SaveProductWarehouseInventory(product, model.ProductWarehouseInventoryModels);+ //picture seo names+ await UpdatePictureSeoNames(product);++ await _productService.UpdateProduct(product);++ //out of stock notifications+ await OutOfStockNotifications(product, prevStockQuantity, prevMultiWarehouseStock);++ return product;+ }- public virtual async Task DeleteProduct(Product product)- {- await _productService.DeleteProduct(product);- }+ public virtual async Task DeleteProduct(Product product)+ {+ await _productService.DeleteProduct(product);+ }- public virtual async Task DeleteSelected(IEnumerable<string> selectedIds)+ public virtual async Task DeleteSelected(IEnumerable<string> selectedIds)+ {+ var products = new List<Product>();+ products.AddRange(await _productService.GetProductsByIds(selectedIds.ToArray(), true));+ for (var i = 0; i < products.Count; i++){- var products = new List<Product>();- products.AddRange(await _productService.GetProductsByIds(selectedIds.ToArray(), true));- for (var i = 0; i < products.Count; i++)- {- var product = products[i];- //a vendor should have access only to his products- if (product.VendorId != _workContext.CurrentVendor.Id)- continue;-- await DeleteProduct(product);- }- }+ var product = products[i];+ //a vendor should have access only to his products+ if (product.VendorId != _workContext.CurrentVendor.Id)+ continue;- public virtual Task<ProductModel.AddRequiredProductModel> PrepareAddRequiredProductModel()- {- var model = PrepareAddProductModel<ProductModel.AddRequiredProductModel>();- return Task.FromResult(model);+ await DeleteProduct(product);}+ }- public virtual async Task<(IList<ProductModel> products, int totalCount)> PrepareProductModel(- ProductModel.AddProductModel model, int pageIndex, int pageSize)- {- var products = await _productService.PrepareProductList(model.SearchCategoryId, model.SearchBrandId,- model.SearchCollectionId, string.Empty, _workContext.CurrentVendor.Id, model.SearchProductTypeId,- model.SearchProductName, pageIndex, pageSize);- return (products.Select(x => x.ToModel(_dateTimeService)).ToList(), products.TotalCount);- }+ public virtual Task<ProductModel.AddRequiredProductModel> PrepareAddRequiredProductModel()+ {+ var model = PrepareAddProductModel<ProductModel.AddRequiredProductModel>();+ return Task.FromResult(model);+ }- public virtual async Task<IList<ProductModel.ProductCategoryModel>> PrepareProductCategoryModel(Product product)- {- var productCategories = product.ProductCategories.OrderBy(x => x.DisplayOrder);- var items = new List<ProductModel.ProductCategoryModel>();- foreach (var x in productCategories)- {- var category = await _categoryService.GetCategoryById(x.CategoryId);- items.Add(new ProductModel.ProductCategoryModel {- Id = x.Id,- Category = await _categoryService.GetFormattedBreadCrumb(category),- ProductId = product.Id,- CategoryId = x.CategoryId,- DisplayOrder = x.DisplayOrder- });- }+ public virtual async Task<(IList<ProductModel> products, int totalCount)> PrepareProductModel(+ ProductModel.AddProductModel model, int pageIndex, int pageSize)+ {+ var products = await _productService.PrepareProductList(model.SearchCategoryId, model.SearchBrandId,+ model.SearchCollectionId, string.Empty, _workContext.CurrentVendor.Id, model.SearchProductTypeId,+ model.SearchProductName, pageIndex, pageSize);+ return (products.Select(x => x.ToModel(_dateTimeService)).ToList(), products.TotalCount);+ }- return items;+ public virtual async Task<IList<ProductModel.ProductCategoryModel>> PrepareProductCategoryModel(Product product)+ {+ var productCategories = product.ProductCategories.OrderBy(x => x.DisplayOrder);+ var items = new List<ProductModel.ProductCategoryModel>();+ foreach (var x in productCategories)+ {+ var category = await _categoryService.GetCategoryById(x.CategoryId);+ items.Add(new ProductModel.ProductCategoryModel {+ Id = x.Id,+ Category = await _categoryService.GetFormattedBreadCrumb(category),+ ProductId = product.Id,+ CategoryId = x.CategoryId,+ DisplayOrder = x.DisplayOrder+ });}- public virtual async Task InsertProductCategoryModel(ProductModel.ProductCategoryModel model)- {- var product = await _productService.GetProductById(model.ProductId, true);+ return items;+ }- if (product.ProductCategories.All(x => x.CategoryId != model.CategoryId))- {- var productCategory = new ProductCategory {- CategoryId = model.CategoryId,- DisplayOrder = model.DisplayOrder- };- await _productCategoryService.InsertProductCategory(productCategory, product.Id);- }- }+ public virtual async Task InsertProductCategoryModel(ProductModel.ProductCategoryModel model)+ {+ var product = await _productService.GetProductById(model.ProductId, true);- public virtual async Task UpdateProductCategoryModel(ProductModel.ProductCategoryModel model)+ if (product.ProductCategories.All(x => x.CategoryId != model.CategoryId)){- var product = await _productService.GetProductById(model.ProductId, true);+ var productCategory = new ProductCategory {+ CategoryId = model.CategoryId,+ DisplayOrder = model.DisplayOrder+ };+ await _productCategoryService.InsertProductCategory(productCategory, product.Id);+ }+ }- var productCategory = product.ProductCategories.FirstOrDefault(x => x.Id == model.Id);- if (productCategory == null)- throw new ArgumentException("No product category mapping found with the specified id");+ public virtual async Task UpdateProductCategoryModel(ProductModel.ProductCategoryModel model)+ {+ var product = await _productService.GetProductById(model.ProductId, true);- if (product.ProductCategories.Any(x => x.Id != model.Id && x.CategoryId == model.CategoryId))- throw new ArgumentException("This category is already mapped with this product");- productCategory.CategoryId = model.CategoryId;- productCategory.DisplayOrder = model.DisplayOrder;+ var productCategory = product.ProductCategories.FirstOrDefault(x => x.Id == model.Id);+ if (productCategory == null)+ throw new ArgumentException("No product category mapping found with the specified id");- await _productCategoryService.UpdateProductCategory(productCategory, product.Id);- }+ if (product.ProductCategories.Any(x => x.Id != model.Id && x.CategoryId == model.CategoryId))+ throw new ArgumentException("This category is already mapped with this product");+ productCategory.CategoryId = model.CategoryId;+ productCategory.DisplayOrder = model.DisplayOrder;- public virtual async Task DeleteProductCategory(string id, string productId)- {- var product = await _productService.GetProductById(productId, true);+ await _productCategoryService.UpdateProductCategory(productCategory, product.Id);+ }- var productCategory = product.ProductCategories.FirstOrDefault(x => x.Id == id);- if (productCategory == null)- throw new ArgumentException("No product category mapping found with the specified id");+ public virtual async Task DeleteProductCategory(string id, string productId)+ {+ var product = await _productService.GetProductById(productId, true);- await _productCategoryService.DeleteProductCategory(productCategory, product.Id);- }+ var productCategory = product.ProductCategories.FirstOrDefault(x => x.Id == id);+ if (productCategory == null)+ throw new ArgumentException("No product category mapping found with the specified id");- public virtual async Task<IList<ProductModel.ProductCollectionModel>> PrepareProductCollectionModel(- Product product)- {- var items = new List<ProductModel.ProductCollectionModel>();- foreach (var x in product.ProductCollections.OrderBy(x => x.DisplayOrder))- {- items.Add(new ProductModel.ProductCollectionModel {- Id = x.Id,- Collection = (await _collectionService.GetCollectionById(x.CollectionId)).Name,- ProductId = product.Id,- CollectionId = x.CollectionId,- DisplayOrder = x.DisplayOrder- });- }+ await _productCategoryService.DeleteProductCategory(productCategory, product.Id);+ }- return items;- }+ public virtual async Task<IList<ProductModel.ProductCollectionModel>> PrepareProductCollectionModel(+ Product product)+ {+ var items = new List<ProductModel.ProductCollectionModel>();+ foreach (var x in product.ProductCollections.OrderBy(x => x.DisplayOrder))+ items.Add(new ProductModel.ProductCollectionModel {+ Id = x.Id,+ Collection = (await _collectionService.GetCollectionById(x.CollectionId)).Name,+ ProductId = product.Id,+ CollectionId = x.CollectionId,+ DisplayOrder = x.DisplayOrder+ });- public virtual async Task InsertProductCollection(ProductModel.ProductCollectionModel model)- {- var collectionId = model.CollectionId;- var product = await _productService.GetProductById(model.ProductId, true);+ return items;+ }- if (product.ProductCollections.All(x => x.CollectionId != collectionId))- {- var productCollection = new ProductCollection {- CollectionId = collectionId,- DisplayOrder = model.DisplayOrder- };- await _productCollectionService.InsertProductCollection(productCollection, model.ProductId);- }- }+ public virtual async Task InsertProductCollection(ProductModel.ProductCollectionModel model)+ {+ var collectionId = model.CollectionId;+ var product = await _productService.GetProductById(model.ProductId, true);- public virtual async Task UpdateProductCollection(ProductModel.ProductCollectionModel model)+ if (product.ProductCollections.All(x => x.CollectionId != collectionId)){- var product = await _productService.GetProductById(model.ProductId, true);+ var productCollection = new ProductCollection {+ CollectionId = collectionId,+ DisplayOrder = model.DisplayOrder+ };+ await _productCollectionService.InsertProductCollection(productCollection, model.ProductId);+ }+ }- var productCollection = product.ProductCollections.FirstOrDefault(x => x.Id == model.Id);- if (productCollection == null)- throw new ArgumentException("No product collection mapping found with the specified id");+ public virtual async Task UpdateProductCollection(ProductModel.ProductCollectionModel model)+ {+ var product = await _productService.GetProductById(model.ProductId, true);- if (product.ProductCollections.Any(x => x.Id != model.Id && x.CollectionId == model.CollectionId))- throw new ArgumentException("This collection is already mapped with this product");+ var productCollection = product.ProductCollections.FirstOrDefault(x => x.Id == model.Id);+ if (productCollection == null)+ throw new ArgumentException("No product collection mapping found with the specified id");- productCollection.CollectionId = model.CollectionId;- productCollection.DisplayOrder = model.DisplayOrder;+ if (product.ProductCollections.Any(x => x.Id != model.Id && x.CollectionId == model.CollectionId))+ throw new ArgumentException("This collection is already mapped with this product");- await _productCollectionService.UpdateProductCollection(productCollection, product.Id);- }+ productCollection.CollectionId = model.CollectionId;+ productCollection.DisplayOrder = model.DisplayOrder;- public virtual async Task DeleteProductCollection(string id, string productId)- {- var product = await _productService.GetProductById(productId, true);+ await _productCollectionService.UpdateProductCollection(productCollection, product.Id);+ }- var productCollection = product.ProductCollections.FirstOrDefault(x => x.Id == id);- if (productCollection == null)- throw new ArgumentException("No product collection mapping found with the specified id");+ public virtual async Task DeleteProductCollection(string id, string productId)+ {+ var product = await _productService.GetProductById(productId, true);- await _productCollectionService.DeleteProductCollection(productCollection, product.Id);- }+ var productCollection = product.ProductCollections.FirstOrDefault(x => x.Id == id);+ if (productCollection == null)+ throw new ArgumentException("No product collection mapping found with the specified id");- public virtual async Task InsertRelatedProductModel(ProductModel.AddRelatedProductModel model)+ await _productCollectionService.DeleteProductCollection(productCollection, product.Id);+ }++ public virtual async Task InsertRelatedProductModel(ProductModel.AddRelatedProductModel model)+ {+ var productId1 = await _productService.GetProductById(model.ProductId, true);++ foreach (var id in model.SelectedProductIds){- var productId1 = await _productService.GetProductById(model.ProductId, true);+ var product = await _productService.GetProductById(id);+ if (product == null || product.VendorId != _workContext.CurrentVendor.Id) continue;- foreach (var id in model.SelectedProductIds)+ var existingRelatedProducts = productId1.RelatedProducts;+ if (model.ProductId == id) continue;+ if (existingRelatedProducts.All(x => x.ProductId2 != id)){- var product = await _productService.GetProductById(id);- if (product == null || product.VendorId != _workContext.CurrentVendor.Id) continue;-- var existingRelatedProducts = productId1.RelatedProducts;- if (model.ProductId == id) continue;- if (existingRelatedProducts.All(x => x.ProductId2 != id))- {- var related = new RelatedProduct {- ProductId2 = id,- DisplayOrder = 1- };- productId1.RelatedProducts.Add(related);- await _productService.InsertRelatedProduct(related, model.ProductId);- }+ var related = new RelatedProduct {+ ProductId2 = id,+ DisplayOrder = 1+ };+ productId1.RelatedProducts.Add(related);+ await _productService.InsertRelatedProduct(related, model.ProductId);}}+ }- public virtual async Task UpdateRelatedProductModel(ProductModel.RelatedProductModel model)- {- var product1 = await _productService.GetProductById(model.ProductId1, true);+ public virtual async Task UpdateRelatedProductModel(ProductModel.RelatedProductModel model)+ {+ var product1 = await _productService.GetProductById(model.ProductId1, true);- var relatedProduct = product1.RelatedProducts.FirstOrDefault(x => x.Id == model.Id);- if (relatedProduct == null)- throw new ArgumentException("No related product found with the specified id");+ var relatedProduct = product1.RelatedProducts.FirstOrDefault(x => x.Id == model.Id);+ if (relatedProduct == null)+ throw new ArgumentException("No related product found with the specified id");- relatedProduct.DisplayOrder = model.DisplayOrder;- await _productService.UpdateRelatedProduct(relatedProduct, model.ProductId1);- }+ relatedProduct.DisplayOrder = model.DisplayOrder;+ await _productService.UpdateRelatedProduct(relatedProduct, model.ProductId1);+ }- public virtual async Task DeleteRelatedProductModel(ProductModel.RelatedProductModel model)- {- var product = await _productService.GetProductById(model.ProductId1, true);+ public virtual async Task DeleteRelatedProductModel(ProductModel.RelatedProductModel model)+ {+ var product = await _productService.GetProductById(model.ProductId1, true);- var relatedProduct = product.RelatedProducts.FirstOrDefault(x => x.Id == model.Id);- if (relatedProduct == null)- throw new ArgumentException("No related product found with the specified id");+ var relatedProduct = product.RelatedProducts.FirstOrDefault(x => x.Id == model.Id);+ if (relatedProduct == null)+ throw new ArgumentException("No related product found with the specified id");- await _productService.DeleteRelatedProduct(relatedProduct, model.ProductId1);- }+ await _productService.DeleteRelatedProduct(relatedProduct, model.ProductId1);+ }- public virtual async Task InsertSimilarProductModel(ProductModel.AddSimilarProductModel model)+ public virtual async Task InsertSimilarProductModel(ProductModel.AddSimilarProductModel model)+ {+ var productId1 = await _productService.GetProductById(model.ProductId, true);+ foreach (var id in model.SelectedProductIds){- var productId1 = await _productService.GetProductById(model.ProductId, true);- foreach (var id in model.SelectedProductIds)+ var product = await _productService.GetProductById(id);+ if (product != null && productId1.VendorId == _workContext.CurrentVendor.Id){- var product = await _productService.GetProductById(id);- if (product != null && productId1.VendorId == _workContext.CurrentVendor.Id)- {- var existingSimilarProducts = productId1.SimilarProducts;- if (model.ProductId != id)- if (existingSimilarProducts.All(x => x.ProductId2 != id))- {- var similar = new SimilarProduct {- ProductId1 = model.ProductId,- ProductId2 = id,- DisplayOrder = 1- };- productId1.SimilarProducts.Add(similar);- await _productService.InsertSimilarProduct(similar);- }- }+ var existingSimilarProducts = productId1.SimilarProducts;+ if (model.ProductId != id)+ if (existingSimilarProducts.All(x => x.ProductId2 != id))+ {+ var similar = new SimilarProduct {+ ProductId1 = model.ProductId,+ ProductId2 = id,+ DisplayOrder = 1+ };+ productId1.SimilarProducts.Add(similar);+ await _productService.InsertSimilarProduct(similar);+ }}}+ }- public virtual async Task UpdateSimilarProductModel(ProductModel.SimilarProductModel model)- {- var product1 = await _productService.GetProductById(model.ProductId1, true);- var similarProduct = product1.SimilarProducts.FirstOrDefault(x => x.Id == model.Id);- if (similarProduct == null)- throw new ArgumentException("No similar product found with the specified id");-- similarProduct.ProductId1 = model.ProductId1;- similarProduct.DisplayOrder = model.DisplayOrder;- await _productService.UpdateSimilarProduct(similarProduct);- }+ public virtual async Task UpdateSimilarProductModel(ProductModel.SimilarProductModel model)+ {+ var product1 = await _productService.GetProductById(model.ProductId1, true);+ var similarProduct = product1.SimilarProducts.FirstOrDefault(x => x.Id == model.Id);+ if (similarProduct == null)+ throw new ArgumentException("No similar product found with the specified id");++ similarProduct.ProductId1 = model.ProductId1;+ similarProduct.DisplayOrder = model.DisplayOrder;+ await _productService.UpdateSimilarProduct(similarProduct);+ }- public virtual async Task DeleteSimilarProductModel(ProductModel.SimilarProductModel model)- {- var product = await _productService.GetProductById(model.ProductId1, true);- var similarProduct = product.SimilarProducts.FirstOrDefault(x => x.Id == model.Id);- if (similarProduct == null)- throw new ArgumentException("No similar product found with the specified id");+ public virtual async Task DeleteSimilarProductModel(ProductModel.SimilarProductModel model)+ {+ var product = await _productService.GetProductById(model.ProductId1, true);+ var similarProduct = product.SimilarProducts.FirstOrDefault(x => x.Id == model.Id);+ if (similarProduct == null)+ throw new ArgumentException("No similar product found with the specified id");- similarProduct.ProductId1 = model.ProductId1;- await _productService.DeleteSimilarProduct(similarProduct);- }+ similarProduct.ProductId1 = model.ProductId1;+ await _productService.DeleteSimilarProduct(similarProduct);+ }- public virtual async Task InsertBundleProductModel(ProductModel.AddBundleProductModel model)- {- var productId1 = await _productService.GetProductById(model.ProductId, true);+ public virtual async Task InsertBundleProductModel(ProductModel.AddBundleProductModel model)+ {+ var productId1 = await _productService.GetProductById(model.ProductId, true);- foreach (var id in model.SelectedProductIds)+ foreach (var id in model.SelectedProductIds)+ {+ var product = await _productService.GetProductById(id);+ if (product != null && productId1.VendorId == _workContext.CurrentVendor.Id){- var product = await _productService.GetProductById(id);- if (product != null && productId1.VendorId == _workContext.CurrentVendor.Id)- {- var existingBundleProducts = productId1.BundleProducts;- if (model.ProductId != id)- if (existingBundleProducts.All(x => x.ProductId != id))- {- var bundle = new BundleProduct {- ProductId = id,- DisplayOrder = 1,- Quantity = 1- };- productId1.BundleProducts.Add(bundle);- await _productService.InsertBundleProduct(bundle, model.ProductId);- }- }+ var existingBundleProducts = productId1.BundleProducts;+ if (model.ProductId != id)+ if (existingBundleProducts.All(x => x.ProductId != id))+ {+ var bundle = new BundleProduct {+ ProductId = id,+ DisplayOrder = 1,+ Quantity = 1+ };+ productId1.BundleProducts.Add(bundle);+ await _productService.InsertBundleProduct(bundle, model.ProductId);+ }}}+ }- public virtual async Task UpdateBundleProductModel(ProductModel.BundleProductModel model)- {- var product = await _productService.GetProductById(model.ProductBundleId, true);- var bundleProduct = product.BundleProducts.FirstOrDefault(x => x.Id == model.Id);- if (bundleProduct == null)- throw new ArgumentException("No bundle product found with the specified id");-- bundleProduct.ProductId = model.ProductId;- bundleProduct.Quantity = model.Quantity > 0 ? model.Quantity : 1;- bundleProduct.DisplayOrder = model.DisplayOrder;- await _productService.UpdateBundleProduct(bundleProduct, model.ProductBundleId);- }+ public virtual async Task UpdateBundleProductModel(ProductModel.BundleProductModel model)+ {+ var product = await _productService.GetProductById(model.ProductBundleId, true);+ var bundleProduct = product.BundleProducts.FirstOrDefault(x => x.Id == model.Id);+ if (bundleProduct == null)+ throw new ArgumentException("No bundle product found with the specified id");++ bundleProduct.ProductId = model.ProductId;+ bundleProduct.Quantity = model.Quantity > 0 ? model.Quantity : 1;+ bundleProduct.DisplayOrder = model.DisplayOrder;+ await _productService.UpdateBundleProduct(bundleProduct, model.ProductBundleId);+ }- public virtual async Task DeleteBundleProductModel(ProductModel.BundleProductModel model)- {- var product = await _productService.GetProductById(model.ProductBundleId, true);- var bundleProduct = product.BundleProducts.FirstOrDefault(x => x.Id == model.Id);- if (bundleProduct == null)- throw new ArgumentException("No bundle product found with the specified id");+ public virtual async Task DeleteBundleProductModel(ProductModel.BundleProductModel model)+ {+ var product = await _productService.GetProductById(model.ProductBundleId, true);+ var bundleProduct = product.BundleProducts.FirstOrDefault(x => x.Id == model.Id);+ if (bundleProduct == null)+ throw new ArgumentException("No bundle product found with the specified id");++ await _productService.DeleteBundleProduct(bundleProduct, model.ProductBundleId);+ }- await _productService.DeleteBundleProduct(bundleProduct, model.ProductBundleId);+ public virtual async Task InsertCrossSellProductModel(ProductModel.AddCrossSellProductModel model)+ {+ var crossSellProduct = await _productService.GetProductById(model.ProductId, true);+ foreach (var id in model.SelectedProductIds)+ {+ var product = await _productService.GetProductById(id);+ if (product != null && product.VendorId == _workContext.CurrentVendor.Id &&+ crossSellProduct.CrossSellProduct.All(x => x != id))+ if (model.ProductId != id)+ await _productService.InsertCrossSellProduct(+ new CrossSellProduct {+ ProductId1 = model.ProductId,+ ProductId2 = id+ });}+ }- public virtual async Task InsertCrossSellProductModel(ProductModel.AddCrossSellProductModel model)+ public virtual async Task DeleteCrossSellProduct(string productId, string crossSellProductId)+ {+ var crosssell = new CrossSellProduct {+ ProductId1 = productId,+ ProductId2 = crossSellProductId+ };+ await _productService.DeleteCrossSellProduct(crosssell);+ }++ public virtual async Task InsertRecommendedProductModel(ProductModel.AddRecommendedProductModel model)+ {+ var mainproduct = await _productService.GetProductById(model.ProductId, true);+ foreach (var id in model.SelectedProductIds){- var crossSellProduct = await _productService.GetProductById(model.ProductId, true);- foreach (var id in model.SelectedProductIds)- {- var product = await _productService.GetProductById(id);- if (product != null && product.VendorId == _workContext.CurrentVendor.Id &&- crossSellProduct.CrossSellProduct.All(x => x != id))- {+ var product = await _productService.GetProductById(id);+ if (product != null && product.VendorId == _workContext.CurrentVendor.Id)+ if (mainproduct.RecommendedProduct.All(x => x != id))if (model.ProductId != id)- await _productService.InsertCrossSellProduct(- new CrossSellProduct {- ProductId1 = model.ProductId,- ProductId2 = id- });- }- }+ await _productService.InsertRecommendedProduct(model.ProductId, id);}+ }- public virtual async Task DeleteCrossSellProduct(string productId, string crossSellProductId)- {- var crosssell = new CrossSellProduct {- ProductId1 = productId,- ProductId2 = crossSellProductId- };- await _productService.DeleteCrossSellProduct(crosssell);- }+ public virtual async Task DeleteRecommendedProduct(string productId, string recommendedProductId)+ {+ await _productService.DeleteRecommendedProduct(productId, recommendedProductId);+ }- public virtual async Task InsertRecommendedProductModel(ProductModel.AddRecommendedProductModel model)+ public virtual async Task InsertAssociatedProductModel(ProductModel.AddAssociatedProductModel model)+ {+ foreach (var id in model.SelectedProductIds){- var mainproduct = await _productService.GetProductById(model.ProductId, true);- foreach (var id in model.SelectedProductIds)- {- var product = await _productService.GetProductById(id);- if (product != null && product.VendorId == _workContext.CurrentVendor.Id)- {- if (mainproduct.RecommendedProduct.All(x => x != id))- {- if (model.ProductId != id)- await _productService.InsertRecommendedProduct(model.ProductId, id);- }- }- }+ var product = await _productService.GetProductById(id);+ if (product == null || product.VendorId != _workContext.CurrentVendor.Id) continue;+ product.ParentGroupedProductId = model.ProductId;+ await _productService.UpdateAssociatedProduct(product);}+ }- public virtual async Task DeleteRecommendedProduct(string productId, string recommendedProductId)- {- await _productService.DeleteRecommendedProduct(productId, recommendedProductId);- }+ public virtual async Task DeleteAssociatedProduct(Product product)+ {+ product.ParentGroupedProductId = "";+ await _productService.UpdateAssociatedProduct(product);+ }- public virtual async Task InsertAssociatedProductModel(ProductModel.AddAssociatedProductModel model)- {- foreach (var id in model.SelectedProductIds)- {- var product = await _productService.GetProductById(id);- if (product == null || product.VendorId != _workContext.CurrentVendor.Id) continue;- product.ParentGroupedProductId = model.ProductId;- await _productService.UpdateAssociatedProduct(product);- }- }+ public virtual Task<ProductModel.AddRelatedProductModel> PrepareRelatedProductModel()+ {+ var model = PrepareAddProductModel<ProductModel.AddRelatedProductModel>();+ return Task.FromResult(model);+ }- public virtual async Task DeleteAssociatedProduct(Product product)- {- product.ParentGroupedProductId = "";- await _productService.UpdateAssociatedProduct(product);- }+ public virtual Task<ProductModel.AddSimilarProductModel> PrepareSimilarProductModel()+ {+ var model = PrepareAddProductModel<ProductModel.AddSimilarProductModel>();+ return Task.FromResult(model);+ }- public virtual Task<ProductModel.AddRelatedProductModel> PrepareRelatedProductModel()- {- var model = PrepareAddProductModel<ProductModel.AddRelatedProductModel>();- return Task.FromResult(model);- }+ public virtual Task<ProductModel.AddBundleProductModel> PrepareBundleProductModel()+ {+ var model = PrepareAddProductModel<ProductModel.AddBundleProductModel>();+ return Task.FromResult(model);+ }- public virtual Task<ProductModel.AddSimilarProductModel> PrepareSimilarProductModel()- {- var model = PrepareAddProductModel<ProductModel.AddSimilarProductModel>();- return Task.FromResult(model);- }+ public virtual Task<ProductModel.AddCrossSellProductModel> PrepareCrossSellProductModel()+ {+ var model = PrepareAddProductModel<ProductModel.AddCrossSellProductModel>();+ return Task.FromResult(model);+ }- public virtual Task<ProductModel.AddBundleProductModel> PrepareBundleProductModel()- {- var model = PrepareAddProductModel<ProductModel.AddBundleProductModel>();- return Task.FromResult(model);- }+ public virtual Task<ProductModel.AddRecommendedProductModel> PrepareRecommendedProductModel()+ {+ var model = PrepareAddProductModel<ProductModel.AddRecommendedProductModel>();+ return Task.FromResult(model);+ }- public virtual Task<ProductModel.AddCrossSellProductModel> PrepareCrossSellProductModel()- {- var model = PrepareAddProductModel<ProductModel.AddCrossSellProductModel>();- return Task.FromResult(model);- }+ public virtual Task<ProductModel.AddAssociatedProductModel> PrepareAssociatedProductModel()+ {+ var model = PrepareAddProductModel<ProductModel.AddAssociatedProductModel>();+ return Task.FromResult(model);+ }- public virtual Task<ProductModel.AddRecommendedProductModel> PrepareRecommendedProductModel()- {- var model = PrepareAddProductModel<ProductModel.AddRecommendedProductModel>();- return Task.FromResult(model);- }+ public virtual Task<BulkEditListModel> PrepareBulkEditListModel()+ {+ var model = new BulkEditListModel {+ //product types+ AvailableProductTypes = ProductType.SimpleProduct+ .ToSelectList(_translationService, _workContext, false).ToList()+ };- public virtual Task<ProductModel.AddAssociatedProductModel> PrepareAssociatedProductModel()- {- var model = PrepareAddProductModel<ProductModel.AddAssociatedProductModel>();- return Task.FromResult(model);- }+ model.AvailableProductTypes.Insert(0,+ new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = "0" });- public virtual Task<BulkEditListModel> PrepareBulkEditListModel()- {- var model = new BulkEditListModel {- //product types- AvailableProductTypes = ProductType.SimpleProduct- .ToSelectList(_translationService, _workContext, false).ToList()+ return Task.FromResult(model);+ }++ public virtual async Task<(IEnumerable<BulkEditProductModel> bulkEditProductModels, int totalCount)>+ PrepareBulkEditProductModel(BulkEditListModel model, int pageIndex, int pageSize)+ {+ var searchCategoryIds = new List<string>();+ if (!string.IsNullOrEmpty(model.SearchCategoryId))+ searchCategoryIds.Add(model.SearchCategoryId);++ var products = (await _productService.SearchProducts(categoryIds: searchCategoryIds,+ brandId: model.SearchBrandId,+ collectionId: model.SearchCollectionId,+ vendorId: _workContext.CurrentVendor.Id,+ productType: model.SearchProductTypeId > 0 ? (ProductType?)model.SearchProductTypeId : null,+ keywords: model.SearchProductName,+ pageIndex: pageIndex - 1,+ pageSize: pageSize,+ showHidden: true)).products;++ return (products.Select((Func<Product, BulkEditProductModel>)(x =>+ {+ var productModel = new BulkEditProductModel {+ Id = x.Id,+ Name = x.Name,+ Sku = x.Sku,+ OldPrice = x.OldPrice,+ Price = x.Price,+ ManageInventoryMethodId = (int)x.ManageInventoryMethodId,+ ManageInventoryMethod =+ x.ManageInventoryMethodId.GetTranslationEnum(_translationService,+ _workContext.WorkingLanguage.Id),+ StockQuantity = x.StockQuantity,+ Published = x.Published};+ return productModel;+ })), products.TotalCount);+ }- model.AvailableProductTypes.Insert(0,- new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = "0" });+ public virtual async Task UpdateBulkEdit(IEnumerable<BulkEditProductModel> products)+ {+ foreach (var pModel in products)+ {+ //update+ var product = await _productService.GetProductById(pModel.Id, true);+ if (product == null || product.VendorId != _workContext.CurrentVendor.Id) continue;- return Task.FromResult(model);- }+ var prevStockQuantity = _stockQuantityService.GetTotalStockQuantity(product, total: true);- public virtual async Task<(IEnumerable<BulkEditProductModel> bulkEditProductModels, int totalCount)>- PrepareBulkEditProductModel(BulkEditListModel model, int pageIndex, int pageSize)- {- var searchCategoryIds = new List<string>();- if (!string.IsNullOrEmpty(model.SearchCategoryId))- searchCategoryIds.Add(model.SearchCategoryId);-- var products = (await _productService.SearchProducts(categoryIds: searchCategoryIds,- brandId: model.SearchBrandId,- collectionId: model.SearchCollectionId,- vendorId: _workContext.CurrentVendor.Id,- productType: model.SearchProductTypeId > 0 ? (ProductType?)model.SearchProductTypeId : null,- keywords: model.SearchProductName,- pageIndex: pageIndex - 1,- pageSize: pageSize,- showHidden: true)).products;-- return (products.Select((Func<Product, BulkEditProductModel>)(x =>- {- var productModel = new BulkEditProductModel {- Id = x.Id,- Name = x.Name,- Sku = x.Sku,- OldPrice = x.OldPrice,- Price = x.Price,- ManageInventoryMethodId = (int)x.ManageInventoryMethodId,- ManageInventoryMethod =- x.ManageInventoryMethodId.GetTranslationEnum(_translationService,- _workContext.WorkingLanguage.Id),- StockQuantity = x.StockQuantity,- Published = x.Published- };- return productModel;- })), products.TotalCount);- }+ product.Sku = pModel.Sku;+ product.Price = pModel.Price;+ product.OldPrice = pModel.OldPrice;+ product.StockQuantity = pModel.StockQuantity;+ product.Published = pModel.Published;+ product.Name = pModel.Name;+ product.ManageInventoryMethodId = (ManageInventoryMethod)pModel.ManageInventoryMethodId;+ await _productService.UpdateProduct(product);- public virtual async Task UpdateBulkEdit(IEnumerable<BulkEditProductModel> products)- {- foreach (var pModel in products)- {- //update- var product = await _productService.GetProductById(pModel.Id, true);- if (product == null || product.VendorId != _workContext.CurrentVendor.Id) continue;-- var prevStockQuantity = _stockQuantityService.GetTotalStockQuantity(product, total: true);-- product.Sku = pModel.Sku;- product.Price = pModel.Price;- product.OldPrice = pModel.OldPrice;- product.StockQuantity = pModel.StockQuantity;- product.Published = pModel.Published;- product.Name = pModel.Name;- product.ManageInventoryMethodId = (ManageInventoryMethod)pModel.ManageInventoryMethodId;- await _productService.UpdateProduct(product);-- //out of stock notifications- if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStock &&- product.BackorderModeId == BackorderMode.NoBackorders &&- product.AllowOutOfStockSubscriptions &&- _stockQuantityService.GetTotalStockQuantity(product, total: true) > 0 &&- prevStockQuantity <= 0 && !product.UseMultipleWarehouses &&- product.Published)- {- await _outOfStockSubscriptionService.SendNotificationsToSubscribers(product, "");- }- }+ //out of stock notifications+ if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStock &&+ product.BackorderModeId == BackorderMode.NoBackorders &&+ product.AllowOutOfStockSubscriptions &&+ _stockQuantityService.GetTotalStockQuantity(product, total: true) > 0 &&+ prevStockQuantity <= 0 && !product.UseMultipleWarehouses &&+ product.Published)+ await _outOfStockSubscriptionService.SendNotificationsToSubscribers(product, "");}+ }- public virtual async Task DeleteBulkEdit(IEnumerable<BulkEditProductModel> products)+ public virtual async Task DeleteBulkEdit(IEnumerable<BulkEditProductModel> products)+ {+ foreach (var pModel in products){- foreach (var pModel in products)- {- //delete- var product = await _productService.GetProductById(pModel.Id, true);- if (product == null || product.VendorId != _workContext.CurrentVendor.Id) continue;+ //delete+ var product = await _productService.GetProductById(pModel.Id, true);+ if (product == null || product.VendorId != _workContext.CurrentVendor.Id) continue;- await _productService.DeleteProduct(product);- }+ await _productService.DeleteProduct(product);}+ }- public virtual Task<IList<ProductModel.TierPriceModel>> PrepareTierPriceModel(Product product)- {- var items = new List<ProductModel.TierPriceModel>();- foreach (var x in product.TierPrices- .OrderBy(x => x.StoreId)- .ThenBy(x => x.Quantity))- {- items.Add(new ProductModel.TierPriceModel {- Id = x.Id,- CurrencyCode = x.CurrencyCode,- ProductId = product.Id,- Quantity = x.Quantity,- Price = x.Price,- StartDateTime = x.StartDateTimeUtc.HasValue- ? _dateTimeService.ConvertToUserTime(x.StartDateTimeUtc.Value, DateTimeKind.Utc)- : new DateTime?(),- EndDateTime = x.EndDateTimeUtc.HasValue- ? _dateTimeService.ConvertToUserTime(x.EndDateTimeUtc.Value, DateTimeKind.Utc)- : new DateTime?()- });- }+ public virtual Task<IList<ProductModel.TierPriceModel>> PrepareTierPriceModel(Product product)+ {+ var items = new List<ProductModel.TierPriceModel>();+ foreach (var x in product.TierPrices+ .OrderBy(x => x.StoreId)+ .ThenBy(x => x.Quantity))+ items.Add(new ProductModel.TierPriceModel {+ Id = x.Id,+ CurrencyCode = x.CurrencyCode,+ ProductId = product.Id,+ Quantity = x.Quantity,+ Price = x.Price,+ StartDateTime = x.StartDateTimeUtc.HasValue+ ? _dateTimeService.ConvertToUserTime(x.StartDateTimeUtc.Value, DateTimeKind.Utc)+ : new DateTime?(),+ EndDateTime = x.EndDateTimeUtc.HasValue+ ? _dateTimeService.ConvertToUserTime(x.EndDateTimeUtc.Value, DateTimeKind.Utc)+ : new DateTime?()+ });- return Task.FromResult<IList<ProductModel.TierPriceModel>>(items);- }+ return Task.FromResult<IList<ProductModel.TierPriceModel>>(items);+ }- public virtual async Task<(IEnumerable<ProductModel.BidModel> bidModels, int totalCount)> PrepareBidMode(- string productId, int pageIndex, int pageSize)- {- var bids = await _auctionService.GetBidsByProductId(productId, pageIndex - 1, pageSize);- var bidsModel = new List<ProductModel.BidModel>();- foreach (var x in bids)- {- bidsModel.Add(new ProductModel.BidModel {- BidId = x.Id,- ProductId = x.ProductId,- Amount = _priceFormatter.FormatPrice(x.Amount),- Date = _dateTimeService.ConvertToUserTime(x.Date, DateTimeKind.Utc),- CustomerId = x.CustomerId,- Email = (await _customerService.GetCustomerById(x.CustomerId))?.Email,- OrderId = x.OrderId- });- }+ public virtual async Task<(IEnumerable<ProductModel.BidModel> bidModels, int totalCount)> PrepareBidMode(+ string productId, int pageIndex, int pageSize)+ {+ var bids = await _auctionService.GetBidsByProductId(productId, pageIndex - 1, pageSize);+ var bidsModel = new List<ProductModel.BidModel>();+ foreach (var x in bids)+ bidsModel.Add(new ProductModel.BidModel {+ BidId = x.Id,+ ProductId = x.ProductId,+ Amount = _priceFormatter.FormatPrice(x.Amount),+ Date = _dateTimeService.ConvertToUserTime(x.Date, DateTimeKind.Utc),+ CustomerId = x.CustomerId,+ Email = (await _customerService.GetCustomerById(x.CustomerId))?.Email,+ OrderId = x.OrderId+ });- return (bidsModel, bids.TotalCount);- }+ return (bidsModel, bids.TotalCount);+ }- public virtual async Task<ProductModel.ProductAttributeMappingModel> PrepareProductAttributeMappingModel(- Product product)- {- var model = new ProductModel.ProductAttributeMappingModel {- ProductId = product.Id- };- foreach (var attribute in await _productAttributeService.GetAllProductAttributes())- {- model.AvailableProductAttribute.Add(new SelectListItem {- Value = attribute.Id,- Text = attribute.Name- });- }+ public virtual async Task<ProductModel.ProductAttributeMappingModel> PrepareProductAttributeMappingModel(+ Product product)+ {+ var model = new ProductModel.ProductAttributeMappingModel {+ ProductId = product.Id+ };+ foreach (var attribute in await _productAttributeService.GetAllProductAttributes())+ model.AvailableProductAttribute.Add(new SelectListItem {+ Value = attribute.Id,+ Text = attribute.Name+ });- return model;- }+ return model;+ }- public virtual async Task<ProductModel.ProductAttributeMappingModel> PrepareProductAttributeMappingModel(- ProductAttributeMapping productAttributeMapping)- {- var model = productAttributeMapping.ToModel();- foreach (var attribute in await _productAttributeService.GetAllProductAttributes())- {- model.AvailableProductAttribute.Add(new SelectListItem {- Value = attribute.Id,- Text = attribute.Name,- Selected = attribute.Id == model.ProductAttributeId- });- }+ public virtual async Task<ProductModel.ProductAttributeMappingModel> PrepareProductAttributeMappingModel(+ ProductAttributeMapping productAttributeMapping)+ {+ var model = productAttributeMapping.ToModel();+ foreach (var attribute in await _productAttributeService.GetAllProductAttributes())+ model.AvailableProductAttribute.Add(new SelectListItem {+ Value = attribute.Id,+ Text = attribute.Name,+ Selected = attribute.Id == model.ProductAttributeId+ });- return model;- }+ return model;+ }- public virtual async Task<ProductModel.ProductAttributeMappingModel> PrepareProductAttributeMappingModel(- ProductModel.ProductAttributeMappingModel model)- {- foreach (var attribute in await _productAttributeService.GetAllProductAttributes())- {- model.AvailableProductAttribute.Add(new SelectListItem {- Value = attribute.Id,- Text = attribute.Name- });- }+ public virtual async Task<ProductModel.ProductAttributeMappingModel> PrepareProductAttributeMappingModel(+ ProductModel.ProductAttributeMappingModel model)+ {+ foreach (var attribute in await _productAttributeService.GetAllProductAttributes())+ model.AvailableProductAttribute.Add(new SelectListItem {+ Value = attribute.Id,+ Text = attribute.Name+ });- return model;- }+ return model;+ }- public virtual async Task<IList<ProductModel.ProductAttributeMappingModel>>- PrepareProductAttributeMappingModels(Product product)+ public virtual async Task<IList<ProductModel.ProductAttributeMappingModel>>+ PrepareProductAttributeMappingModels(Product product)+ {+ var items = new List<ProductModel.ProductAttributeMappingModel>();+ foreach (var x in product.ProductAttributeMappings.OrderBy(x => x.DisplayOrder)){- var items = new List<ProductModel.ProductAttributeMappingModel>();- foreach (var x in product.ProductAttributeMappings.OrderBy(x => x.DisplayOrder))- {- var attributeModel = new ProductModel.ProductAttributeMappingModel {- Id = x.Id,- ProductId = product.Id,- ProductAttribute = (await _productAttributeService.GetProductAttributeById(x.ProductAttributeId))- ?.Name,- ProductAttributeId = x.ProductAttributeId,- TextPrompt = x.TextPrompt,- IsRequired = x.IsRequired,- ShowOnCatalogPage = x.ShowOnCatalogPage,- AttributeControlType =- x.AttributeControlTypeId.GetTranslationEnum(_translationService, _workContext),- AttributeControlTypeId = x.AttributeControlTypeId,- DisplayOrder = x.DisplayOrder,- Combination = x.Combination- };+ var attributeModel = new ProductModel.ProductAttributeMappingModel {+ Id = x.Id,+ ProductId = product.Id,+ ProductAttribute = (await _productAttributeService.GetProductAttributeById(x.ProductAttributeId))+ ?.Name,+ ProductAttributeId = x.ProductAttributeId,+ TextPrompt = x.TextPrompt,+ IsRequired = x.IsRequired,+ ShowOnCatalogPage = x.ShowOnCatalogPage,+ AttributeControlType =+ x.AttributeControlTypeId.GetTranslationEnum(_translationService, _workContext),+ AttributeControlTypeId = x.AttributeControlTypeId,+ DisplayOrder = x.DisplayOrder,+ Combination = x.Combination+ };- if (x.ShouldHaveValues())- {- attributeModel.ShouldHaveValues = true;- attributeModel.TotalValues = x.ProductAttributeValues.Count;- }-- if (x.ValidationRulesAllowed())- {- var validationRules = new StringBuilder(string.Empty);- attributeModel.ValidationRulesAllowed = true;- if (x.ValidationMinLength != null)- validationRules.AppendFormat("{0}: {1}<br />",- _translationService.GetResource(- "Vendor.Catalog.Products.ProductAttributes.Attributes.ValidationRules.MinLength"),- x.ValidationMinLength);- if (x.ValidationMaxLength != null)- validationRules.AppendFormat("{0}: {1}<br />",- _translationService.GetResource(- "Vendor.Catalog.Products.ProductAttributes.Attributes.ValidationRules.MaxLength"),- x.ValidationMaxLength);- if (!string.IsNullOrEmpty(x.ValidationFileAllowedExtensions))- validationRules.AppendFormat("{0}: {1}<br />",- _translationService.GetResource(- "Vendor.Catalog.Products.ProductAttributes.Attributes.ValidationRules.FileAllowedExtensions"),- System.Net.WebUtility.HtmlEncode(x.ValidationFileAllowedExtensions));- if (x.ValidationFileMaximumSize != null)- validationRules.AppendFormat("{0}: {1}<br />",- _translationService.GetResource(- "Vendor.Catalog.Products.ProductAttributes.Attributes.ValidationRules.FileMaximumSize"),- x.ValidationFileMaximumSize);- if (!string.IsNullOrEmpty(x.DefaultValue))- validationRules.AppendFormat("{0}: {1}<br />",- _translationService.GetResource(- "Vendor.Catalog.Products.ProductAttributes.Attributes.ValidationRules.DefaultValue"),- System.Net.WebUtility.HtmlEncode(x.DefaultValue));- attributeModel.ValidationRulesString = validationRules.ToString();- }+ if (x.ShouldHaveValues())+ {+ attributeModel.ShouldHaveValues = true;+ attributeModel.TotalValues = x.ProductAttributeValues.Count;+ }- //currency any attribute can have condition. why not?- attributeModel.ConditionAllowed = true;- var conditionAttribute = product.ParseProductAttributeMappings(x.ConditionAttribute).FirstOrDefault();- var conditionValue = product.ParseProductAttributeValues(x.ConditionAttribute).FirstOrDefault();- if (conditionAttribute != null && conditionValue != null)- {- var productAttribute =- await _productAttributeService.GetProductAttributeById(conditionAttribute.ProductAttributeId);- var paname = productAttribute != null ? productAttribute.Name : "";- attributeModel.ConditionString =- $"{System.Net.WebUtility.HtmlEncode(paname)}: {System.Net.WebUtility.HtmlEncode(conditionValue.Name)}";- }- else- attributeModel.ConditionString = string.Empty;+ if (x.ValidationRulesAllowed())+ {+ var validationRules = new StringBuilder(string.Empty);+ attributeModel.ValidationRulesAllowed = true;+ if (x.ValidationMinLength != null)+ validationRules.AppendFormat("{0}: {1}<br />",+ _translationService.GetResource(+ "Vendor.Catalog.Products.ProductAttributes.Attributes.ValidationRules.MinLength"),+ x.ValidationMinLength);+ if (x.ValidationMaxLength != null)+ validationRules.AppendFormat("{0}: {1}<br />",+ _translationService.GetResource(+ "Vendor.Catalog.Products.ProductAttributes.Attributes.ValidationRules.MaxLength"),+ x.ValidationMaxLength);+ if (!string.IsNullOrEmpty(x.ValidationFileAllowedExtensions))+ validationRules.AppendFormat("{0}: {1}<br />",+ _translationService.GetResource(+ "Vendor.Catalog.Products.ProductAttributes.Attributes.ValidationRules.FileAllowedExtensions"),+ WebUtility.HtmlEncode(x.ValidationFileAllowedExtensions));+ if (x.ValidationFileMaximumSize != null)+ validationRules.AppendFormat("{0}: {1}<br />",+ _translationService.GetResource(+ "Vendor.Catalog.Products.ProductAttributes.Attributes.ValidationRules.FileMaximumSize"),+ x.ValidationFileMaximumSize);+ if (!string.IsNullOrEmpty(x.DefaultValue))+ validationRules.AppendFormat("{0}: {1}<br />",+ _translationService.GetResource(+ "Vendor.Catalog.Products.ProductAttributes.Attributes.ValidationRules.DefaultValue"),+ WebUtility.HtmlEncode(x.DefaultValue));+ attributeModel.ValidationRulesString = validationRules.ToString();+ }- items.Add(attributeModel);+ //currency any attribute can have condition. why not?+ attributeModel.ConditionAllowed = true;+ var conditionAttribute = product.ParseProductAttributeMappings(x.ConditionAttribute).FirstOrDefault();+ var conditionValue = product.ParseProductAttributeValues(x.ConditionAttribute).FirstOrDefault();+ if (conditionAttribute != null && conditionValue != null)+ {+ var productAttribute =+ await _productAttributeService.GetProductAttributeById(conditionAttribute.ProductAttributeId);+ var paname = productAttribute != null ? productAttribute.Name : "";+ attributeModel.ConditionString =+ $"{WebUtility.HtmlEncode(paname)}: {WebUtility.HtmlEncode(conditionValue.Name)}";+ }+ else+ {+ attributeModel.ConditionString = string.Empty;}- return items;+ items.Add(attributeModel);}- public virtual async Task InsertProductAttributeMappingModel(ProductModel.ProductAttributeMappingModel model)- {- //insert mapping- var productAttributeMapping = model.ToEntity();- //predefined values- var predefinedValues = (await _productAttributeService.GetProductAttributeById(model.ProductAttributeId))- .PredefinedProductAttributeValues;- foreach (var predefinedValue in predefinedValues)- {- var pav = predefinedValue.ToEntity();- //locales- pav.Locales.Clear();- var languages = await _languageService.GetAllLanguages(true);- //localization- foreach (var lang in languages)- {- var name = predefinedValue.GetTranslation(x => x.Name, lang.Id, false);- if (!string.IsNullOrEmpty(name))- pav.Locales.Add(new TranslationEntity- { LanguageId = lang.Id, LocaleKey = "Name", LocaleValue = name });- }+ return items;+ }- productAttributeMapping.ProductAttributeValues.Add(pav);+ public virtual async Task InsertProductAttributeMappingModel(ProductModel.ProductAttributeMappingModel model)+ {+ //insert mapping+ var productAttributeMapping = model.ToEntity();+ //predefined values+ var predefinedValues = (await _productAttributeService.GetProductAttributeById(model.ProductAttributeId))+ .PredefinedProductAttributeValues;+ foreach (var predefinedValue in predefinedValues)+ {+ var pav = predefinedValue.ToEntity();+ //locales+ pav.Locales.Clear();+ var languages = await _languageService.GetAllLanguages(true);+ //localization+ foreach (var lang in languages)+ {+ var name = predefinedValue.GetTranslation(x => x.Name, lang.Id, false);+ if (!string.IsNullOrEmpty(name))+ pav.Locales.Add(new TranslationEntity+ { LanguageId = lang.Id, LocaleKey = "Name", LocaleValue = name });}- await _productAttributeService.InsertProductAttributeMapping(productAttributeMapping, model.ProductId);+ productAttributeMapping.ProductAttributeValues.Add(pav);}- public virtual async Task UpdateProductAttributeMappingModel(ProductModel.ProductAttributeMappingModel model)+ await _productAttributeService.InsertProductAttributeMapping(productAttributeMapping, model.ProductId);+ }++ public virtual async Task UpdateProductAttributeMappingModel(ProductModel.ProductAttributeMappingModel model)+ {+ var product = await _productService.GetProductById(model.ProductId, true);+ if (product != null){- var product = await _productService.GetProductById(model.ProductId, true);- if (product != null)+ var productAttributeMapping = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == model.Id);+ if (productAttributeMapping != null){- var productAttributeMapping = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == model.Id);- if (productAttributeMapping != null)- {- productAttributeMapping = model.ToEntity(productAttributeMapping);- await _productAttributeService.UpdateProductAttributeMapping(productAttributeMapping,- model.ProductId);- }+ productAttributeMapping = model.ToEntity(productAttributeMapping);+ await _productAttributeService.UpdateProductAttributeMapping(productAttributeMapping,+ model.ProductId);}}+ }- public virtual async Task UpdateProductAttributeValidationRulesModel(- ProductAttributeMapping productAttributeMapping, ProductModel.ProductAttributeMappingModel model)- {- productAttributeMapping.ValidationMinLength = model.ValidationMinLength;- productAttributeMapping.ValidationMaxLength = model.ValidationMaxLength;- productAttributeMapping.ValidationFileAllowedExtensions = model.ValidationFileAllowedExtensions;- productAttributeMapping.ValidationFileMaximumSize = model.ValidationFileMaximumSize;- productAttributeMapping.DefaultValue = model.DefaultValue;- await _productAttributeService.UpdateProductAttributeMapping(productAttributeMapping, model.ProductId);- }+ public virtual async Task UpdateProductAttributeValidationRulesModel(+ ProductAttributeMapping productAttributeMapping, ProductModel.ProductAttributeMappingModel model)+ {+ productAttributeMapping.ValidationMinLength = model.ValidationMinLength;+ productAttributeMapping.ValidationMaxLength = model.ValidationMaxLength;+ productAttributeMapping.ValidationFileAllowedExtensions = model.ValidationFileAllowedExtensions;+ productAttributeMapping.ValidationFileMaximumSize = model.ValidationFileMaximumSize;+ productAttributeMapping.DefaultValue = model.DefaultValue;+ await _productAttributeService.UpdateProductAttributeMapping(productAttributeMapping, model.ProductId);+ }- public virtual async Task<ProductAttributeConditionModel> PrepareProductAttributeConditionModel(Product product,- ProductAttributeMapping productAttributeMapping)- {- var model = new ProductAttributeConditionModel {- ProductAttributeMappingId = productAttributeMapping.Id,- EnableCondition = productAttributeMapping.ConditionAttribute.Any(),- ProductId = product.Id+ public virtual async Task<ProductAttributeConditionModel> PrepareProductAttributeConditionModel(Product product,+ ProductAttributeMapping productAttributeMapping)+ {+ var model = new ProductAttributeConditionModel {+ ProductAttributeMappingId = productAttributeMapping.Id,+ EnableCondition = productAttributeMapping.ConditionAttribute.Any(),+ ProductId = product.Id+ };+ //pre-select attribute and values+ var selectedPva = product.ParseProductAttributeMappings(productAttributeMapping.ConditionAttribute)+ .FirstOrDefault();++ var attributes = product.ProductAttributeMappings+ //ignore non-combinable attributes (should have selectable values)+ .Where(x => x.CanBeUsedAsCondition())+ //ignore this attribute (it cannot depend on itself)+ .Where(x => x.Id != productAttributeMapping.Id)+ .ToList();+ foreach (var attribute in attributes)+ {+ var pam = await _productAttributeService.GetProductAttributeById(attribute.ProductAttributeId);+ var attributeModel = new ProductAttributeConditionModel.ProductAttributeModel {+ Id = attribute.Id,+ ProductAttributeId = attribute.ProductAttributeId,+ Name = pam.Name,+ TextPrompt = attribute.TextPrompt,+ IsRequired = attribute.IsRequired,+ AttributeControlType = attribute.AttributeControlTypeId};- //pre-select attribute and values- var selectedPva = product.ParseProductAttributeMappings(productAttributeMapping.ConditionAttribute)- .FirstOrDefault();- var attributes = product.ProductAttributeMappings- //ignore non-combinable attributes (should have selectable values)- .Where(x => x.CanBeUsedAsCondition())- //ignore this attribute (it cannot depend on itself)- .Where(x => x.Id != productAttributeMapping.Id)- .ToList();- foreach (var attribute in attributes)+ if (attribute.ShouldHaveValues()){- var pam = await _productAttributeService.GetProductAttributeById(attribute.ProductAttributeId);- var attributeModel = new ProductAttributeConditionModel.ProductAttributeModel {- Id = attribute.Id,- ProductAttributeId = attribute.ProductAttributeId,- Name = pam.Name,- TextPrompt = attribute.TextPrompt,- IsRequired = attribute.IsRequired,- AttributeControlType = attribute.AttributeControlTypeId- };-- if (attribute.ShouldHaveValues())- {- //values- var attributeValues = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == attribute.Id)- ?.ProductAttributeValues;- if (attributeValues != null)- foreach (var attributeValue in attributeValues)- {- var attributeValueModel = new ProductAttributeConditionModel.ProductAttributeValueModel {- Id = attributeValue.Id,- Name = attributeValue.Name,- IsPreSelected = attributeValue.IsPreSelected- };- attributeModel.Values.Add(attributeValueModel);- }-- //pre-select attribute and value- if (selectedPva != null && attribute.Id == selectedPva.Id)+ //values+ var attributeValues = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == attribute.Id)+ ?.ProductAttributeValues;+ if (attributeValues != null)+ foreach (var attributeValue in attributeValues){- //attribute- model.SelectedProductAttributeId = selectedPva.Id;-- //values- switch (attribute.AttributeControlTypeId)- {- case AttributeControlType.DropdownList:- case AttributeControlType.RadioList:- case AttributeControlType.Checkboxes:- case AttributeControlType.ColorSquares:- case AttributeControlType.ImageSquares:- {- if (productAttributeMapping.ConditionAttribute.Any())- {- //clear default selection- foreach (var item in attributeModel.Values)- item.IsPreSelected = false;-- //select new values- var selectedValues =- product.ParseProductAttributeValues(productAttributeMapping.ConditionAttribute);- foreach (var attributeValue in selectedValues)- foreach (var item in attributeModel.Values)- if (attributeValue.Id == item.Id)- item.IsPreSelected = true;- }- }- break;- case AttributeControlType.ReadonlyCheckboxes:- case AttributeControlType.TextBox:- case AttributeControlType.MultilineTextbox:- case AttributeControlType.Datepicker:- case AttributeControlType.FileUpload:- default:- //these attribute types are supported as conditions- break;- }+ var attributeValueModel = new ProductAttributeConditionModel.ProductAttributeValueModel {+ Id = attributeValue.Id,+ Name = attributeValue.Name,+ IsPreSelected = attributeValue.IsPreSelected+ };+ attributeModel.Values.Add(attributeValueModel);}- }-- model.ProductAttributes.Add(attributeModel);- }- return model;- }-- public virtual async Task UpdateProductAttributeConditionModel(Product product,- ProductAttributeMapping productAttributeMapping, ProductAttributeConditionModel model)- {- var customAttributes = new List<CustomAttribute>();- if (model.EnableCondition)- {- var attribute =- product.ProductAttributeMappings.FirstOrDefault(x => x.Id == model.SelectedProductAttributeId);- if (attribute != null)+ //pre-select attribute and value+ if (selectedPva != null && attribute.Id == selectedPva.Id){+ //attribute+ model.SelectedProductAttributeId = selectedPva.Id;++ //valuesswitch (attribute.AttributeControlTypeId){case AttributeControlType.DropdownList:case AttributeControlType.RadioList:+ case AttributeControlType.Checkboxes:case AttributeControlType.ColorSquares:case AttributeControlType.ImageSquares:{- var ctrlAttributes = model.SelectedAttributes.FirstOrDefault(x => x.Key == attribute.Id)- ?.Value;- if (!string.IsNullOrEmpty(ctrlAttributes))+ if (productAttributeMapping.ConditionAttribute.Any()){- customAttributes = Domain.Catalog.ProductExtensions.AddProductAttribute(- customAttributes,- attribute, ctrlAttributes).ToList();- }- else- {- customAttributes = Domain.Catalog.ProductExtensions.AddProductAttribute(- customAttributes,- attribute, "").ToList();- }- }- break;- case AttributeControlType.Checkboxes:- {- var cblAttributes = model.SelectedAttributes.FirstOrDefault(x => x.Key == attribute.Id)- ?.Value;- if (!string.IsNullOrEmpty(cblAttributes))- {- var anyValueSelected = false;- foreach (var item in cblAttributes.Split(new[] { ',' },- StringSplitOptions.RemoveEmptyEntries))- {- if (!string.IsNullOrEmpty(item))- {- customAttributes = Domain.Catalog.ProductExtensions.AddProductAttribute(- customAttributes,- attribute, item).ToList();- anyValueSelected = true;- }- }-- if (!anyValueSelected)- {- customAttributes = Domain.Catalog.ProductExtensions.AddProductAttribute(- customAttributes,- attribute, "").ToList();- }- }- else- {- customAttributes = Domain.Catalog.ProductExtensions.AddProductAttribute(- customAttributes,- attribute, "").ToList();+ //clear default selection+ foreach (var item in attributeModel.Values)+ item.IsPreSelected = false;++ //select new values+ var selectedValues =+ product.ParseProductAttributeValues(productAttributeMapping.ConditionAttribute);+ foreach (var attributeValue in selectedValues)+ foreach (var item in attributeModel.Values)+ if (attributeValue.Id == item.Id)+ item.IsPreSelected = true;}}break;@@ -1706,767 +1532,853 @@ namespace Grand.Web.Vendor.Services}}- productAttributeMapping.ConditionAttribute = customAttributes;- await _productAttributeService.UpdateProductAttributeMapping(productAttributeMapping, model.ProductId);+ model.ProductAttributes.Add(attributeModel);}- public virtual async Task<ProductModel.ProductAttributeValueModel> PrepareProductAttributeValueModel(- Product product, ProductAttributeMapping productAttributeMapping)+ return model;+ }++ public virtual async Task UpdateProductAttributeConditionModel(Product product,+ ProductAttributeMapping productAttributeMapping, ProductAttributeConditionModel model)+ {+ var customAttributes = new List<CustomAttribute>();+ if (model.EnableCondition){- var model = new ProductModel.ProductAttributeValueModel {- ProductAttributeMappingId = productAttributeMapping.Id,- ProductId = product.Id,+ var attribute =+ product.ProductAttributeMappings.FirstOrDefault(x => x.Id == model.SelectedProductAttributeId);+ if (attribute != null)+ switch (attribute.AttributeControlTypeId)+ {+ case AttributeControlType.DropdownList:+ case AttributeControlType.RadioList:+ case AttributeControlType.ColorSquares:+ case AttributeControlType.ImageSquares:+ {+ var ctrlAttributes = model.SelectedAttributes.FirstOrDefault(x => x.Key == attribute.Id)+ ?.Value;+ if (!string.IsNullOrEmpty(ctrlAttributes))+ customAttributes = ProductExtensions.AddProductAttribute(+ customAttributes,+ attribute, ctrlAttributes).ToList();+ else+ customAttributes = ProductExtensions.AddProductAttribute(+ customAttributes,+ attribute, "").ToList();+ }+ break;+ case AttributeControlType.Checkboxes:+ {+ var cblAttributes = model.SelectedAttributes.FirstOrDefault(x => x.Key == attribute.Id)+ ?.Value;+ if (!string.IsNullOrEmpty(cblAttributes))+ {+ var anyValueSelected = false;+ foreach (var item in cblAttributes.Split(new[] { ',' },+ StringSplitOptions.RemoveEmptyEntries))+ if (!string.IsNullOrEmpty(item))+ {+ customAttributes = ProductExtensions.AddProductAttribute(+ customAttributes,+ attribute, item).ToList();+ anyValueSelected = true;+ }- //color squares- DisplayColorSquaresRgb =- productAttributeMapping.AttributeControlTypeId == AttributeControlType.ColorSquares,- ColorSquaresRgb = "#000000",- //image squares- DisplayImageSquaresPicture =- productAttributeMapping.AttributeControlTypeId == AttributeControlType.ImageSquares,- PrimaryStoreCurrencyCode =- (await _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId))?.CurrencyCode,- //default quantity for associated product- Quantity = 1- };+ if (!anyValueSelected)+ customAttributes = ProductExtensions.AddProductAttribute(+ customAttributes,+ attribute, "").ToList();+ }+ else+ {+ customAttributes = ProductExtensions.AddProductAttribute(+ customAttributes,+ attribute, "").ToList();+ }+ }+ break;+ case AttributeControlType.ReadonlyCheckboxes:+ case AttributeControlType.TextBox:+ case AttributeControlType.MultilineTextbox:+ case AttributeControlType.Datepicker:+ case AttributeControlType.FileUpload:+ default:+ //these attribute types are supported as conditions+ break;+ }+ }- //pictures- foreach (var x in product.ProductPictures)- {- model.ProductPictureModels.Add(new ProductModel.ProductPictureModel {- Id = x.Id,- ProductId = product.Id,- PictureId = x.PictureId,- PictureUrl = await _pictureService.GetPictureUrl(x.PictureId),- DisplayOrder = x.DisplayOrder- });- }+ productAttributeMapping.ConditionAttribute = customAttributes;+ await _productAttributeService.UpdateProductAttributeMapping(productAttributeMapping, model.ProductId);+ }++ public virtual async Task<ProductModel.ProductAttributeValueModel> PrepareProductAttributeValueModel(+ Product product, ProductAttributeMapping productAttributeMapping)+ {+ var model = new ProductModel.ProductAttributeValueModel {+ ProductAttributeMappingId = productAttributeMapping.Id,+ ProductId = product.Id,++ //color squares+ DisplayColorSquaresRgb =+ productAttributeMapping.AttributeControlTypeId == AttributeControlType.ColorSquares,+ ColorSquaresRgb = "#000000",+ //image squares+ DisplayImageSquaresPicture =+ productAttributeMapping.AttributeControlTypeId == AttributeControlType.ImageSquares,+ PrimaryStoreCurrencyCode =+ (await _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId))?.CurrencyCode,+ //default quantity for associated product+ Quantity = 1+ };++ //pictures+ foreach (var x in product.ProductPictures)+ model.ProductPictureModels.Add(new ProductModel.ProductPictureModel {+ Id = x.Id,+ ProductId = product.Id,+ PictureId = x.PictureId,+ PictureUrl = await _pictureService.GetPictureUrl(x.PictureId),+ DisplayOrder = x.DisplayOrder+ });++ return model;+ }- return model;+ public virtual async Task<IList<ProductModel.ProductAttributeValueModel>> PrepareProductAttributeValueModels(+ Product product, ProductAttributeMapping productAttributeMapping)+ {+ var items = new List<ProductModel.ProductAttributeValueModel>();+ foreach (var x in productAttributeMapping.ProductAttributeValues.OrderBy(x => x.DisplayOrder))+ {+ Product associatedProduct = null;+ if (x.AttributeValueTypeId == AttributeValueType.AssociatedToProduct)+ associatedProduct = await _productService.GetProductById(x.AssociatedProductId);++ var pictureThumbnailUrl = await _pictureService.GetPictureUrl(+ string.IsNullOrEmpty(x.PictureId) ? x.ImageSquaresPictureId : x.PictureId, 100, false);++ if (string.IsNullOrEmpty(pictureThumbnailUrl))+ pictureThumbnailUrl = await _pictureService.GetPictureUrl("", 1);++ items.Add(new ProductModel.ProductAttributeValueModel {+ Id = x.Id,+ ProductAttributeMappingId = productAttributeMapping.Id, //TODO - check x.ProductAttributeMappingId,+ AttributeValueTypeId = x.AttributeValueTypeId,+ AttributeValueTypeName =+ x.AttributeValueTypeId.GetTranslationEnum(_translationService, _workContext),+ AssociatedProductId = x.AssociatedProductId,+ AssociatedProductName = associatedProduct != null ? associatedProduct.Name : "",+ Name = productAttributeMapping.AttributeControlTypeId != AttributeControlType.ColorSquares+ ? x.Name+ : $"{x.Name} - {x.ColorSquaresRgb}",+ ColorSquaresRgb = x.ColorSquaresRgb,+ ImageSquaresPictureId = x.ImageSquaresPictureId,+ PriceAdjustment = x.PriceAdjustment,+ PriceAdjustmentStr = x.PriceAdjustment.ToString("G29"),+ WeightAdjustment = x.WeightAdjustment,+ WeightAdjustmentStr = x.AttributeValueTypeId == AttributeValueType.Simple+ ? x.WeightAdjustment.ToString("G29")+ : "",+ Cost = x.Cost,+ PrimaryStoreCurrencyCode =+ (await _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId))+ ?.CurrencyCode,+ Quantity = x.Quantity,+ IsPreSelected = x.IsPreSelected,+ DisplayOrder = x.DisplayOrder,+ PictureId = x.PictureId,+ PictureThumbnailUrl = pictureThumbnailUrl,+ ProductId = product.Id+ });}- public virtual async Task<IList<ProductModel.ProductAttributeValueModel>> PrepareProductAttributeValueModels(- Product product, ProductAttributeMapping productAttributeMapping)- {- var items = new List<ProductModel.ProductAttributeValueModel>();- foreach (var x in productAttributeMapping.ProductAttributeValues.OrderBy(x => x.DisplayOrder))- {- Product associatedProduct = null;- if (x.AttributeValueTypeId == AttributeValueType.AssociatedToProduct)- {- associatedProduct = await _productService.GetProductById(x.AssociatedProductId);- }+ return items;+ }- var pictureThumbnailUrl = await _pictureService.GetPictureUrl(- string.IsNullOrEmpty(x.PictureId) ? x.ImageSquaresPictureId : x.PictureId, 100, false);-- if (string.IsNullOrEmpty(pictureThumbnailUrl))- pictureThumbnailUrl = await _pictureService.GetPictureUrl("", 1);-- items.Add(new ProductModel.ProductAttributeValueModel {- Id = x.Id,- ProductAttributeMappingId = productAttributeMapping.Id, //TODO - check x.ProductAttributeMappingId,- AttributeValueTypeId = x.AttributeValueTypeId,- AttributeValueTypeName =- x.AttributeValueTypeId.GetTranslationEnum(_translationService, _workContext),- AssociatedProductId = x.AssociatedProductId,- AssociatedProductName = associatedProduct != null ? associatedProduct.Name : "",- Name = productAttributeMapping.AttributeControlTypeId != AttributeControlType.ColorSquares- ? x.Name- : $"{x.Name} - {x.ColorSquaresRgb}",- ColorSquaresRgb = x.ColorSquaresRgb,- ImageSquaresPictureId = x.ImageSquaresPictureId,- PriceAdjustment = x.PriceAdjustment,- PriceAdjustmentStr = x.PriceAdjustment.ToString("G29"),- WeightAdjustment = x.WeightAdjustment,- WeightAdjustmentStr = x.AttributeValueTypeId == AttributeValueType.Simple- ? x.WeightAdjustment.ToString("G29")- : "",- Cost = x.Cost,- PrimaryStoreCurrencyCode =- (await _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId))- ?.CurrencyCode,- Quantity = x.Quantity,- IsPreSelected = x.IsPreSelected,- DisplayOrder = x.DisplayOrder,- PictureId = x.PictureId,- PictureThumbnailUrl = pictureThumbnailUrl,- ProductId = product.Id- });- }+ public virtual async Task<ProductModel.ProductAttributeValueModel> PrepareProductAttributeValueModel(+ ProductAttributeMapping pa, ProductAttributeValue pav)+ {+ var associatedProduct = await _productService.GetProductById(pav.AssociatedProductId);++ var model = new ProductModel.ProductAttributeValueModel {+ ProductAttributeMappingId = pa.Id, //TODO - check pav.ProductAttributeMappingId,+ AttributeValueTypeId = pav.AttributeValueTypeId,+ AttributeValueTypeName = pav.AttributeValueTypeId.GetTranslationEnum(_translationService, _workContext),+ AssociatedProductId = pav.AssociatedProductId,+ AssociatedProductName = associatedProduct != null ? associatedProduct.Name : "",+ Name = pav.Name,+ ColorSquaresRgb = pav.ColorSquaresRgb,+ DisplayColorSquaresRgb = pa.AttributeControlTypeId == AttributeControlType.ColorSquares,+ ImageSquaresPictureId = pav.ImageSquaresPictureId,+ DisplayImageSquaresPicture = pa.AttributeControlTypeId == AttributeControlType.ImageSquares,+ PriceAdjustment = pav.PriceAdjustment,+ WeightAdjustment = pav.WeightAdjustment,+ Cost = pav.Cost,+ PrimaryStoreCurrencyCode =+ (await _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId))?.CurrencyCode,+ Quantity = pav.Quantity,+ IsPreSelected = pav.IsPreSelected,+ DisplayOrder = pav.DisplayOrder,+ PictureId = pav.PictureId+ };+ if (model.DisplayColorSquaresRgb && string.IsNullOrEmpty(model.ColorSquaresRgb))+ model.ColorSquaresRgb = "#000000";++ return model;+ }- return items;- }+ public virtual async Task InsertProductAttributeValueModel(ProductModel.ProductAttributeValueModel model)+ {+ var pav = new ProductAttributeValue {+ AttributeValueTypeId = model.AttributeValueTypeId,+ AssociatedProductId = model.AssociatedProductId,+ Name = model.Name,+ ColorSquaresRgb = model.ColorSquaresRgb,+ ImageSquaresPictureId = model.ImageSquaresPictureId,+ PriceAdjustment = model.PriceAdjustment,+ WeightAdjustment = model.WeightAdjustment,+ Cost = model.Cost,+ Quantity = model.Quantity,+ IsPreSelected = model.IsPreSelected,+ DisplayOrder = model.DisplayOrder,+ PictureId = model.PictureId,+ Locales = model.Locales.ToTranslationProperty()+ };+ await _productAttributeService.InsertProductAttributeValue(pav, model.ProductId,+ model.ProductAttributeMappingId);+ }- public virtual async Task<ProductModel.ProductAttributeValueModel> PrepareProductAttributeValueModel(- ProductAttributeMapping pa, ProductAttributeValue pav)- {- var associatedProduct = await _productService.GetProductById(pav.AssociatedProductId);+ public virtual async Task UpdateProductAttributeValueModel(ProductAttributeValue pav,+ ProductModel.ProductAttributeValueModel model)+ {+ pav.AttributeValueTypeId = model.AttributeValueTypeId;+ pav.AssociatedProductId = model.AssociatedProductId;+ pav.Name = model.Name;+ pav.ColorSquaresRgb = model.ColorSquaresRgb;+ pav.ImageSquaresPictureId = model.ImageSquaresPictureId;+ pav.PriceAdjustment = model.PriceAdjustment;+ pav.WeightAdjustment = model.WeightAdjustment;+ pav.Cost = model.Cost;+ pav.Quantity = model.Quantity;+ pav.IsPreSelected = model.IsPreSelected;+ pav.DisplayOrder = model.DisplayOrder;+ pav.PictureId = model.PictureId;+ pav.Locales = model.Locales.ToTranslationProperty();++ await _productAttributeService.UpdateProductAttributeValue(pav, model.ProductId,+ model.ProductAttributeMappingId);+ }- var model = new ProductModel.ProductAttributeValueModel {- ProductAttributeMappingId = pa.Id, //TODO - check pav.ProductAttributeMappingId,- AttributeValueTypeId = pav.AttributeValueTypeId,- AttributeValueTypeName = pav.AttributeValueTypeId.GetTranslationEnum(_translationService, _workContext),- AssociatedProductId = pav.AssociatedProductId,- AssociatedProductName = associatedProduct != null ? associatedProduct.Name : "",- Name = pav.Name,- ColorSquaresRgb = pav.ColorSquaresRgb,- DisplayColorSquaresRgb = pa.AttributeControlTypeId == AttributeControlType.ColorSquares,- ImageSquaresPictureId = pav.ImageSquaresPictureId,- DisplayImageSquaresPicture = pa.AttributeControlTypeId == AttributeControlType.ImageSquares,- PriceAdjustment = pav.PriceAdjustment,- WeightAdjustment = pav.WeightAdjustment,- Cost = pav.Cost,- PrimaryStoreCurrencyCode =- (await _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId))?.CurrencyCode,- Quantity = pav.Quantity,- IsPreSelected = pav.IsPreSelected,- DisplayOrder = pav.DisplayOrder,- PictureId = pav.PictureId- };- if (model.DisplayColorSquaresRgb && string.IsNullOrEmpty(model.ColorSquaresRgb))- {- model.ColorSquaresRgb = "#000000";- }+ public virtual Task<ProductModel.ProductAttributeValueModel.AssociateProductToAttributeValueModel>+ PrepareAssociateProductToAttributeValueModel()+ {+ var model = PrepareAddProductModel<+ ProductModel.ProductAttributeValueModel.AssociateProductToAttributeValueModel>();+ return Task.FromResult(model);+ }- return model;- }+ public virtual async Task<IList<ProductModel.ProductAttributeCombinationModel>>+ PrepareProductAttributeCombinationModel(Product product)+ {+ var items = new List<ProductModel.ProductAttributeCombinationModel>();- public virtual async Task InsertProductAttributeValueModel(ProductModel.ProductAttributeValueModel model)+ foreach (var x in product.ProductAttributeCombinations){- var pav = new ProductAttributeValue {- AttributeValueTypeId = model.AttributeValueTypeId,- AssociatedProductId = model.AssociatedProductId,- Name = model.Name,- ColorSquaresRgb = model.ColorSquaresRgb,- ImageSquaresPictureId = model.ImageSquaresPictureId,- PriceAdjustment = model.PriceAdjustment,- WeightAdjustment = model.WeightAdjustment,- Cost = model.Cost,- Quantity = model.Quantity,- IsPreSelected = model.IsPreSelected,- DisplayOrder = model.DisplayOrder,- PictureId = model.PictureId,- Locales = model.Locales.ToTranslationProperty()+ var attributes = await _productAttributeFormatter.FormatAttributes(product, x.Attributes,+ _workContext.CurrentCustomer, "<br />", true, true, true, false, true, true);+ var pacModel = new ProductModel.ProductAttributeCombinationModel {+ Id = x.Id,+ ProductId = product.Id,+ Attributes = string.IsNullOrEmpty(attributes) ? "(null)" : attributes,+ StockQuantity = product.UseMultipleWarehouses+ ? x.WarehouseInventory.Sum(y => y.StockQuantity - y.ReservedQuantity)+ : x.StockQuantity,+ AllowOutOfStockOrders = x.AllowOutOfStockOrders,+ Sku = x.Sku,+ Mpn = x.Mpn,+ Gtin = x.Gtin,+ OverriddenPrice = x.OverriddenPrice,+ NotifyAdminForQuantityBelow = x.NotifyAdminForQuantityBelow};- await _productAttributeService.InsertProductAttributeValue(pav, model.ProductId,- model.ProductAttributeMappingId);+ items.Add(pacModel);}- public virtual async Task UpdateProductAttributeValueModel(ProductAttributeValue pav,- ProductModel.ProductAttributeValueModel model)- {- pav.AttributeValueTypeId = model.AttributeValueTypeId;- pav.AssociatedProductId = model.AssociatedProductId;- pav.Name = model.Name;- pav.ColorSquaresRgb = model.ColorSquaresRgb;- pav.ImageSquaresPictureId = model.ImageSquaresPictureId;- pav.PriceAdjustment = model.PriceAdjustment;- pav.WeightAdjustment = model.WeightAdjustment;- pav.Cost = model.Cost;- pav.Quantity = model.Quantity;- pav.IsPreSelected = model.IsPreSelected;- pav.DisplayOrder = model.DisplayOrder;- pav.PictureId = model.PictureId;- pav.Locales = model.Locales.ToTranslationProperty();-- await _productAttributeService.UpdateProductAttributeValue(pav, model.ProductId,- model.ProductAttributeMappingId);- }+ return items;+ }- public virtual Task<ProductModel.ProductAttributeValueModel.AssociateProductToAttributeValueModel>- PrepareAssociateProductToAttributeValueModel()+ public virtual async Task<ProductAttributeCombinationModel> PrepareProductAttributeCombinationModel(+ Product product, string combinationId)+ {+ var model = new ProductAttributeCombinationModel();+ var wim = new List<ProductAttributeCombinationModel.WarehouseInventoryModel>();+ foreach (var warehouse in await _warehouseService.GetAllWarehouses()){- var model = PrepareAddProductModel<- ProductModel.ProductAttributeValueModel.AssociateProductToAttributeValueModel>();- return Task.FromResult(model);+ var pwiModel = new ProductAttributeCombinationModel.WarehouseInventoryModel {+ WarehouseId = warehouse.Id,+ WarehouseName = warehouse.Name+ };+ wim.Add(pwiModel);}- public virtual async Task<IList<ProductModel.ProductAttributeCombinationModel>>- PrepareProductAttributeCombinationModel(Product product)+ if (product.UseMultipleWarehouses){- var items = new List<ProductModel.ProductAttributeCombinationModel>();-- foreach (var x in product.ProductAttributeCombinations)- {- var attributes = await _productAttributeFormatter.FormatAttributes(product, x.Attributes,- _workContext.CurrentCustomer, "<br />", true, true, true, false, true, true);- var pacModel = new ProductModel.ProductAttributeCombinationModel {- Id = x.Id,- ProductId = product.Id,- Attributes = string.IsNullOrEmpty(attributes) ? "(null)" : attributes,- StockQuantity = product.UseMultipleWarehouses- ? x.WarehouseInventory.Sum(y => y.StockQuantity - y.ReservedQuantity)- : x.StockQuantity,- AllowOutOfStockOrders = x.AllowOutOfStockOrders,- Sku = x.Sku,- Mpn = x.Mpn,- Gtin = x.Gtin,- OverriddenPrice = x.OverriddenPrice,- NotifyAdminForQuantityBelow = x.NotifyAdminForQuantityBelow- };- items.Add(pacModel);- }-- return items;+ model.UseMultipleWarehouses = product.UseMultipleWarehouses;+ model.WarehouseInventoryModels = wim;}- public virtual async Task<ProductAttributeCombinationModel> PrepareProductAttributeCombinationModel(- Product product, string combinationId)+ if (!string.IsNullOrEmpty(combinationId)){- var model = new ProductAttributeCombinationModel();- var wim = new List<ProductAttributeCombinationModel.WarehouseInventoryModel>();- foreach (var warehouse in await _warehouseService.GetAllWarehouses())- {- var pwiModel = new ProductAttributeCombinationModel.WarehouseInventoryModel {- WarehouseId = warehouse.Id,- WarehouseName = warehouse.Name- };- wim.Add(pwiModel);- }-- if (product.UseMultipleWarehouses)+ var combination = product.ProductAttributeCombinations.FirstOrDefault(x => x.Id == combinationId);+ if (combination != null){+ model = combination.ToModel();model.UseMultipleWarehouses = product.UseMultipleWarehouses;model.WarehouseInventoryModels = wim;- }-- if (!string.IsNullOrEmpty(combinationId))- {- var combination = product.ProductAttributeCombinations.FirstOrDefault(x => x.Id == combinationId);- if (combination != null)- {- model = combination.ToModel();- model.UseMultipleWarehouses = product.UseMultipleWarehouses;- model.WarehouseInventoryModels = wim;- model.ProductId = product.Id;- model.Attributes = await _productAttributeFormatter.FormatAttributes(product,- combination.Attributes, _workContext.CurrentCustomer, "<br />", true, true, true, false);- if (model.UseMultipleWarehouses)+ model.ProductId = product.Id;+ model.Attributes = await _productAttributeFormatter.FormatAttributes(product,+ combination.Attributes, _workContext.CurrentCustomer, "<br />", true, true, true, false);+ if (model.UseMultipleWarehouses)+ foreach (var winv in combination.WarehouseInventory){- foreach (var winv in combination.WarehouseInventory)+ var warehouseInventoryModel =+ model.WarehouseInventoryModels.FirstOrDefault(x => x.WarehouseId == winv.WarehouseId);+ if (warehouseInventoryModel != null){- var warehouseInventoryModel =- model.WarehouseInventoryModels.FirstOrDefault(x => x.WarehouseId == winv.WarehouseId);- if (warehouseInventoryModel != null)- {- warehouseInventoryModel.WarehouseUsed = true;- warehouseInventoryModel.Id = winv.Id;- warehouseInventoryModel.StockQuantity = winv.StockQuantity;- warehouseInventoryModel.ReservedQuantity = winv.ReservedQuantity;- }+ warehouseInventoryModel.WarehouseUsed = true;+ warehouseInventoryModel.Id = winv.Id;+ warehouseInventoryModel.StockQuantity = winv.StockQuantity;+ warehouseInventoryModel.ReservedQuantity = winv.ReservedQuantity;}}- }}-- return model;}- public virtual async Task<IList<string>> InsertOrUpdateProductAttributeCombinationPopup(Product product,- ProductAttributeCombinationModel model)+ return model;+ }++ public virtual async Task<IList<string>> InsertOrUpdateProductAttributeCombinationPopup(Product product,+ ProductAttributeCombinationModel model)+ {+ var customAttributes = new List<CustomAttribute>();+ var warnings = new List<string>();++ async Task PrepareCombinationWarehouseInventory(ProductAttributeCombination combination){- var customAttributes = new List<CustomAttribute>();- var warnings = new List<string>();+ var warehouses = await _warehouseService.GetAllWarehouses();- async Task PrepareCombinationWarehouseInventory(ProductAttributeCombination combination)+ foreach (var warehouse in warehouses){- var warehouses = await _warehouseService.GetAllWarehouses();-- foreach (var warehouse in warehouses)+ var whim = model.WarehouseInventoryModels.FirstOrDefault(x => x.WarehouseId == warehouse.Id);+ var existingPwI = combination.WarehouseInventory.FirstOrDefault(x => x.WarehouseId == warehouse.Id);+ if (existingPwI != null){- var whim = model.WarehouseInventoryModels.FirstOrDefault(x => x.WarehouseId == warehouse.Id);- var existingPwI = combination.WarehouseInventory.FirstOrDefault(x => x.WarehouseId == warehouse.Id);- if (existingPwI != null)+ if (whim is { WarehouseUsed: true }){- if (whim is { WarehouseUsed: true })- {- //update- existingPwI.StockQuantity = whim.StockQuantity;- existingPwI.ReservedQuantity = whim.ReservedQuantity;- }- else- {- //delete- combination.WarehouseInventory.Remove(existingPwI);- }+ //update+ existingPwI.StockQuantity = whim.StockQuantity;+ existingPwI.ReservedQuantity = whim.ReservedQuantity;}else{- if (whim is { WarehouseUsed: true })- {- //no need to insert a record for qty 0- existingPwI = new ProductCombinationWarehouseInventory {- WarehouseId = whim.WarehouseId,- StockQuantity = whim.StockQuantity,- ReservedQuantity = whim.ReservedQuantity- };- combination.WarehouseInventory.Add(existingPwI);- }+ //delete+ combination.WarehouseInventory.Remove(existingPwI);+ }+ }+ else+ {+ if (whim is { WarehouseUsed: true })+ {+ //no need to insert a record for qty 0+ existingPwI = new ProductCombinationWarehouseInventory {+ WarehouseId = whim.WarehouseId,+ StockQuantity = whim.StockQuantity,+ ReservedQuantity = whim.ReservedQuantity+ };+ combination.WarehouseInventory.Add(existingPwI);}}}+ }- if (string.IsNullOrEmpty(model.Id))- {- #region Product attributes+ if (string.IsNullOrEmpty(model.Id))+ {+ #region Product attributes- var attributes = product.ProductAttributeMappings- .Where(x => !x.IsNonCombinable())- .ToList();- if (attributes.Count == 0)- {- warnings.Add("This combination attributes is empty!");- return warnings;- }+ var attributes = product.ProductAttributeMappings+ .Where(x => !x.IsNonCombinable())+ .ToList();+ if (attributes.Count == 0)+ {+ warnings.Add("This combination attributes is empty!");+ return warnings;+ }- foreach (var attribute in attributes)+ foreach (var attribute in attributes)+ switch (attribute.AttributeControlTypeId){- switch (attribute.AttributeControlTypeId)+ case AttributeControlType.DropdownList:+ case AttributeControlType.RadioList:+ case AttributeControlType.ColorSquares:+ case AttributeControlType.ImageSquares:{- case AttributeControlType.DropdownList:- case AttributeControlType.RadioList:- case AttributeControlType.ColorSquares:- case AttributeControlType.ImageSquares:- {- var ctrlAttributes = model.SelectedAttributes.FirstOrDefault(x => x.Key == attribute.Id)- ?.Value;- if (!string.IsNullOrEmpty(ctrlAttributes))- {- customAttributes = Domain.Catalog.ProductExtensions.AddProductAttribute(- customAttributes,- attribute, ctrlAttributes).ToList();- }- }- break;- case AttributeControlType.Checkboxes:- {- var cblAttributes = model.SelectedAttributes.FirstOrDefault(x => x.Key == attribute.Id)- ?.Value;- if (!string.IsNullOrEmpty(cblAttributes))- {- foreach (var item in cblAttributes.Split(new[] { ',' },- StringSplitOptions.RemoveEmptyEntries))- {- if (!string.IsNullOrEmpty(item))- customAttributes = Domain.Catalog.ProductExtensions.AddProductAttribute(- customAttributes,- attribute, item).ToList();- }- }- }- break;- case AttributeControlType.ReadonlyCheckboxes:- {- //load read-only (already server-side selected) values- var attributeValues = attribute.ProductAttributeValues;- foreach (var selectedAttributeId in attributeValues- .Where(v => v.IsPreSelected)- .Select(v => v.Id)- .ToList())- {- customAttributes = Domain.Catalog.ProductExtensions.AddProductAttribute(- customAttributes,- attribute, selectedAttributeId).ToList();- }- }- break;+ var ctrlAttributes = model.SelectedAttributes.FirstOrDefault(x => x.Key == attribute.Id)+ ?.Value;+ if (!string.IsNullOrEmpty(ctrlAttributes))+ customAttributes = ProductExtensions.AddProductAttribute(+ customAttributes,+ attribute, ctrlAttributes).ToList();}- }-- //validate conditional attributes (if specified)- foreach (var attribute in attributes)- {- var conditionMet = product.IsConditionMet(attribute, customAttributes);- if (conditionMet.HasValue && !conditionMet.Value)+ break;+ case AttributeControlType.Checkboxes:{- customAttributes = Domain.Catalog.ProductExtensions- .RemoveProductAttribute(customAttributes, attribute).ToList();+ var cblAttributes = model.SelectedAttributes.FirstOrDefault(x => x.Key == attribute.Id)+ ?.Value;+ if (!string.IsNullOrEmpty(cblAttributes))+ foreach (var item in cblAttributes.Split(new[] { ',' },+ StringSplitOptions.RemoveEmptyEntries))+ if (!string.IsNullOrEmpty(item))+ customAttributes = ProductExtensions.AddProductAttribute(+ customAttributes,+ attribute, item).ToList();}- }-- if (customAttributes.Count == 0)- {- warnings.Add("This combination custom attributes is empty!");- return warnings;- }-- foreach (var customAttribute in customAttributes)- {- if (string.IsNullOrEmpty(customAttribute.Value))+ break;+ case AttributeControlType.ReadonlyCheckboxes:{- warnings.Add("Combination custom attributes need to be selected value!");- return warnings;+ //load read-only (already server-side selected) values+ var attributeValues = attribute.ProductAttributeValues;+ foreach (var selectedAttributeId in attributeValues+ .Where(v => v.IsPreSelected)+ .Select(v => v.Id)+ .ToList())+ customAttributes = ProductExtensions.AddProductAttribute(+ customAttributes,+ attribute, selectedAttributeId).ToList();}+ break;}- #endregion+ //validate conditional attributes (if specified)+ foreach (var attribute in attributes)+ {+ var conditionMet = product.IsConditionMet(attribute, customAttributes);+ if (conditionMet.HasValue && !conditionMet.Value)+ customAttributes = ProductExtensions+ .RemoveProductAttribute(customAttributes, attribute).ToList();+ }- if (product.FindProductAttributeCombination(customAttributes) != null)- {- warnings.Add("This combination attributes exists!");- }+ if (customAttributes.Count == 0)+ {+ warnings.Add("This combination custom attributes is empty!");+ return warnings;+ }- if (warnings.Count == 0)+ foreach (var customAttribute in customAttributes)+ if (string.IsNullOrEmpty(customAttribute.Value)){- var combination = new ProductAttributeCombination {- Attributes = customAttributes,- StockQuantity = model.StockQuantity,- ReservedQuantity = model.ReservedQuantity,- AllowOutOfStockOrders = model.AllowOutOfStockOrders,- Sku = model.Sku,- Text = model.Text,- Mpn = model.Mpn,- Gtin = model.Gtin,- OverriddenPrice = model.OverriddenPrice,- NotifyAdminForQuantityBelow = model.NotifyAdminForQuantityBelow,- PictureId = model.PictureId- };+ warnings.Add("Combination custom attributes need to be selected value!");+ return warnings;+ }- if (product.UseMultipleWarehouses)- {- await PrepareCombinationWarehouseInventory(combination);- combination.StockQuantity = combination.WarehouseInventory.Sum(x => x.StockQuantity);- combination.ReservedQuantity = combination.WarehouseInventory.Sum(x => x.ReservedQuantity);- }+ #endregion- await _productAttributeService.InsertProductAttributeCombination(combination, product.Id);+ if (product.FindProductAttributeCombination(customAttributes) != null)+ warnings.Add("This combination attributes exists!");- if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByAttributes)- {- product.StockQuantity = product.ProductAttributeCombinations.Sum(x => x.StockQuantity);- product.ReservedQuantity = product.ProductAttributeCombinations.Sum(x => x.ReservedQuantity);- await _inventoryManageService.UpdateStockProduct(product, false);- }- }- }- else+ if (warnings.Count == 0){- var combination = product.ProductAttributeCombinations.FirstOrDefault(x => x.Id == model.Id);- var prevCombination = (ProductAttributeCombination)combination!.Clone();-- combination.StockQuantity = model.StockQuantity;- combination.ReservedQuantity = model.ReservedQuantity;- combination.AllowOutOfStockOrders = model.AllowOutOfStockOrders;- combination.Sku = model.Sku;- combination.Text = model.Text;- combination.Mpn = model.Mpn;- combination.Gtin = model.Gtin;- combination.OverriddenPrice = model.OverriddenPrice;- combination.NotifyAdminForQuantityBelow = model.NotifyAdminForQuantityBelow;- combination.PictureId = model.PictureId;+ var combination = new ProductAttributeCombination {+ Attributes = customAttributes,+ StockQuantity = model.StockQuantity,+ ReservedQuantity = model.ReservedQuantity,+ AllowOutOfStockOrders = model.AllowOutOfStockOrders,+ Sku = model.Sku,+ Text = model.Text,+ Mpn = model.Mpn,+ Gtin = model.Gtin,+ OverriddenPrice = model.OverriddenPrice,+ NotifyAdminForQuantityBelow = model.NotifyAdminForQuantityBelow,+ PictureId = model.PictureId+ };if (product.UseMultipleWarehouses){await PrepareCombinationWarehouseInventory(combination);combination.StockQuantity = combination.WarehouseInventory.Sum(x => x.StockQuantity);+ combination.ReservedQuantity = combination.WarehouseInventory.Sum(x => x.ReservedQuantity);}- //notification - out of stock- await OutOfStockNotifications(product, combination, prevCombination);-- //update combination- await _productAttributeService.UpdateProductAttributeCombination(combination, product.Id);+ await _productAttributeService.InsertProductAttributeCombination(combination, product.Id);if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByAttributes){- var pr = await _productService.GetProductById(model.ProductId);- pr.StockQuantity = pr.ProductAttributeCombinations.Sum(x => x.StockQuantity);- pr.ReservedQuantity = pr.ProductAttributeCombinations.Sum(x => x.ReservedQuantity);- await _inventoryManageService.UpdateStockProduct(pr, false);+ product.StockQuantity = product.ProductAttributeCombinations.Sum(x => x.StockQuantity);+ product.ReservedQuantity = product.ProductAttributeCombinations.Sum(x => x.ReservedQuantity);+ await _inventoryManageService.UpdateStockProduct(product, false);}}-- return warnings;}-- public virtual async Task GenerateAllAttributeCombinations(Product product)+ else{- var allAttributesComb = product.GenerateAllCombinations();- if (allAttributesComb == null || allAttributesComb.Count == 0)- return;+ var combination = product.ProductAttributeCombinations.FirstOrDefault(x => x.Id == model.Id);+ var prevCombination = (ProductAttributeCombination)combination!.Clone();- foreach (var attributes in allAttributesComb)- {- var customAttributes = attributes.ToList();- if (!customAttributes.Any())- continue;+ combination.StockQuantity = model.StockQuantity;+ combination.ReservedQuantity = model.ReservedQuantity;+ combination.AllowOutOfStockOrders = model.AllowOutOfStockOrders;+ combination.Sku = model.Sku;+ combination.Text = model.Text;+ combination.Mpn = model.Mpn;+ combination.Gtin = model.Gtin;+ combination.OverriddenPrice = model.OverriddenPrice;+ combination.NotifyAdminForQuantityBelow = model.NotifyAdminForQuantityBelow;+ combination.PictureId = model.PictureId;- var existingCombination = product.FindProductAttributeCombination(customAttributes);+ if (product.UseMultipleWarehouses)+ {+ await PrepareCombinationWarehouseInventory(combination);+ combination.StockQuantity = combination.WarehouseInventory.Sum(x => x.StockQuantity);+ }- //already exists?- if (existingCombination != null)- continue;+ //notification - out of stock+ await OutOfStockNotifications(product, combination, prevCombination);- //save combination- var combination = new ProductAttributeCombination {- Attributes = customAttributes.ToList(),- StockQuantity = 0,- AllowOutOfStockOrders = false,- Sku = null,- Mpn = null,- Gtin = null,- OverriddenPrice = null,- NotifyAdminForQuantityBelow = 1- };- await _productAttributeService.InsertProductAttributeCombination(combination, product.Id);- }+ //update combination+ await _productAttributeService.UpdateProductAttributeCombination(combination, product.Id);if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByAttributes){- product.StockQuantity = product.ProductAttributeCombinations.Sum(x => x.StockQuantity);- product.ReservedQuantity = product.ProductAttributeCombinations.Sum(x => x.ReservedQuantity);- await _inventoryManageService.UpdateStockProduct(product, false);- }- }-- public virtual async Task ClearAllAttributeCombinations(Product product)- {- foreach (var combination in product.ProductAttributeCombinations)- {- await _productAttributeService.DeleteProductAttributeCombination(combination, product.Id);+ var pr = await _productService.GetProductById(model.ProductId);+ pr.StockQuantity = pr.ProductAttributeCombinations.Sum(x => x.StockQuantity);+ pr.ReservedQuantity = pr.ProductAttributeCombinations.Sum(x => x.ReservedQuantity);+ await _inventoryManageService.UpdateStockProduct(pr, false);}}- public virtual Task<IList<ProductModel.ProductAttributeCombinationTierPricesModel>>- PrepareProductAttributeCombinationTierPricesModel(Product product, string productAttributeCombinationId)- {- var items = new List<ProductModel.ProductAttributeCombinationTierPricesModel>();- foreach (var x in product.ProductAttributeCombinations.Where(x => x.Id == productAttributeCombinationId)- .SelectMany(x => x.TierPrices))- {- var priceModel = new ProductModel.ProductAttributeCombinationTierPricesModel {- Id = x.Id,- Price = x.Price,- Quantity = x.Quantity,- ProductId = product.Id,- ProductAttributeCombinationId = productAttributeCombinationId- };- items.Add(priceModel);- }+ return warnings;+ }- return Task.FromResult<IList<ProductModel.ProductAttributeCombinationTierPricesModel>>(items);+ public virtual async Task GenerateAllAttributeCombinations(Product product)+ {+ var allAttributesComb = product.GenerateAllCombinations();+ if (allAttributesComb == null || allAttributesComb.Count == 0)+ return;++ foreach (var attributes in allAttributesComb)+ {+ var customAttributes = attributes.ToList();+ if (!customAttributes.Any())+ continue;++ var existingCombination = product.FindProductAttributeCombination(customAttributes);++ //already exists?+ if (existingCombination != null)+ continue;++ //save combination+ var combination = new ProductAttributeCombination {+ Attributes = customAttributes.ToList(),+ StockQuantity = 0,+ AllowOutOfStockOrders = false,+ Sku = null,+ Mpn = null,+ Gtin = null,+ OverriddenPrice = null,+ NotifyAdminForQuantityBelow = 1+ };+ await _productAttributeService.InsertProductAttributeCombination(combination, product.Id);}- public virtual async Task InsertProductAttributeCombinationTierPricesModel(Product product,- ProductAttributeCombination productAttributeCombination,- ProductModel.ProductAttributeCombinationTierPricesModel model)+ if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByAttributes){- if (productAttributeCombination != null)- {- var pctp = new ProductCombinationTierPrices {- Price = model.Price,- Quantity = model.Quantity- };- productAttributeCombination.TierPrices.Add(pctp);- await _productAttributeService.UpdateProductAttributeCombination(productAttributeCombination,- product.Id);- }+ product.StockQuantity = product.ProductAttributeCombinations.Sum(x => x.StockQuantity);+ product.ReservedQuantity = product.ProductAttributeCombinations.Sum(x => x.ReservedQuantity);+ await _inventoryManageService.UpdateStockProduct(product, false);}+ }- public virtual async Task UpdateProductAttributeCombinationTierPricesModel(Product product,- ProductAttributeCombination productAttributeCombination,- ProductModel.ProductAttributeCombinationTierPricesModel model)- {- if (productAttributeCombination != null)- {- var tierPrice = productAttributeCombination.TierPrices.FirstOrDefault(x => x.Id == model.Id);- if (tierPrice != null)- {- tierPrice.Price = model.Price;- tierPrice.Quantity = model.Quantity;- await _productAttributeService.UpdateProductAttributeCombination(productAttributeCombination,- product.Id);- }- }+ public virtual async Task ClearAllAttributeCombinations(Product product)+ {+ foreach (var combination in product.ProductAttributeCombinations)+ await _productAttributeService.DeleteProductAttributeCombination(combination, product.Id);+ }++ public virtual Task<IList<ProductModel.ProductAttributeCombinationTierPricesModel>>+ PrepareProductAttributeCombinationTierPricesModel(Product product, string productAttributeCombinationId)+ {+ var items = new List<ProductModel.ProductAttributeCombinationTierPricesModel>();+ foreach (var x in product.ProductAttributeCombinations.Where(x => x.Id == productAttributeCombinationId)+ .SelectMany(x => x.TierPrices))+ {+ var priceModel = new ProductModel.ProductAttributeCombinationTierPricesModel {+ Id = x.Id,+ Price = x.Price,+ Quantity = x.Quantity,+ ProductId = product.Id,+ ProductAttributeCombinationId = productAttributeCombinationId+ };+ items.Add(priceModel);}- public virtual async Task DeleteProductAttributeCombinationTierPrices(Product product,- ProductAttributeCombination productAttributeCombination, ProductCombinationTierPrices tierPrice)+ return Task.FromResult<IList<ProductModel.ProductAttributeCombinationTierPricesModel>>(items);+ }++ public virtual async Task InsertProductAttributeCombinationTierPricesModel(Product product,+ ProductAttributeCombination productAttributeCombination,+ ProductModel.ProductAttributeCombinationTierPricesModel model)+ {+ if (productAttributeCombination != null){- productAttributeCombination.TierPrices.Remove(tierPrice);- await _productAttributeService.UpdateProductAttributeCombination(productAttributeCombination, product.Id);+ var pctp = new ProductCombinationTierPrices {+ Price = model.Price,+ Quantity = model.Quantity+ };+ productAttributeCombination.TierPrices.Add(pctp);+ await _productAttributeService.UpdateProductAttributeCombination(productAttributeCombination,+ product.Id);}+ }- //Pictures- public virtual async Task<IList<ProductModel.ProductPictureModel>> PrepareProductPicturesModel(Product product)+ public virtual async Task UpdateProductAttributeCombinationTierPricesModel(Product product,+ ProductAttributeCombination productAttributeCombination,+ ProductModel.ProductAttributeCombinationTierPricesModel model)+ {+ if (productAttributeCombination != null){- var items = new List<ProductModel.ProductPictureModel>();- foreach (var x in product.ProductPictures.OrderBy(x => x.DisplayOrder))+ var tierPrice = productAttributeCombination.TierPrices.FirstOrDefault(x => x.Id == model.Id);+ if (tierPrice != null){- var picture = await _pictureService.GetPictureById(x.PictureId);- var m = new ProductModel.ProductPictureModel {- Id = x.Id,- ProductId = product.Id,- PictureId = x.PictureId,- PictureUrl = picture != null ? await _pictureService.GetPictureUrl(picture) : null,- AltAttribute = picture?.AltAttribute,- TitleAttribute = picture?.TitleAttribute,- DisplayOrder = x.DisplayOrder,- Style = picture?.Style,- ExtraField = picture?.ExtraField- };- items.Add(m);+ tierPrice.Price = model.Price;+ tierPrice.Quantity = model.Quantity;+ await _productAttributeService.UpdateProductAttributeCombination(productAttributeCombination,+ product.Id);}-- return items;}+ }++ public virtual async Task DeleteProductAttributeCombinationTierPrices(Product product,+ ProductAttributeCombination productAttributeCombination, ProductCombinationTierPrices tierPrice)+ {+ productAttributeCombination.TierPrices.Remove(tierPrice);+ await _productAttributeService.UpdateProductAttributeCombination(productAttributeCombination, product.Id);+ }- public virtual async Task<(ProductModel.ProductPictureModel model, Picture Picture)> PrepareProductPictureModel(- Product product, ProductPicture productPicture)+ //Pictures+ public virtual async Task<IList<ProductModel.ProductPictureModel>> PrepareProductPicturesModel(Product product)+ {+ var items = new List<ProductModel.ProductPictureModel>();+ foreach (var x in product.ProductPictures.OrderBy(x => x.DisplayOrder)){- var picture = await _pictureService.GetPictureById(productPicture.PictureId);- var model = new ProductModel.ProductPictureModel {- Id = productPicture.Id,+ var picture = await _pictureService.GetPictureById(x.PictureId);+ var m = new ProductModel.ProductPictureModel {+ Id = x.Id,ProductId = product.Id,- PictureId = productPicture.PictureId,+ PictureId = x.PictureId,PictureUrl = picture != null ? await _pictureService.GetPictureUrl(picture) : null,AltAttribute = picture?.AltAttribute,TitleAttribute = picture?.TitleAttribute,- DisplayOrder = productPicture.DisplayOrder,+ DisplayOrder = x.DisplayOrder,Style = picture?.Style,ExtraField = picture?.ExtraField};-- return (model, picture);+ items.Add(m);}- public virtual async Task InsertProductPicture(Product product, Picture picture, int displayOrder)- {- if (picture == null)- throw new ArgumentException("No picture found with the specified id");+ return items;+ }- if (product.ProductPictures.Count(x => x.PictureId == picture.Id) > 0)- return;+ public virtual async Task<(ProductModel.ProductPictureModel model, Picture Picture)> PrepareProductPictureModel(+ Product product, ProductPicture productPicture)+ {+ var picture = await _pictureService.GetPictureById(productPicture.PictureId);+ var model = new ProductModel.ProductPictureModel {+ Id = productPicture.Id,+ ProductId = product.Id,+ PictureId = productPicture.PictureId,+ PictureUrl = picture != null ? await _pictureService.GetPictureUrl(picture) : null,+ AltAttribute = picture?.AltAttribute,+ TitleAttribute = picture?.TitleAttribute,+ DisplayOrder = productPicture.DisplayOrder,+ Style = picture?.Style,+ ExtraField = picture?.ExtraField+ };++ return (model, picture);+ }- await _productService.InsertProductPicture(new ProductPicture {- PictureId = picture.Id,- DisplayOrder = displayOrder- }, product.Id);+ public virtual async Task InsertProductPicture(Product product, Picture picture, int displayOrder)+ {+ if (picture == null)+ throw new ArgumentException("No picture found with the specified id");- await _pictureService.SetSeoFilename(picture, _pictureService.GetPictureSeName(product.Name));- }+ if (product.ProductPictures.Count(x => x.PictureId == picture.Id) > 0)+ return;- public virtual async Task UpdateProductPicture(ProductModel.ProductPictureModel model)- {- var product = await _productService.GetProductById(model.ProductId, true);+ await _productService.InsertProductPicture(new ProductPicture {+ PictureId = picture.Id,+ DisplayOrder = displayOrder+ }, product.Id);- var productPicture = product.ProductPictures.FirstOrDefault(x => x.Id == model.Id);- if (productPicture == null)- throw new ArgumentException("No product picture found with the specified id");+ await _pictureService.SetSeoFilename(picture, _pictureService.GetPictureSeName(product.Name));+ }- var picture = await _pictureService.GetPictureById(productPicture.PictureId);- if (picture == null)- throw new ArgumentException("No picture found with the specified id");+ public virtual async Task UpdateProductPicture(ProductModel.ProductPictureModel model)+ {+ var product = await _productService.GetProductById(model.ProductId, true);- productPicture.DisplayOrder = model.DisplayOrder;- await _productService.UpdateProductPicture(productPicture, product.Id);+ var productPicture = product.ProductPictures.FirstOrDefault(x => x.Id == model.Id);+ if (productPicture == null)+ throw new ArgumentException("No product picture found with the specified id");- //Update picture fields- await _pictureService.UpdatePictureField(picture, x => x.AltAttribute, model.AltAttribute);- await _pictureService.UpdatePictureField(picture, x => x.TitleAttribute, model.TitleAttribute);- await _pictureService.UpdatePictureField(picture, x => x.Locales, model.Locales.ToTranslationProperty());- await _pictureService.UpdatePictureField(picture, x => x.Style, model.Style);- await _pictureService.UpdatePictureField(picture, x => x.ExtraField, model.ExtraField);- }+ var picture = await _pictureService.GetPictureById(productPicture.PictureId);+ if (picture == null)+ throw new ArgumentException("No picture found with the specified id");- public virtual async Task DeleteProductPicture(ProductModel.ProductPictureModel model)- {- var product = await _productService.GetProductById(model.ProductId, true);+ productPicture.DisplayOrder = model.DisplayOrder;+ await _productService.UpdateProductPicture(productPicture, product.Id);- var productPicture = product.ProductPictures.FirstOrDefault(x => x.Id == model.Id);- if (productPicture == null)- throw new ArgumentException("No product picture found with the specified id");+ //Update picture fields+ await _pictureService.UpdatePictureField(picture, x => x.AltAttribute, model.AltAttribute);+ await _pictureService.UpdatePictureField(picture, x => x.TitleAttribute, model.TitleAttribute);+ await _pictureService.UpdatePictureField(picture, x => x.Locales, model.Locales.ToTranslationProperty());+ await _pictureService.UpdatePictureField(picture, x => x.Style, model.Style);+ await _pictureService.UpdatePictureField(picture, x => x.ExtraField, model.ExtraField);+ }- var pictureId = productPicture.PictureId;- await _productService.DeleteProductPicture(productPicture, product.Id);+ public virtual async Task DeleteProductPicture(ProductModel.ProductPictureModel model)+ {+ var product = await _productService.GetProductById(model.ProductId, true);- var picture = await _pictureService.GetPictureById(pictureId);- if (picture != null)- await _pictureService.DeletePicture(picture);- }+ var productPicture = product.ProductPictures.FirstOrDefault(x => x.Id == model.Id);+ if (productPicture == null)+ throw new ArgumentException("No product picture found with the specified id");- //Product specification- public virtual async Task<IList<ProductSpecificationAttributeModel>> PrepareProductSpecificationAttributeModel(- Product product)- {- var items = new List<ProductSpecificationAttributeModel>();- foreach (var x in product.ProductSpecificationAttributes.OrderBy(x => x.DisplayOrder))- {- var psaModel = new ProductSpecificationAttributeModel {- Id = x.Id,- AttributeTypeId = (int)x.AttributeTypeId,- AttributeId = x.SpecificationAttributeId,- ProductId = product.Id,- AttributeTypeName = x.AttributeTypeId.GetTranslationEnum(_translationService, _workContext),- AllowFiltering = x.AllowFiltering,- ShowOnProductPage = x.ShowOnProductPage,- DisplayOrder = x.DisplayOrder,- AttributeName = x.CustomName- };+ var pictureId = productPicture.PictureId;+ await _productService.DeleteProductPicture(productPicture, product.Id);- switch (x.AttributeTypeId)- {- case SpecificationAttributeType.Option:- var specificationAttribute =- await _specificationAttributeService.GetSpecificationAttributeById(- x.SpecificationAttributeId);- if (specificationAttribute != null)- {- psaModel.AttributeName = specificationAttribute.Name;- psaModel.ValueRaw = System.Net.WebUtility.HtmlEncode(specificationAttribute- .SpecificationAttributeOptions- .FirstOrDefault(y => y.Id == x.SpecificationAttributeOptionId)?.Name);- }+ var picture = await _pictureService.GetPictureById(pictureId);+ if (picture != null)+ await _pictureService.DeletePicture(picture);+ }- psaModel.SpecificationAttributeOptionId = x.SpecificationAttributeOptionId;- break;- case SpecificationAttributeType.CustomText:- psaModel.ValueRaw = System.Net.WebUtility.HtmlEncode(x.CustomValue);- break;- case SpecificationAttributeType.CustomHtmlText:- //do not encode?- psaModel.ValueRaw = System.Net.WebUtility.HtmlEncode(x.CustomValue);- break;- case SpecificationAttributeType.Hyperlink:- psaModel.ValueRaw = x.CustomValue;- break;- }+ //Product specification+ public virtual async Task<IList<ProductSpecificationAttributeModel>> PrepareProductSpecificationAttributeModel(+ Product product)+ {+ var items = new List<ProductSpecificationAttributeModel>();+ foreach (var x in product.ProductSpecificationAttributes.OrderBy(x => x.DisplayOrder))+ {+ var psaModel = new ProductSpecificationAttributeModel {+ Id = x.Id,+ AttributeTypeId = (int)x.AttributeTypeId,+ AttributeId = x.SpecificationAttributeId,+ ProductId = product.Id,+ AttributeTypeName = x.AttributeTypeId.GetTranslationEnum(_translationService, _workContext),+ AllowFiltering = x.AllowFiltering,+ ShowOnProductPage = x.ShowOnProductPage,+ DisplayOrder = x.DisplayOrder,+ AttributeName = x.CustomName+ };++ switch (x.AttributeTypeId)+ {+ case SpecificationAttributeType.Option:+ var specificationAttribute =+ await _specificationAttributeService.GetSpecificationAttributeById(+ x.SpecificationAttributeId);+ if (specificationAttribute != null)+ {+ psaModel.AttributeName = specificationAttribute.Name;+ psaModel.ValueRaw = WebUtility.HtmlEncode(specificationAttribute+ .SpecificationAttributeOptions+ .FirstOrDefault(y => y.Id == x.SpecificationAttributeOptionId)?.Name);+ }- items.Add(psaModel);+ psaModel.SpecificationAttributeOptionId = x.SpecificationAttributeOptionId;+ break;+ case SpecificationAttributeType.CustomText:+ psaModel.ValueRaw = WebUtility.HtmlEncode(x.CustomValue);+ break;+ case SpecificationAttributeType.CustomHtmlText:+ //do not encode?+ psaModel.ValueRaw = WebUtility.HtmlEncode(x.CustomValue);+ break;+ case SpecificationAttributeType.Hyperlink:+ psaModel.ValueRaw = x.CustomValue;+ break;}- return items;+ items.Add(psaModel);}- public virtual async Task InsertProductSpecificationAttributeModel(- ProductModel.AddProductSpecificationAttributeModel model, Product product)+ return items;+ }++ public virtual async Task InsertProductSpecificationAttributeModel(+ ProductModel.AddProductSpecificationAttributeModel model, Product product)+ {+ //we allow filtering only for "Option" attribute type+ if (model.AttributeTypeId != (int)SpecificationAttributeType.Option){- //we allow filtering only for "Option" attribute type- if (model.AttributeTypeId != (int)SpecificationAttributeType.Option)- {- model.AllowFiltering = false;- model.SpecificationAttributeOptionId = null;- }+ model.AllowFiltering = false;+ model.SpecificationAttributeOptionId = null;+ }- var psa = model.ToEntity();+ var psa = model.ToEntity();- await _specificationAttributeService.InsertProductSpecificationAttribute(psa, product.Id);- product.ProductSpecificationAttributes.Add(psa);- }+ await _specificationAttributeService.InsertProductSpecificationAttribute(psa, product.Id);+ product.ProductSpecificationAttributes.Add(psa);+ }++ public virtual async Task UpdateProductSpecificationAttributeModel(ProductSpecificationAttribute psa,+ ProductModel.AddProductSpecificationAttributeModel model)+ {+ psa = model.ToEntity(psa);+ await _specificationAttributeService.UpdateProductSpecificationAttribute(psa, model.ProductId);+ }++ public virtual async Task DeleteProductSpecificationAttribute(Product product,+ ProductSpecificationAttribute psa)+ {+ product.ProductSpecificationAttributes.Remove(psa);+ await _specificationAttributeService.DeleteProductSpecificationAttribute(psa, product.Id);+ }- public virtual async Task UpdateProductSpecificationAttributeModel(ProductSpecificationAttribute psa,- ProductModel.AddProductSpecificationAttributeModel model)+ protected virtual async Task UpdatePictureSeoNames(Product product)+ {+ var picturesename = _pictureService.GetPictureSeName(product.Name);+ foreach (var pp in product.ProductPictures){- psa = model.ToEntity(psa);- await _specificationAttributeService.UpdateProductSpecificationAttribute(psa, model.ProductId);+ var picture = await _pictureService.GetPictureById(pp.PictureId);+ if (picture != null)+ await _pictureService.SetSeoFilename(picture, picturesename);}+ }- public virtual async Task DeleteProductSpecificationAttribute(Product product,- ProductSpecificationAttribute psa)+ protected virtual async Task<List<string>> GetChildCategoryIds(string parentCategoryId)+ {+ var categoriesIds = new List<string>();+ var categories = await _categoryService.GetAllCategoriesByParentCategoryId(parentCategoryId, true);+ foreach (var category in categories){- product.ProductSpecificationAttributes.Remove(psa);- await _specificationAttributeService.DeleteProductSpecificationAttribute(psa, product.Id);+ categoriesIds.Add(category.Id);+ categoriesIds.AddRange(await GetChildCategoryIds(category.Id));}++ return categoriesIds;+ }++ protected virtual T PrepareAddProductModel<T>() where T : ProductModel.AddProductModel, new()+ {+ var model = new T {+ //product types+ AvailableProductTypes = ProductType.SimpleProduct+ .ToSelectList(_translationService, _workContext, false).ToList()+ };++ model.AvailableProductTypes.Insert(0,+ new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = "0" });++ return model;}}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Services/ShipmentViewModelService.cs b/src/Web/Grand.Web.Vendor/Services/ShipmentViewModelService.csindex 46e1a9a40..1b55bf2c3 100644--- a/src/Web/Grand.Web.Vendor/Services/ShipmentViewModelService.cs+++ b/src/Web/Grand.Web.Vendor/Services/ShipmentViewModelService.cs@@ -15,576 +15,544 @@ using Grand.Web.Vendor.Interfaces;using Grand.Web.Vendor.Models.Shipment;using Microsoft.AspNetCore.Mvc.Rendering;-namespace Grand.Web.Vendor.Services+namespace Grand.Web.Vendor.Services;++public class ShipmentViewModelService : IShipmentViewModelService{- public class ShipmentViewModelService : IShipmentViewModelService+ private readonly IDateTimeService _dateTimeService;+ private readonly IGroupService _groupService;+ private readonly IMeasureService _measureService;+ private readonly MeasureSettings _measureSettings;+ private readonly IOrderService _orderService;+ private readonly IProductService _productService;+ private readonly IShipmentService _shipmentService;+ private readonly ShippingProviderSettings _shippingProviderSettings;+ private readonly IShippingService _shippingService;+ private readonly ShippingSettings _shippingSettings;+ private readonly IStockQuantityService _stockQuantityService;+ private readonly ITranslationService _translationService;+ private readonly IWarehouseService _warehouseService;+ private readonly IWorkContext _workContext;++ public ShipmentViewModelService(+ IOrderService orderService,+ IWorkContext workContext,+ IGroupService groupService,+ IProductService productService,+ IShipmentService shipmentService,+ IWarehouseService warehouseService,+ IMeasureService measureService,+ IDateTimeService dateTimeService,+ ITranslationService translationService,+ IShippingService shippingService,+ IStockQuantityService stockQuantityService,+ MeasureSettings measureSettings,+ ShippingSettings shippingSettings,+ ShippingProviderSettings shippingProviderSettings){- private readonly IOrderService _orderService;- private readonly IWorkContext _workContext;- private readonly IGroupService _groupService;- private readonly IProductService _productService;- private readonly IShipmentService _shipmentService;- private readonly IWarehouseService _warehouseService;- private readonly IMeasureService _measureService;- private readonly IDateTimeService _dateTimeService;- private readonly ITranslationService _translationService;- private readonly IShippingService _shippingService;- private readonly IStockQuantityService _stockQuantityService;- private readonly MeasureSettings _measureSettings;- private readonly ShippingSettings _shippingSettings;- private readonly ShippingProviderSettings _shippingProviderSettings;-- public ShipmentViewModelService(- IOrderService orderService,- IWorkContext workContext,- IGroupService groupService,- IProductService productService,- IShipmentService shipmentService,- IWarehouseService warehouseService,- IMeasureService measureService,- IDateTimeService dateTimeService,- ITranslationService translationService,- IShippingService shippingService,- IStockQuantityService stockQuantityService,- MeasureSettings measureSettings,- ShippingSettings shippingSettings,- ShippingProviderSettings shippingProviderSettings)- {- _orderService = orderService;- _workContext = workContext;- _groupService = groupService;- _productService = productService;- _shipmentService = shipmentService;- _warehouseService = warehouseService;- _measureService = measureService;- _dateTimeService = dateTimeService;- _translationService = translationService;- _shippingService = shippingService;- _stockQuantityService = stockQuantityService;- _measureSettings = measureSettings;- _shippingSettings = shippingSettings;- _shippingProviderSettings = shippingProviderSettings;- }-- public virtual async Task<ShipmentModel> PrepareShipmentModel(Shipment shipment, bool prepareProducts,- bool prepareShipmentEvent = false)- {- //measures- var baseWeight = await _measureService.GetMeasureWeightById(_measureSettings.BaseWeightId);- var baseWeightIn = baseWeight != null ? baseWeight.Name : "";- var baseDimension = await _measureService.GetMeasureDimensionById(_measureSettings.BaseDimensionId);- var baseDimensionIn = baseDimension != null ? baseDimension.Name : "";- var order = await _orderService.GetOrderById(shipment.OrderId);-- var model = new ShipmentModel {- Id = shipment.Id,- ShipmentNumber = shipment.ShipmentNumber,- OrderId = shipment.OrderId,- OrderNumber = order?.OrderNumber ?? 0,- OrderCode = order != null ? order.Code : "",- TrackingNumber = shipment.TrackingNumber,- TotalWeight = shipment.TotalWeight.HasValue ? $"{shipment.TotalWeight:F2} [{baseWeightIn}]" : "",- ShippedDate = shipment.ShippedDateUtc.HasValue- ? _dateTimeService.ConvertToUserTime(shipment.ShippedDateUtc.Value, DateTimeKind.Utc)- : new DateTime?(),- ShippedDateUtc = shipment.ShippedDateUtc,- CanShip = !shipment.ShippedDateUtc.HasValue,- DeliveryDate = shipment.DeliveryDateUtc.HasValue- ? _dateTimeService.ConvertToUserTime(shipment.DeliveryDateUtc.Value, DateTimeKind.Utc)- : new DateTime?(),- DeliveryDateUtc = shipment.DeliveryDateUtc,- CanDeliver = shipment.ShippedDateUtc.HasValue && !shipment.DeliveryDateUtc.HasValue,- AdminComment = shipment.AdminComment- };+ _orderService = orderService;+ _workContext = workContext;+ _groupService = groupService;+ _productService = productService;+ _shipmentService = shipmentService;+ _warehouseService = warehouseService;+ _measureService = measureService;+ _dateTimeService = dateTimeService;+ _translationService = translationService;+ _shippingService = shippingService;+ _stockQuantityService = stockQuantityService;+ _measureSettings = measureSettings;+ _shippingSettings = shippingSettings;+ _shippingProviderSettings = shippingProviderSettings;+ }- if (prepareProducts)+ public virtual async Task<ShipmentModel> PrepareShipmentModel(Shipment shipment, bool prepareProducts,+ bool prepareShipmentEvent = false)+ {+ //measures+ var baseWeight = await _measureService.GetMeasureWeightById(_measureSettings.BaseWeightId);+ var baseWeightIn = baseWeight != null ? baseWeight.Name : "";+ var baseDimension = await _measureService.GetMeasureDimensionById(_measureSettings.BaseDimensionId);+ var baseDimensionIn = baseDimension != null ? baseDimension.Name : "";+ var order = await _orderService.GetOrderById(shipment.OrderId);++ var model = new ShipmentModel {+ Id = shipment.Id,+ ShipmentNumber = shipment.ShipmentNumber,+ OrderId = shipment.OrderId,+ OrderNumber = order?.OrderNumber ?? 0,+ OrderCode = order != null ? order.Code : "",+ TrackingNumber = shipment.TrackingNumber,+ TotalWeight = shipment.TotalWeight.HasValue ? $"{shipment.TotalWeight:F2} [{baseWeightIn}]" : "",+ ShippedDate = shipment.ShippedDateUtc.HasValue+ ? _dateTimeService.ConvertToUserTime(shipment.ShippedDateUtc.Value, DateTimeKind.Utc)+ : new DateTime?(),+ ShippedDateUtc = shipment.ShippedDateUtc,+ CanShip = !shipment.ShippedDateUtc.HasValue,+ DeliveryDate = shipment.DeliveryDateUtc.HasValue+ ? _dateTimeService.ConvertToUserTime(shipment.DeliveryDateUtc.Value, DateTimeKind.Utc)+ : new DateTime?(),+ DeliveryDateUtc = shipment.DeliveryDateUtc,+ CanDeliver = shipment.ShippedDateUtc.HasValue && !shipment.DeliveryDateUtc.HasValue,+ AdminComment = shipment.AdminComment+ };++ if (prepareProducts)+ foreach (var shipmentItem in shipment.ShipmentItems){- foreach (var shipmentItem in shipment.ShipmentItems)+ var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == shipmentItem.OrderItemId);+ if (orderItem == null)+ continue;++ if (orderItem.VendorId != _workContext.CurrentVendor.Id)+ continue;++ //quantities+ var qtyInThisShipment = shipmentItem.Quantity;+ var maxQtyToAdd = orderItem.OpenQty;+ var qtyOrdered = shipmentItem.Quantity;+ var qtyInAllShipments = orderItem.ShipQty;+ var product = await _productService.GetProductByIdIncludeArch(orderItem.ProductId);+ if (product != null){- var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == shipmentItem.OrderItemId);- if (orderItem == null)- continue;-- if (orderItem.VendorId != _workContext.CurrentVendor.Id)- continue;-- //quantities- var qtyInThisShipment = shipmentItem.Quantity;- var maxQtyToAdd = orderItem.OpenQty;- var qtyOrdered = shipmentItem.Quantity;- var qtyInAllShipments = orderItem.ShipQty;- var product = await _productService.GetProductByIdIncludeArch(orderItem.ProductId);- if (product != null)- {- var warehouse = await _warehouseService.GetWarehouseById(shipmentItem.WarehouseId);- var shipmentItemModel = new ShipmentModel.ShipmentItemModel {- Id = shipmentItem.Id,- OrderItemId = orderItem.Id,- ProductId = orderItem.ProductId,- ProductName = product.Name,- Sku = product.FormatSku(orderItem.Attributes),- AttributeInfo = orderItem.AttributeDescription,- ShippedFromWarehouse = warehouse?.Name,- ShipSeparately = product.ShipSeparately,- ItemWeight = orderItem.ItemWeight.HasValue- ? $"{orderItem.ItemWeight:F2} [{baseWeightIn}]"- : "",- ItemDimensions =- $"{product.Length:F2} x {product.Width:F2} x {product.Height:F2} [{baseDimensionIn}]",- QuantityOrdered = qtyOrdered,- QuantityInThisShipment = qtyInThisShipment,- QuantityInAllShipments = qtyInAllShipments,- QuantityToAdd = maxQtyToAdd- };-- model.Items.Add(shipmentItemModel);- }+ var warehouse = await _warehouseService.GetWarehouseById(shipmentItem.WarehouseId);+ var shipmentItemModel = new ShipmentModel.ShipmentItemModel {+ Id = shipmentItem.Id,+ OrderItemId = orderItem.Id,+ ProductId = orderItem.ProductId,+ ProductName = product.Name,+ Sku = product.FormatSku(orderItem.Attributes),+ AttributeInfo = orderItem.AttributeDescription,+ ShippedFromWarehouse = warehouse?.Name,+ ShipSeparately = product.ShipSeparately,+ ItemWeight = orderItem.ItemWeight.HasValue+ ? $"{orderItem.ItemWeight:F2} [{baseWeightIn}]"+ : "",+ ItemDimensions =+ $"{product.Length:F2} x {product.Width:F2} x {product.Height:F2} [{baseDimensionIn}]",+ QuantityOrdered = qtyOrdered,+ QuantityInThisShipment = qtyInThisShipment,+ QuantityInAllShipments = qtyInAllShipments,+ QuantityToAdd = maxQtyToAdd+ };++ model.Items.Add(shipmentItemModel);}}- if (prepareShipmentEvent && !string.IsNullOrEmpty(shipment.TrackingNumber))+ if (prepareShipmentEvent && !string.IsNullOrEmpty(shipment.TrackingNumber))+ {+ var srcm = _shippingService.LoadShippingRateCalculationProviderBySystemName(+ order.ShippingRateProviderSystemName);+ if (srcm != null &&+ srcm.IsShippingRateMethodActive(_shippingProviderSettings)){- var srcm = _shippingService.LoadShippingRateCalculationProviderBySystemName(- order.ShippingRateProviderSystemName);- if (srcm != null &&- srcm.IsShippingRateMethodActive(_shippingProviderSettings))+ var shipmentTracker = srcm.ShipmentTracker;+ if (shipmentTracker != null){- var shipmentTracker = srcm.ShipmentTracker;- if (shipmentTracker != null)+ model.TrackingNumberUrl = await shipmentTracker.GetUrl(shipment.TrackingNumber);+ if (_shippingSettings.DisplayShipmentEventsToStoreOwner){- model.TrackingNumberUrl = await shipmentTracker.GetUrl(shipment.TrackingNumber);- if (_shippingSettings.DisplayShipmentEventsToStoreOwner)- {- var shipmentEvents = await shipmentTracker.GetShipmentEvents(shipment.TrackingNumber);- if (shipmentEvents != null)+ var shipmentEvents = await shipmentTracker.GetShipmentEvents(shipment.TrackingNumber);+ if (shipmentEvents != null)+ foreach (var shipmentEvent in shipmentEvents){- foreach (var shipmentEvent in shipmentEvents)- {- var shipmentStatusEventModel = new ShipmentModel.ShipmentStatusEventModel {- Date = shipmentEvent.Date,- EventName = shipmentEvent.EventName,- Location = shipmentEvent.Location- };- model.ShipmentStatusEvents.Add(shipmentStatusEventModel);- }+ var shipmentStatusEventModel = new ShipmentModel.ShipmentStatusEventModel {+ Date = shipmentEvent.Date,+ EventName = shipmentEvent.EventName,+ Location = shipmentEvent.Location+ };+ model.ShipmentStatusEvents.Add(shipmentStatusEventModel);}- }}}}-- return model;}+ return model;+ }+- public virtual async Task<int> GetStockQty(Product product, string warehouseId)+ public virtual async Task<int> GetStockQty(Product product, string warehouseId)+ {+ var qty = new List<int>();+ foreach (var item in product.BundleProducts){- List<int> qty = new List<int>();- foreach (var item in product.BundleProducts)+ var p1 = await _productService.GetProductById(item.ProductId);+ if (p1.UseMultipleWarehouses){- var p1 = await _productService.GetProductById(item.ProductId);- if (p1.UseMultipleWarehouses)- {- var stock = p1.ProductWarehouseInventory.FirstOrDefault(x => x.WarehouseId == warehouseId);- if (stock != null)- {- qty.Add(stock.StockQuantity / item.Quantity);- }- }- else- {- qty.Add(p1.StockQuantity / item.Quantity);- }+ var stock = p1.ProductWarehouseInventory.FirstOrDefault(x => x.WarehouseId == warehouseId);+ if (stock != null) qty.Add(stock.StockQuantity / item.Quantity);}-- return qty.Count > 0 ? qty.Min() : 0;- }-- public virtual async Task<int> GetReservedQty(Product product, string warehouseId)- {- List<int> qty = new List<int>();- foreach (var item in product.BundleProducts)+ else{- var p1 = await _productService.GetProductById(item.ProductId);- if (p1.UseMultipleWarehouses)- {- var stock = p1.ProductWarehouseInventory.FirstOrDefault(x => x.WarehouseId == warehouseId);- if (stock != null)- {- qty.Add(stock.ReservedQuantity / item.Quantity);- }- }+ qty.Add(p1.StockQuantity / item.Quantity);}-- return qty.Count > 0 ? qty.Min() : 0;}- public virtual async Task<IList<ShipmentModel.ShipmentNote>> PrepareShipmentNotes(Shipment shipment)+ return qty.Count > 0 ? qty.Min() : 0;+ }++ public virtual async Task<int> GetReservedQty(Product product, string warehouseId)+ {+ var qty = new List<int>();+ foreach (var item in product.BundleProducts){- //shipment notes- var shipmentNoteModels = new List<ShipmentModel.ShipmentNote>();- foreach (var shipmentNote in (await _shipmentService.GetShipmentNotes(shipment.Id))- .OrderByDescending(on => on.CreatedOnUtc))+ var p1 = await _productService.GetProductById(item.ProductId);+ if (p1.UseMultipleWarehouses){- shipmentNoteModels.Add(new ShipmentModel.ShipmentNote {- Id = shipmentNote.Id,- ShipmentId = shipment.Id,- DisplayToCustomer = shipmentNote.DisplayToCustomer,- Note = shipmentNote.Note,- CreatedOn = _dateTimeService.ConvertToUserTime(shipmentNote.CreatedOnUtc, DateTimeKind.Utc),- CreatedByCustomer = shipmentNote.CreatedByCustomer- });+ var stock = p1.ProductWarehouseInventory.FirstOrDefault(x => x.WarehouseId == warehouseId);+ if (stock != null) qty.Add(stock.ReservedQuantity / item.Quantity);}-- return shipmentNoteModels;}- public virtual async Task InsertShipmentNote(Shipment shipment, bool displayToCustomer,- string message)- {- var shipmentNote = new ShipmentNote {- DisplayToCustomer = displayToCustomer,- Note = message,- ShipmentId = shipment.Id- };- await _shipmentService.InsertShipmentNote(shipmentNote);- }+ return qty.Count > 0 ? qty.Min() : 0;+ }- public virtual async Task DeleteShipmentNote(Shipment shipment, string id)- {- var shipmentNote = (await _shipmentService.GetShipmentNotes(shipment.Id)).FirstOrDefault(on => on.Id == id);- if (shipmentNote == null)- throw new ArgumentException("No shipment note found with the specified id");+ public virtual async Task<IList<ShipmentModel.ShipmentNote>> PrepareShipmentNotes(Shipment shipment)+ {+ //shipment notes+ var shipmentNoteModels = new List<ShipmentModel.ShipmentNote>();+ foreach (var shipmentNote in (await _shipmentService.GetShipmentNotes(shipment.Id))+ .OrderByDescending(on => on.CreatedOnUtc))+ shipmentNoteModels.Add(new ShipmentModel.ShipmentNote {+ Id = shipmentNote.Id,+ ShipmentId = shipment.Id,+ DisplayToCustomer = shipmentNote.DisplayToCustomer,+ Note = shipmentNote.Note,+ CreatedOn = _dateTimeService.ConvertToUserTime(shipmentNote.CreatedOnUtc, DateTimeKind.Utc),+ CreatedByCustomer = shipmentNote.CreatedByCustomer+ });++ return shipmentNoteModels;+ }- shipmentNote.ShipmentId = shipment.Id;- await _shipmentService.DeleteShipmentNote(shipmentNote);- }+ public virtual async Task InsertShipmentNote(Shipment shipment, bool displayToCustomer,+ string message)+ {+ var shipmentNote = new ShipmentNote {+ DisplayToCustomer = displayToCustomer,+ Note = message,+ ShipmentId = shipment.Id+ };+ await _shipmentService.InsertShipmentNote(shipmentNote);+ }- public virtual async Task<(IEnumerable<Shipment> shipments, int totalCount)> PrepareShipments(- ShipmentListModel model, int pageIndex, int pageSize)- {- DateTime? startDateValue = model.StartDate == null- ? null- : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);-- DateTime? endDateValue = model.EndDate == null- ? null- : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);-- //load shipments- var shipments = await _shipmentService.GetAllShipments(- vendorId: _workContext.CurrentVendor.Id,- warehouseId: model.WarehouseId,- shippingCity: model.City,- trackingNumber: model.TrackingNumber,- loadNotShipped: model.LoadNotShipped,- createdFromUtc: startDateValue,- createdToUtc: endDateValue,- pageIndex: pageIndex - 1,- pageSize: pageSize);-- return (shipments.ToList(), shipments.TotalCount);- }+ public virtual async Task DeleteShipmentNote(Shipment shipment, string id)+ {+ var shipmentNote = (await _shipmentService.GetShipmentNotes(shipment.Id)).FirstOrDefault(on => on.Id == id);+ if (shipmentNote == null)+ throw new ArgumentException("No shipment note found with the specified id");- public virtual async Task<ShipmentListModel> PrepareShipmentListModel()- {- var model = new ShipmentListModel();- //warehouses- model.AvailableWarehouses.Add(new SelectListItem- { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });- foreach (var w in await _warehouseService.GetAllWarehouses())- model.AvailableWarehouses.Add(new SelectListItem { Text = w.Name, Value = w.Id });-- return model;- }+ shipmentNote.ShipmentId = shipment.Id;+ await _shipmentService.DeleteShipmentNote(shipmentNote);+ }- public virtual async Task<ShipmentModel> PrepareShipmentModel(Order order)- {- var model = new ShipmentModel {- OrderId = order.Id,- OrderNumber = order.OrderNumber- };+ public virtual async Task<(IEnumerable<Shipment> shipments, int totalCount)> PrepareShipments(+ ShipmentListModel model, int pageIndex, int pageSize)+ {+ DateTime? startDateValue = model.StartDate == null+ ? null+ : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);++ DateTime? endDateValue = model.EndDate == null+ ? null+ : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);++ //load shipments+ var shipments = await _shipmentService.GetAllShipments(+ vendorId: _workContext.CurrentVendor.Id,+ warehouseId: model.WarehouseId,+ shippingCity: model.City,+ trackingNumber: model.TrackingNumber,+ loadNotShipped: model.LoadNotShipped,+ createdFromUtc: startDateValue,+ createdToUtc: endDateValue,+ pageIndex: pageIndex - 1,+ pageSize: pageSize);++ return (shipments.ToList(), shipments.TotalCount);+ }- //measures- var baseWeight = await _measureService.GetMeasureWeightById(_measureSettings.BaseWeightId);- var baseWeightIn = baseWeight != null ? baseWeight.Name : "";- var baseDimension = await _measureService.GetMeasureDimensionById(_measureSettings.BaseDimensionId);- var baseDimensionIn = baseDimension != null ? baseDimension.Name : "";+ public virtual async Task<ShipmentListModel> PrepareShipmentListModel()+ {+ var model = new ShipmentListModel();+ //warehouses+ model.AvailableWarehouses.Add(new SelectListItem+ { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });+ foreach (var w in await _warehouseService.GetAllWarehouses())+ model.AvailableWarehouses.Add(new SelectListItem { Text = w.Name, Value = w.Id });++ return model;+ }- var orderItems = order.OrderItems;- //a vendor should have access only to his products- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))- {- orderItems = orderItems.Where(_workContext.HasAccessToOrderItem).ToList();- }+ public virtual async Task<ShipmentModel> PrepareShipmentModel(Order order)+ {+ var model = new ShipmentModel {+ OrderId = order.Id,+ OrderNumber = order.OrderNumber+ };++ //measures+ var baseWeight = await _measureService.GetMeasureWeightById(_measureSettings.BaseWeightId);+ var baseWeightIn = baseWeight != null ? baseWeight.Name : "";+ var baseDimension = await _measureService.GetMeasureDimensionById(_measureSettings.BaseDimensionId);+ var baseDimensionIn = baseDimension != null ? baseDimension.Name : "";++ var orderItems = order.OrderItems;+ //a vendor should have access only to his products+ if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))+ orderItems = orderItems.Where(_workContext.HasAccessToOrderItem).ToList();++ foreach (var orderItem in orderItems)+ {+ var product = await _productService.GetProductByIdIncludeArch(orderItem.ProductId);+ //we can ship only shippable products+ if (!product.IsShipEnabled)+ continue;++ //quantities+ var qtyInThisShipment = 0;+ var maxQtyToAdd = orderItem.OpenQty;+ var qtyOrdered = orderItem.Quantity;+ var qtyInAllShipments = orderItem.ShipQty;++ //ensure that this product can be added to a shipment+ if (maxQtyToAdd <= 0)+ continue;++ var shipmentItemModel = new ShipmentModel.ShipmentItemModel {+ OrderItemId = orderItem.Id,+ ProductId = orderItem.ProductId,+ ProductName = product.Name,+ WarehouseId = orderItem.WarehouseId,+ Sku = product.FormatSku(orderItem.Attributes),+ AttributeInfo = orderItem.AttributeDescription,+ ShipSeparately = product.ShipSeparately,+ ItemWeight = orderItem.ItemWeight.HasValue ? $"{orderItem.ItemWeight:F2} [{baseWeightIn}]" : "",+ ItemDimensions =+ $"{product.Length:F2} x {product.Width:F2} x {product.Height:F2} [{baseDimensionIn}]",+ QuantityOrdered = qtyOrdered,+ QuantityInThisShipment = qtyInThisShipment,+ QuantityInAllShipments = qtyInAllShipments,+ QuantityToAdd = maxQtyToAdd+ };- foreach (var orderItem in orderItems)+ switch (product.ManageInventoryMethodId){- var product = await _productService.GetProductByIdIncludeArch(orderItem.ProductId);- //we can ship only shippable products- if (!product.IsShipEnabled)- continue;-- //quantities- var qtyInThisShipment = 0;- var maxQtyToAdd = orderItem.OpenQty;- var qtyOrdered = orderItem.Quantity;- var qtyInAllShipments = orderItem.ShipQty;-- //ensure that this product can be added to a shipment- if (maxQtyToAdd <= 0)- continue;-- var shipmentItemModel = new ShipmentModel.ShipmentItemModel {- OrderItemId = orderItem.Id,- ProductId = orderItem.ProductId,- ProductName = product.Name,- WarehouseId = orderItem.WarehouseId,- Sku = product.FormatSku(orderItem.Attributes),- AttributeInfo = orderItem.AttributeDescription,- ShipSeparately = product.ShipSeparately,- ItemWeight = orderItem.ItemWeight.HasValue ? $"{orderItem.ItemWeight:F2} [{baseWeightIn}]" : "",- ItemDimensions =- $"{product.Length:F2} x {product.Width:F2} x {product.Height:F2} [{baseDimensionIn}]",- QuantityOrdered = qtyOrdered,- QuantityInThisShipment = qtyInThisShipment,- QuantityInAllShipments = qtyInAllShipments,- QuantityToAdd = maxQtyToAdd- };-- switch (product.ManageInventoryMethodId)+ case ManageInventoryMethod.ManageStock when product.UseMultipleWarehouses:{- case ManageInventoryMethod.ManageStock when product.UseMultipleWarehouses:+ //multiple warehouses supported+ shipmentItemModel.AllowToChooseWarehouse = true;+ foreach (var pwi in product.ProductWarehouseInventory+ .OrderBy(w => w.WarehouseId).ToList()){- //multiple warehouses supported- shipmentItemModel.AllowToChooseWarehouse = true;- foreach (var pwi in product.ProductWarehouseInventory+ var warehouse = await _warehouseService.GetWarehouseById(pwi.WarehouseId);+ if (warehouse != null)+ shipmentItemModel.AvailableWarehouses.Add(+ new ShipmentModel.ShipmentItemModel.WarehouseInfo {+ WarehouseId = warehouse.Id,+ WarehouseName = warehouse.Name,+ WarehouseCode = warehouse.Code,+ StockQuantity = pwi.StockQuantity,+ ReservedQuantity = pwi.ReservedQuantity+ });+ }++ break;+ }+ case ManageInventoryMethod.ManageStock:+ {+ //multiple warehouses are not supported+ var warehouse = await _warehouseService.GetWarehouseById(product.WarehouseId);+ if (warehouse != null)+ shipmentItemModel.AvailableWarehouses.Add(new ShipmentModel.ShipmentItemModel.WarehouseInfo {+ WarehouseId = warehouse.Id,+ WarehouseName = warehouse.Name,+ WarehouseCode = warehouse.Code,+ StockQuantity = product.StockQuantity+ });++ break;+ }+ case ManageInventoryMethod.ManageStockByAttributes when product.UseMultipleWarehouses:+ {+ //multiple warehouses supported+ shipmentItemModel.AllowToChooseWarehouse = true;+ var comb = product.FindProductAttributeCombination(orderItem.Attributes);+ if (comb != null)+ foreach (var pwi in comb.WarehouseInventory.OrderBy(w => w.WarehouseId).ToList()){var warehouse = await _warehouseService.GetWarehouseById(pwi.WarehouseId);if (warehouse != null)- {shipmentItemModel.AvailableWarehouses.Add(new ShipmentModel.ShipmentItemModel.WarehouseInfo {WarehouseId = warehouse.Id,WarehouseName = warehouse.Name,- WarehouseCode = warehouse.Code,StockQuantity = pwi.StockQuantity,+ WarehouseCode = warehouse.Code,ReservedQuantity = pwi.ReservedQuantity});- }- }-- break;- }- case ManageInventoryMethod.ManageStock:- {- //multiple warehouses are not supported- var warehouse = await _warehouseService.GetWarehouseById(product.WarehouseId);- if (warehouse != null)- {- shipmentItemModel.AvailableWarehouses.Add(new ShipmentModel.ShipmentItemModel.WarehouseInfo {- WarehouseId = warehouse.Id,- WarehouseName = warehouse.Name,- WarehouseCode = warehouse.Code,- StockQuantity = product.StockQuantity- });- }-- break;- }- case ManageInventoryMethod.ManageStockByAttributes when product.UseMultipleWarehouses:- {- //multiple warehouses supported- shipmentItemModel.AllowToChooseWarehouse = true;- var comb = product.FindProductAttributeCombination(orderItem.Attributes);- if (comb != null)- {- foreach (var pwi in comb.WarehouseInventory- .OrderBy(w => w.WarehouseId).ToList())- {- var warehouse = await _warehouseService.GetWarehouseById(pwi.WarehouseId);- if (warehouse != null)- {- shipmentItemModel.AvailableWarehouses.Add(- new ShipmentModel.ShipmentItemModel.WarehouseInfo {- WarehouseId = warehouse.Id,- WarehouseName = warehouse.Name,- StockQuantity = pwi.StockQuantity,- WarehouseCode = warehouse.Code,- ReservedQuantity = pwi.ReservedQuantity- });- }- }}- break;- }- case ManageInventoryMethod.ManageStockByAttributes:- {- //multiple warehouses are not supported- var warehouse = await _warehouseService.GetWarehouseById(product.WarehouseId);- if (warehouse != null)- {- shipmentItemModel.AvailableWarehouses.Add(new ShipmentModel.ShipmentItemModel.WarehouseInfo {- WarehouseId = warehouse.Id,- WarehouseName = warehouse.Name,- WarehouseCode = warehouse.Code,- StockQuantity = product.StockQuantity- });- }-- break;- }+ break;}-- if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByBundleProducts)+ case ManageInventoryMethod.ManageStockByAttributes:{- if (!string.IsNullOrEmpty(orderItem.WarehouseId))- {- var warehouse = await _warehouseService.GetWarehouseById(product.WarehouseId);- if (warehouse != null)- {- shipmentItemModel.AvailableWarehouses.Add(new ShipmentModel.ShipmentItemModel.WarehouseInfo {- WarehouseId = warehouse.Id,- WarehouseName = warehouse.Name,- WarehouseCode = warehouse.Code,- StockQuantity = await GetStockQty(product, orderItem.WarehouseId),- ReservedQuantity = await GetReservedQty(product, orderItem.WarehouseId)- });- }- }- else- {- shipmentItemModel.AllowToChooseWarehouse = false;- if (shipmentItemModel.AllowToChooseWarehouse)- {- var warehouses = await _warehouseService.GetAllWarehouses();- foreach (var warehouse in warehouses)- {- shipmentItemModel.AvailableWarehouses.Add(- new ShipmentModel.ShipmentItemModel.WarehouseInfo {- WarehouseId = warehouse.Id,- WarehouseName = warehouse.Name,- WarehouseCode = warehouse.Code,- StockQuantity = await GetStockQty(product, warehouse.Id),- ReservedQuantity = await GetReservedQty(product, warehouse.Id)- });- }- }- }+ //multiple warehouses are not supported+ var warehouse = await _warehouseService.GetWarehouseById(product.WarehouseId);+ if (warehouse != null)+ shipmentItemModel.AvailableWarehouses.Add(new ShipmentModel.ShipmentItemModel.WarehouseInfo {+ WarehouseId = warehouse.Id,+ WarehouseName = warehouse.Name,+ WarehouseCode = warehouse.Code,+ StockQuantity = product.StockQuantity+ });++ break;}-- model.Items.Add(shipmentItemModel);}- return model;- }-- public virtual async Task<(bool valid, string message)> ValidStockShipment(Shipment shipment)- {- foreach (var item in shipment.ShipmentItems)+ if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByBundleProducts){- var product = await _productService.GetProductById(item.ProductId);- switch (product.ManageInventoryMethodId)+ if (!string.IsNullOrEmpty(orderItem.WarehouseId)){- case ManageInventoryMethod.ManageStock:- {- var stock = _stockQuantityService.GetTotalStockQuantity(product, useReservedQuantity: false,- warehouseId: item.WarehouseId);- if (stock - item.Quantity < 0)- return (false, $"Out of stock for product {product.Name}");- break;- }- case ManageInventoryMethod.ManageStockByAttributes:+ var warehouse = await _warehouseService.GetWarehouseById(product.WarehouseId);+ if (warehouse != null)+ shipmentItemModel.AvailableWarehouses.Add(new ShipmentModel.ShipmentItemModel.WarehouseInfo {+ WarehouseId = warehouse.Id,+ WarehouseName = warehouse.Name,+ WarehouseCode = warehouse.Code,+ StockQuantity = await GetStockQty(product, orderItem.WarehouseId),+ ReservedQuantity = await GetReservedQty(product, orderItem.WarehouseId)+ });+ }+ else+ {+ shipmentItemModel.AllowToChooseWarehouse = false;+ if (shipmentItemModel.AllowToChooseWarehouse){- var combination = product.FindProductAttributeCombination(item.Attributes);- if (combination == null)- return (false, $"Can't find combination for product {product.Name}");-- var stock = _stockQuantityService.GetTotalStockQuantityForCombination(product, combination,- useReservedQuantity: false, warehouseId: item.WarehouseId);- if (stock - item.Quantity < 0)- return (false, $"Out of stock for product {product.Name}");- break;+ var warehouses = await _warehouseService.GetAllWarehouses();+ foreach (var warehouse in warehouses)+ shipmentItemModel.AvailableWarehouses.Add(+ new ShipmentModel.ShipmentItemModel.WarehouseInfo {+ WarehouseId = warehouse.Id,+ WarehouseName = warehouse.Name,+ WarehouseCode = warehouse.Code,+ StockQuantity = await GetStockQty(product, warehouse.Id),+ ReservedQuantity = await GetReservedQty(product, warehouse.Id)+ });}}}- return (true, string.Empty);+ model.Items.Add(shipmentItemModel);}- public virtual async Task<(Shipment shipment, double? totalWeight)> PrepareShipment(Order order,- IEnumerable<OrderItem> orderItems, AddShipmentModel model)+ return model;+ }++ public virtual async Task<(bool valid, string message)> ValidStockShipment(Shipment shipment)+ {+ foreach (var item in shipment.ShipmentItems){- Shipment shipment = new Shipment {- OrderId = order.Id,- SeId = order.SeId,- TrackingNumber = model.TrackingNumber,- TotalWeight = null,- ShippedDateUtc = null,- DeliveryDateUtc = null,- AdminComment = model.AdminComment,- StoreId = order.StoreId,- VendorId = _workContext.CurrentVendor.Id- };- double? totalWeight = null;- foreach (var orderItem in orderItems)+ var product = await _productService.GetProductById(item.ProductId);+ switch (product.ManageInventoryMethodId){- //is shippable- if (!orderItem.IsShipEnabled)- continue;-- //ensure that this product can be shipped (have at least one item to ship)- if (orderItem.OpenQty <= 0)- continue;-- var shipmentItemModel = model.Items.FirstOrDefault(x => x.OrderItemId == orderItem.Id);- if (shipmentItemModel == null)- continue;-- var product = await _productService.GetProductById(orderItem.ProductId);- string warehouseId;- if (product != null && ((product.ManageInventoryMethodId is ManageInventoryMethod.ManageStock or ManageInventoryMethod.ManageStockByAttributes &&- product.UseMultipleWarehouses) || product.ManageInventoryMethodId ==- ManageInventoryMethod.ManageStockByBundleProducts))+ case ManageInventoryMethod.ManageStock:{- //multiple warehouses supported- //warehouse is chosen by a store owner- warehouseId = shipmentItemModel.WarehouseId;+ var stock = _stockQuantityService.GetTotalStockQuantity(product, false,+ item.WarehouseId);+ if (stock - item.Quantity < 0)+ return (false, $"Out of stock for product {product.Name}");+ break;}- else+ case ManageInventoryMethod.ManageStockByAttributes:{- //multiple warehouses are not supported- warehouseId = orderItem.WarehouseId;+ var combination = product.FindProductAttributeCombination(item.Attributes);+ if (combination == null)+ return (false, $"Can't find combination for product {product.Name}");++ var stock = _stockQuantityService.GetTotalStockQuantityForCombination(product, combination,+ false, item.WarehouseId);+ if (stock - item.Quantity < 0)+ return (false, $"Out of stock for product {product.Name}");+ break;}+ }+ }- //validate quantity- if (shipmentItemModel.QuantityToAdd <= 0)- continue;- if (shipmentItemModel.QuantityToAdd > orderItem.OpenQty)- shipmentItemModel.QuantityToAdd = orderItem.OpenQty;-- //ok. we have at least one item. create a shipment (if it does not exist)- var orderItemTotalWeight = orderItem.ItemWeight * shipmentItemModel.QuantityToAdd;- if (orderItemTotalWeight.HasValue)- {- totalWeight ??= 0;- totalWeight += orderItemTotalWeight.Value;- }+ return (true, string.Empty);+ }- //create a shipment item- var shipmentItem = new ShipmentItem {- ProductId = orderItem.ProductId,- OrderItemId = orderItem.Id,- Quantity = shipmentItemModel.QuantityToAdd,- WarehouseId = warehouseId,- Attributes = orderItem.Attributes- };- shipment.ShipmentItems.Add(shipmentItem);+ public virtual async Task<(Shipment shipment, double? totalWeight)> PrepareShipment(Order order,+ IEnumerable<OrderItem> orderItems, AddShipmentModel model)+ {+ var shipment = new Shipment {+ OrderId = order.Id,+ SeId = order.SeId,+ TrackingNumber = model.TrackingNumber,+ TotalWeight = null,+ ShippedDateUtc = null,+ DeliveryDateUtc = null,+ AdminComment = model.AdminComment,+ StoreId = order.StoreId,+ VendorId = _workContext.CurrentVendor.Id+ };+ double? totalWeight = null;+ foreach (var orderItem in orderItems)+ {+ //is shippable+ if (!orderItem.IsShipEnabled)+ continue;++ //ensure that this product can be shipped (have at least one item to ship)+ if (orderItem.OpenQty <= 0)+ continue;++ var shipmentItemModel = model.Items.FirstOrDefault(x => x.OrderItemId == orderItem.Id);+ if (shipmentItemModel == null)+ continue;++ var product = await _productService.GetProductById(orderItem.ProductId);+ string warehouseId;+ if (product != null && ((product.ManageInventoryMethodId is ManageInventoryMethod.ManageStock+ or ManageInventoryMethod.ManageStockByAttributes &&+ product.UseMultipleWarehouses) || product.ManageInventoryMethodId ==+ ManageInventoryMethod.ManageStockByBundleProducts))+ //multiple warehouses supported+ //warehouse is chosen by a store owner+ warehouseId = shipmentItemModel.WarehouseId;+ else+ //multiple warehouses are not supported+ warehouseId = orderItem.WarehouseId;++ //validate quantity+ if (shipmentItemModel.QuantityToAdd <= 0)+ continue;+ if (shipmentItemModel.QuantityToAdd > orderItem.OpenQty)+ shipmentItemModel.QuantityToAdd = orderItem.OpenQty;++ //ok. we have at least one item. create a shipment (if it does not exist)+ var orderItemTotalWeight = orderItem.ItemWeight * shipmentItemModel.QuantityToAdd;+ if (orderItemTotalWeight.HasValue)+ {+ totalWeight ??= 0;+ totalWeight += orderItemTotalWeight.Value;}- return (shipment, totalWeight);+ //create a shipment item+ var shipmentItem = new ShipmentItem {+ ProductId = orderItem.ProductId,+ OrderItemId = orderItem.Id,+ Quantity = shipmentItemModel.QuantityToAdd,+ WarehouseId = warehouseId,+ Attributes = orderItem.Attributes+ };+ shipment.ShipmentItems.Add(shipmentItem);}++ return (shipment, totalWeight);}}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Services/VendorReviewViewModelService.cs b/src/Web/Grand.Web.Vendor/Services/VendorReviewViewModelService.csindex fbd162ae4..158ef3eb5 100644--- a/src/Web/Grand.Web.Vendor/Services/VendorReviewViewModelService.cs+++ b/src/Web/Grand.Web.Vendor/Services/VendorReviewViewModelService.cs@@ -1,8 +1,7 @@-using Grand.Business.Core.Interfaces.Common.Directory;+using Grand.Business.Core.Events.Customers;+using Grand.Business.Core.Interfaces.Common.Directory;using Grand.Business.Core.Interfaces.Common.Localization;using Grand.Business.Core.Interfaces.Customers;-using Grand.Business.Core.Events.Customers;-using Grand.Domain;using Grand.Domain.Vendors;using Grand.Infrastructure;using Grand.SharedKernel.Extensions;@@ -10,121 +9,135 @@ using Grand.Web.Vendor.Interfaces;using Grand.Web.Vendor.Models.VendorReview;using MediatR;-namespace Grand.Web.Vendor.Services+namespace Grand.Web.Vendor.Services;++public class VendorReviewViewModelService : IVendorReviewViewModelService{- public class VendorReviewViewModelService : IVendorReviewViewModelService+ private readonly ICustomerService _customerService;+ private readonly IDateTimeService _dateTimeService;+ private readonly IMediator _mediator;+ private readonly ITranslationService _translationService;+ private readonly IVendorService _vendorService;+ private readonly IWorkContext _workContext;++ public VendorReviewViewModelService(+ IWorkContext workContext,+ IVendorService vendorService,+ ICustomerService customerService,+ ITranslationService translationService,+ IDateTimeService dateTimeService,+ IMediator mediator){- private readonly IWorkContext _workContext;- private readonly IVendorService _vendorService;- private readonly ICustomerService _customerService;- private readonly ITranslationService _translationService;- private readonly IDateTimeService _dateTimeService;- private readonly IMediator _mediator;-- public VendorReviewViewModelService(- IWorkContext workContext,- IVendorService vendorService,- ICustomerService customerService,- ITranslationService translationService,- IDateTimeService dateTimeService,- IMediator mediator)- {- _vendorService = vendorService;- _customerService = customerService;- _translationService = translationService;- _dateTimeService = dateTimeService;- _mediator = mediator;- _workContext = workContext;- }-- public virtual async Task PrepareVendorReviewModel(VendorReviewModel model,- VendorReview vendorReview, bool excludeProperties, bool formatReviewText)+ _vendorService = vendorService;+ _customerService = customerService;+ _translationService = translationService;+ _dateTimeService = dateTimeService;+ _mediator = mediator;+ _workContext = workContext;+ }++ public virtual async Task PrepareVendorReviewModel(VendorReviewModel model,+ VendorReview vendorReview, bool excludeProperties, bool formatReviewText)+ {+ ArgumentNullException.ThrowIfNull(model);+ ArgumentNullException.ThrowIfNull(vendorReview);++ var customer = await _customerService.GetCustomerById(vendorReview.CustomerId);++ model.Id = vendorReview.Id;+ model.CustomerId = vendorReview.CustomerId;+ model.CustomerInfo = customer != null+ ? !string.IsNullOrEmpty(customer.Email)+ ? customer.Email+ : _translationService.GetResource("Admin.Customers.Guest")+ : "";+ model.Rating = vendorReview.Rating;+ model.CreatedOn = _dateTimeService.ConvertToUserTime(vendorReview.CreatedOnUtc, DateTimeKind.Utc);+ if (!excludeProperties){- ArgumentNullException.ThrowIfNull(model);- ArgumentNullException.ThrowIfNull(vendorReview);-- var customer = await _customerService.GetCustomerById(vendorReview.CustomerId);-- model.Id = vendorReview.Id;- model.CustomerId = vendorReview.CustomerId;- model.CustomerInfo = customer != null ? !string.IsNullOrEmpty(customer.Email) ? customer.Email : _translationService.GetResource("Admin.Customers.Guest") : "";- model.Rating = vendorReview.Rating;- model.CreatedOn = _dateTimeService.ConvertToUserTime(vendorReview.CreatedOnUtc, DateTimeKind.Utc);- if (!excludeProperties)- {- model.Title = vendorReview.Title;- model.ReviewText = formatReviewText ? FormatText.ConvertText(vendorReview.ReviewText) : vendorReview.ReviewText;- model.IsApproved = vendorReview.IsApproved;- }+ model.Title = vendorReview.Title;+ model.ReviewText = formatReviewText+ ? FormatText.ConvertText(vendorReview.ReviewText)+ : vendorReview.ReviewText;+ model.IsApproved = vendorReview.IsApproved;}+ }++ public virtual async Task<(IEnumerable<VendorReviewModel> vendorReviewModels, int totalCount)>+ PrepareVendorReviewModel(VendorReviewListModel model, int pageIndex, int pageSize)+ {+ DateTime? createdOnFromValue = model.CreatedOnFrom == null+ ? null+ : _dateTimeService.ConvertToUtcTime(model.CreatedOnFrom.Value, _dateTimeService.CurrentTimeZone);++ DateTime? createdToFromValue = model.CreatedOnTo == null+ ? null+ : _dateTimeService.ConvertToUtcTime(model.CreatedOnTo.Value, _dateTimeService.CurrentTimeZone).AddDays(1);- public virtual async Task<(IEnumerable<VendorReviewModel> vendorReviewModels, int totalCount)> PrepareVendorReviewModel(VendorReviewListModel model, int pageIndex, int pageSize)+ var vendorReviews = await _vendorService.GetAllVendorReviews("", null,+ createdOnFromValue, createdToFromValue, model.SearchText, _workContext.CurrentVendor.Id, pageIndex - 1,+ pageSize);+ var items = new List<VendorReviewModel>();+ foreach (var x in vendorReviews){- DateTime? createdOnFromValue = model.CreatedOnFrom == null ? null- : _dateTimeService.ConvertToUtcTime(model.CreatedOnFrom.Value, _dateTimeService.CurrentTimeZone);-- DateTime? createdToFromValue = model.CreatedOnTo == null ? null- : _dateTimeService.ConvertToUtcTime(model.CreatedOnTo.Value, _dateTimeService.CurrentTimeZone).AddDays(1);-- IPagedList<VendorReview> vendorReviews = await _vendorService.GetAllVendorReviews("", null,- createdOnFromValue, createdToFromValue, model.SearchText, _workContext.CurrentVendor.Id , pageIndex - 1, pageSize);- var items = new List<VendorReviewModel>();- foreach (var x in vendorReviews)- {- var m = new VendorReviewModel();- await PrepareVendorReviewModel(m, x, false, true);- items.Add(m);- }- return (items, vendorReviews.TotalCount);+ var m = new VendorReviewModel();+ await PrepareVendorReviewModel(m, x, false, true);+ items.Add(m);}- public virtual async Task<VendorReview> UpdateVendorReviewModel(VendorReview vendorReview, VendorReviewModel model)++ return (items, vendorReviews.TotalCount);+ }++ public virtual async Task<VendorReview> UpdateVendorReviewModel(VendorReview vendorReview, VendorReviewModel model)+ {+ vendorReview.Title = model.Title;+ vendorReview.ReviewText = model.ReviewText;+ vendorReview.IsApproved = model.IsApproved;++ await _vendorService.UpdateVendorReview(vendorReview);++ var vendor = await _vendorService.GetVendorById(vendorReview.VendorId);+ //update vendor totals+ await _vendorService.UpdateVendorReviewTotals(vendor);+ return vendorReview;+ }++ public virtual async Task DeleteVendorReview(VendorReview vendorReview)+ {+ await _vendorService.DeleteVendorReview(vendorReview);+ var vendor = await _vendorService.GetVendorById(vendorReview.VendorId);+ //update vendor totals+ await _vendorService.UpdateVendorReviewTotals(vendor);+ }++ public virtual async Task ApproveVendorReviews(IEnumerable<string> selectedIds)+ {+ foreach (var id in selectedIds){- vendorReview.Title = model.Title;- vendorReview.ReviewText = model.ReviewText;- vendorReview.IsApproved = model.IsApproved;+ var vendorReview = await _vendorService.GetVendorReviewById(id);+ if (vendorReview == null || vendorReview.VendorId != _workContext.CurrentVendor.Id) continue;+ var previousIsApproved = vendorReview.IsApproved;+ vendorReview.IsApproved = true;await _vendorService.UpdateVendorReview(vendorReview);+ await _vendorService.UpdateVendorReviewTotals(_workContext.CurrentVendor);- var vendor = await _vendorService.GetVendorById(vendorReview.VendorId);- //update vendor totals- await _vendorService.UpdateVendorReviewTotals(vendor);- return vendorReview;+ //raise event (only if it wasn't approved before)+ if (!previousIsApproved)+ await _mediator.Publish(new VendorReviewApprovedEvent(vendorReview));}- public virtual async Task DeleteVendorReview(VendorReview vendorReview)- {- await _vendorService.DeleteVendorReview(vendorReview);- var vendor = await _vendorService.GetVendorById(vendorReview.VendorId);- //update vendor totals- await _vendorService.UpdateVendorReviewTotals(vendor);- }- public virtual async Task ApproveVendorReviews(IEnumerable<string> selectedIds)- {- foreach (var id in selectedIds)- {- var vendorReview = await _vendorService.GetVendorReviewById(id);- if (vendorReview == null || vendorReview.VendorId != _workContext.CurrentVendor.Id) continue;-- var previousIsApproved = vendorReview.IsApproved;- vendorReview.IsApproved = true;- await _vendorService.UpdateVendorReview(vendorReview);- await _vendorService.UpdateVendorReviewTotals(_workContext.CurrentVendor);-- //raise event (only if it wasn't approved before)- if (!previousIsApproved)- await _mediator.Publish(new VendorReviewApprovedEvent(vendorReview));- }- }- public virtual async Task DisapproveVendorReviews(IEnumerable<string> selectedIds)+ }++ public virtual async Task DisapproveVendorReviews(IEnumerable<string> selectedIds)+ {+ foreach (var id in selectedIds){- foreach (var id in selectedIds)- {- var vendorReview = await _vendorService.GetVendorReviewById(id);- if (vendorReview == null || vendorReview.VendorId != _workContext.CurrentVendor.Id) continue;-- vendorReview.IsApproved = false;- await _vendorService.UpdateVendorReview(vendorReview);- await _vendorService.UpdateVendorReviewTotals(_workContext.CurrentVendor);- }+ var vendorReview = await _vendorService.GetVendorReviewById(id);+ if (vendorReview == null || vendorReview.VendorId != _workContext.CurrentVendor.Id) continue;++ vendorReview.IsApproved = false;+ await _vendorService.UpdateVendorReview(vendorReview);+ await _vendorService.UpdateVendorReviewTotals(_workContext.CurrentVendor);}}-}+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Startup/StartupApplication.cs b/src/Web/Grand.Web.Vendor/Startup/StartupApplication.csindex 02d0dd836..86e255062 100644--- a/src/Web/Grand.Web.Vendor/Startup/StartupApplication.cs+++ b/src/Web/Grand.Web.Vendor/Startup/StartupApplication.cs@@ -7,26 +7,26 @@ using Microsoft.AspNetCore.Hosting;using Microsoft.Extensions.Configuration;using Microsoft.Extensions.DependencyInjection;-namespace Grand.Web.Vendor.Startup+namespace Grand.Web.Vendor.Startup;++public class StartupApplication : IStartupApplication{- public class StartupApplication : IStartupApplication+ public void ConfigureServices(IServiceCollection services, IConfiguration configuration){- public void ConfigureServices(IServiceCollection services, IConfiguration configuration)- {- if (!DataSettingsManager.DatabaseIsInstalled())- return;-- services.AddScoped<IProductViewModelService, ProductViewModelService>();- services.AddScoped<IOrderViewModelService, OrderViewModelService>();- services.AddScoped<IShipmentViewModelService, ShipmentViewModelService>();- services.AddScoped<IMerchandiseReturnViewModelService, MerchandiseReturnViewModelService>();- services.AddScoped<IVendorReviewViewModelService, VendorReviewViewModelService>();- }- public void Configure(IApplicationBuilder application, IWebHostEnvironment webHostEnvironment)- {+ if (!DataSettingsManager.DatabaseIsInstalled())+ return;- }- public int Priority => 102;- public bool BeforeConfigure => false;+ services.AddScoped<IProductViewModelService, ProductViewModelService>();+ services.AddScoped<IOrderViewModelService, OrderViewModelService>();+ services.AddScoped<IShipmentViewModelService, ShipmentViewModelService>();+ services.AddScoped<IMerchandiseReturnViewModelService, MerchandiseReturnViewModelService>();+ services.AddScoped<IVendorReviewViewModelService, VendorReviewViewModelService>();}-}++ public void Configure(IApplicationBuilder application, IWebHostEnvironment webHostEnvironment)+ {+ }++ public int Priority => 102;+ public bool BeforeConfigure => false;+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Validators/Catalog/AddProductSpecificationAttributeModelValidator.cs b/src/Web/Grand.Web.Vendor/Validators/Catalog/AddProductSpecificationAttributeModelValidator.csindex afaad7540..6f8ec992e 100644--- a/src/Web/Grand.Web.Vendor/Validators/Catalog/AddProductSpecificationAttributeModelValidator.cs+++ b/src/Web/Grand.Web.Vendor/Validators/Catalog/AddProductSpecificationAttributeModelValidator.cs@@ -1,38 +1,38 @@using FluentValidation;using Grand.Business.Core.Interfaces.Catalog.Products;using Grand.Business.Core.Interfaces.Common.Localization;+using Grand.Domain.Catalog;using Grand.Infrastructure.Validators;using Grand.Web.Vendor.Models.Catalog;-namespace Grand.Web.Vendor.Validators.Catalog+namespace Grand.Web.Vendor.Validators.Catalog;++public class AddProductSpecificationAttributeModelValidator : BaseGrandValidator<+ ProductModel.AddProductSpecificationAttributeModel>{- public class AddProductSpecificationAttributeModelValidator : BaseGrandValidator<- ProductModel.AddProductSpecificationAttributeModel>+ public AddProductSpecificationAttributeModelValidator(+ IEnumerable<IValidatorConsumer<ProductModel.AddProductSpecificationAttributeModel>> validators,+ ITranslationService translationService,+ ISpecificationAttributeService specificationAttributeService)+ : base(validators){- public AddProductSpecificationAttributeModelValidator(- IEnumerable<IValidatorConsumer<ProductModel.AddProductSpecificationAttributeModel>> validators,- ITranslationService translationService,- ISpecificationAttributeService specificationAttributeService)- : base(validators)+ RuleFor(x => x).MustAsync(async (x, _, _) =>{- RuleFor(x => x).MustAsync(async (x, _, _) =>+ if (x.AttributeTypeId == SpecificationAttributeType.Option){- if (x.AttributeTypeId == Domain.Catalog.SpecificationAttributeType.Option)- {- if (string.IsNullOrEmpty(x.SpecificationAttributeId))- return false;- if (string.IsNullOrEmpty(x.SpecificationAttributeOptionId))- return false;+ if (string.IsNullOrEmpty(x.SpecificationAttributeId))+ return false;+ if (string.IsNullOrEmpty(x.SpecificationAttributeOptionId))+ return false;- var specification =- await specificationAttributeService.GetSpecificationAttributeById(x.SpecificationAttributeId);+ var specification =+ await specificationAttributeService.GetSpecificationAttributeById(x.SpecificationAttributeId);- return specification?.SpecificationAttributeOptions.FirstOrDefault(z =>- z.Id == x.SpecificationAttributeOptionId) != null;- }+ return specification?.SpecificationAttributeOptions.FirstOrDefault(z =>+ z.Id == x.SpecificationAttributeOptionId) != null;+ }- return !string.IsNullOrEmpty(x.CustomValue);- }).WithMessage(translationService.GetResource("Vendor.Catalog.Products.SpecificationAttributes.Validate"));- }+ return !string.IsNullOrEmpty(x.CustomValue);+ }).WithMessage(translationService.GetResource("Vendor.Catalog.Products.SpecificationAttributes.Validate"));}}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Validators/Catalog/BundleProductModelValidator.cs b/src/Web/Grand.Web.Vendor/Validators/Catalog/BundleProductModelValidator.csindex 74c75e81d..6811df6aa 100644--- a/src/Web/Grand.Web.Vendor/Validators/Catalog/BundleProductModelValidator.cs+++ b/src/Web/Grand.Web.Vendor/Validators/Catalog/BundleProductModelValidator.cs@@ -5,21 +5,20 @@ using Grand.Infrastructure;using Grand.Infrastructure.Validators;using Grand.Web.Vendor.Models.Catalog;-namespace Grand.Web.Vendor.Validators.Catalog+namespace Grand.Web.Vendor.Validators.Catalog;++public class BundleProductModelValidator : BaseGrandValidator<ProductModel.BundleProductModel>{- public class BundleProductModelValidator : BaseGrandValidator<ProductModel.BundleProductModel>+ public BundleProductModelValidator(+ IEnumerable<IValidatorConsumer<ProductModel.BundleProductModel>> validators,+ ITranslationService translationService, IProductService productService, IWorkContext workContext)+ : base(validators){- public BundleProductModelValidator(- IEnumerable<IValidatorConsumer<ProductModel.BundleProductModel>> validators,- ITranslationService translationService, IProductService productService, IWorkContext workContext)- : base(validators)+ RuleFor(x => x).MustAsync(async (x, _, _) =>{- RuleFor(x => x).MustAsync(async (x, _, _) =>- {- var product = await productService.GetProductById(x.ProductBundleId);- if (product == null) return true;- return product.VendorId == workContext.CurrentVendor.Id;- }).WithMessage(translationService.GetResource("Vendor.Catalog.Products.Permissions"));- }+ var product = await productService.GetProductById(x.ProductBundleId);+ if (product == null) return true;+ return product.VendorId == workContext.CurrentVendor.Id;+ }).WithMessage(translationService.GetResource("Vendor.Catalog.Products.Permissions"));}}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Validators/Catalog/ProductAttributeValueModelValidator.cs b/src/Web/Grand.Web.Vendor/Validators/Catalog/ProductAttributeValueModelValidator.csindex 0d4569656..24f055c90 100644--- a/src/Web/Grand.Web.Vendor/Validators/Catalog/ProductAttributeValueModelValidator.cs+++ b/src/Web/Grand.Web.Vendor/Validators/Catalog/ProductAttributeValueModelValidator.cs@@ -1,50 +1,49 @@using FluentValidation;using Grand.Business.Core.Interfaces.Catalog.Products;using Grand.Business.Core.Interfaces.Common.Localization;-using Grand.Infrastructure.Validators;using Grand.Domain.Catalog;+using Grand.Infrastructure.Validators;using Grand.Web.Vendor.Models.Catalog;-namespace Grand.Web.Vendor.Validators.Catalog+namespace Grand.Web.Vendor.Validators.Catalog;++public class ProductAttributeValueModelValidator : BaseGrandValidator<ProductModel.ProductAttributeValueModel>{- public class ProductAttributeValueModelValidator : BaseGrandValidator<ProductModel.ProductAttributeValueModel>+ public ProductAttributeValueModelValidator(+ IEnumerable<IValidatorConsumer<ProductModel.ProductAttributeValueModel>> validators,+ ITranslationService translationService, IProductService productService)+ : base(validators){- public ProductAttributeValueModelValidator(- IEnumerable<IValidatorConsumer<ProductModel.ProductAttributeValueModel>> validators,- ITranslationService translationService, IProductService productService)- : base(validators)- {- RuleFor(x => x.Name)- .NotEmpty()- .WithMessage(translationService.GetResource(- "Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.Name.Required"));+ RuleFor(x => x.Name)+ .NotEmpty()+ .WithMessage(translationService.GetResource(+ "Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.Name.Required"));++ RuleFor(x => x.Quantity)+ .GreaterThanOrEqualTo(1)+ .WithMessage(translationService.GetResource(+ "Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.Quantity.GreaterThanOrEqualTo1"))+ .When(x => x.AttributeValueTypeId == AttributeValueType.AssociatedToProduct);- RuleFor(x => x.Quantity)- .GreaterThanOrEqualTo(1)- .WithMessage(translationService.GetResource(- "Vendor.Catalog.Products.ProductAttributes.Attributes.Values.Fields.Quantity.GreaterThanOrEqualTo1"))- .When(x => x.AttributeValueTypeId == AttributeValueType.AssociatedToProduct);-- RuleFor(x => x).CustomAsync(async (x, context, _) =>+ RuleFor(x => x).CustomAsync(async (x, context, _) =>+ {+ var product = await productService.GetProductById(x.ProductId);+ var productAttributeMapping =+ product.ProductAttributeMappings.FirstOrDefault(y => y.Id == x.ProductAttributeMappingId);+ switch (productAttributeMapping?.AttributeControlTypeId){- var product = await productService.GetProductById(x.ProductId);- var productAttributeMapping =- product.ProductAttributeMappings.FirstOrDefault(y => y.Id == x.ProductAttributeMappingId);- switch (productAttributeMapping?.AttributeControlTypeId)+ case AttributeControlType.ColorSquares:{- case AttributeControlType.ColorSquares:- {- //ensure valid color is chosen/entered- if (string.IsNullOrEmpty(x.ColorSquaresRgb))- context.AddFailure("Color is required");- break;- }- //ensure a picture is uploaded- case AttributeControlType.ImageSquares when string.IsNullOrEmpty(x.ImageSquaresPictureId):- context.AddFailure("Image is required");- break;+ //ensure valid color is chosen/entered+ if (string.IsNullOrEmpty(x.ColorSquaresRgb))+ context.AddFailure("Color is required");+ break;}- });- }+ //ensure a picture is uploaded+ case AttributeControlType.ImageSquares when string.IsNullOrEmpty(x.ImageSquaresPictureId):+ context.AddFailure("Image is required");+ break;+ }+ });}}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Validators/Catalog/ProductValidVendor.cs b/src/Web/Grand.Web.Vendor/Validators/Catalog/ProductValidVendor.csindex 03edcf8b6..184caf208 100644--- a/src/Web/Grand.Web.Vendor/Validators/Catalog/ProductValidVendor.cs+++ b/src/Web/Grand.Web.Vendor/Validators/Catalog/ProductValidVendor.cs@@ -7,7 +7,7 @@ using Grand.Web.Vendor.Models.Catalog;namespace Grand.Web.Vendor.Validators.Catalog;-public class ProductValidVendor: BaseGrandValidator<IProductValidVendor>+public class ProductValidVendor : BaseGrandValidator<IProductValidVendor>{public ProductValidVendor(IEnumerable<IValidatorConsumer<IProductValidVendor>> validators,@@ -23,7 +23,7 @@ public class ProductValidVendor: BaseGrandValidator<IProductValidVendor>}}-public class ProductRelatedValidVendor: BaseGrandValidator<IProductRelatedValidVendor>+public class ProductRelatedValidVendor : BaseGrandValidator<IProductRelatedValidVendor>{public ProductRelatedValidVendor(IEnumerable<IValidatorConsumer<IProductRelatedValidVendor>> validators,@@ -36,7 +36,8 @@ public class ProductRelatedValidVendor: BaseGrandValidator<IProductRelatedValidVif (product1 == null) return true;var product2 = await productService.GetProductById(x.ProductId2);if (product2 == null) return true;- return product1.VendorId == workContext.CurrentVendor.Id || product2.VendorId == workContext.CurrentVendor.Id;+ return product1.VendorId == workContext.CurrentVendor.Id ||+ product2.VendorId == workContext.CurrentVendor.Id;}).WithMessage(translationService.GetResource("Vendor.Catalog.Products.Permissions"));}}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Validators/Catalog/ProductValidator.cs b/src/Web/Grand.Web.Vendor/Validators/Catalog/ProductValidator.csindex 40db2a2b2..e37529918 100644--- a/src/Web/Grand.Web.Vendor/Validators/Catalog/ProductValidator.cs+++ b/src/Web/Grand.Web.Vendor/Validators/Catalog/ProductValidator.cs@@ -1,26 +1,28 @@using FluentValidation;+using Grand.Business.Core.Interfaces.Common.Localization;using Grand.Domain.Catalog;using Grand.Domain.Common;using Grand.Infrastructure.Validators;-using Grand.Business.Core.Interfaces.Common.Localization;using Grand.Web.Vendor.Models.Catalog;-namespace Grand.Web.Vendor.Validators.Catalog+namespace Grand.Web.Vendor.Validators.Catalog;++public class ProductValidator : BaseGrandValidator<ProductModel>{- public class ProductValidator : BaseGrandValidator<ProductModel>+ public ProductValidator(+ IEnumerable<IValidatorConsumer<ProductModel>> validators,+ ITranslationService translationService, CommonSettings commonSettings)+ : base(validators){- public ProductValidator(- IEnumerable<IValidatorConsumer<ProductModel>> validators,- ITranslationService translationService, CommonSettings commonSettings)- : base(validators)- {- RuleFor(x => x.Name).NotEmpty()- .WithMessage(translationService.GetResource("Vendor.Catalog.Products.Fields.Name.Required"));- if(!commonSettings.AllowEditProductEndedAuction)- RuleFor(x => x.AuctionEnded && x.ProductTypeId == (int)ProductType.Auction).Equal(false).WithMessage(translationService.GetResource("Admin.Catalog.Products.Cannoteditauction"));+ RuleFor(x => x.Name).NotEmpty()+ .WithMessage(translationService.GetResource("Vendor.Catalog.Products.Fields.Name.Required"));+ if (!commonSettings.AllowEditProductEndedAuction)+ RuleFor(x => x.AuctionEnded && x.ProductTypeId == (int)ProductType.Auction).Equal(false)+ .WithMessage(translationService.GetResource("Admin.Catalog.Products.Cannoteditauction"));- RuleFor(x => x.ProductTypeId == (int)ProductType.Auction && !x.AvailableEndDateTime.HasValue)- .Equal(false).WithMessage(translationService.GetResource("Vendor.Catalog.Products.Fields.AvailableEndDateTime.Required"));- }+ RuleFor(x => x.ProductTypeId == (int)ProductType.Auction && !x.AvailableEndDateTime.HasValue)+ .Equal(false)+ .WithMessage(+ translationService.GetResource("Vendor.Catalog.Products.Fields.AvailableEndDateTime.Required"));}}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Validators/Common/AddressValidator.cs b/src/Web/Grand.Web.Vendor/Validators/Common/AddressValidator.csindex 53f728d6d..cb7d20040 100644--- a/src/Web/Grand.Web.Vendor/Validators/Common/AddressValidator.cs+++ b/src/Web/Grand.Web.Vendor/Validators/Common/AddressValidator.cs@@ -1,73 +1,72 @@using FluentValidation;-using Grand.Infrastructure.Validators;using Grand.Business.Core.Interfaces.Common.Localization;+using Grand.Infrastructure.Validators;using Grand.Web.Vendor.Models.Common;-namespace Grand.Web.Vendor.Validators.Common+namespace Grand.Web.Vendor.Validators.Common;++public class AddressValidator : BaseGrandValidator<AddressModel>{- public class AddressValidator : BaseGrandValidator<AddressModel>+ public AddressValidator(+ IEnumerable<IValidatorConsumer<AddressModel>> validators,+ ITranslationService translationService)+ : base(validators){- public AddressValidator(- IEnumerable<IValidatorConsumer<AddressModel>> validators,- ITranslationService translationService)- : base(validators)- {- RuleFor(x => x.FirstName)- .NotEmpty()- .WithMessage(translationService.GetResource("Vendor.Address.Fields.FirstName.Required"))- .When(x => x.FirstNameEnabled && x.FirstNameRequired);- RuleFor(x => x.LastName)- .NotEmpty()- .WithMessage(translationService.GetResource("Vendor.Address.Fields.LastName.Required"))- .When(x => x.LastNameEnabled && x.LastNameRequired);- RuleFor(x => x.Email)- .NotEmpty()- .WithMessage(translationService.GetResource("Vendor.Address.Fields.Email.Required"))- .When(x => x.EmailEnabled && x.EmailRequired);- RuleFor(x => x.Email)- .EmailAddress()- .WithMessage(translationService.GetResource("Vendor.Common.WrongEmail"))- .When(x => x.EmailEnabled && x.EmailRequired);- RuleFor(x => x.Company)- .NotEmpty()- .WithMessage(translationService.GetResource("Vendor.Address.Fields.Company.Required"))- .When(x => x.CompanyEnabled && x.CompanyRequired);- RuleFor(x => x.VatNumber)- .NotEmpty()- .WithMessage(translationService.GetResource("Vendor.Address.Fields.VatNumber.Required"))- .When(x => x.VatNumberEnabled && x.VatNumberRequired);- RuleFor(x => x.CountryId)- .NotNull()- .WithMessage(translationService.GetResource("Vendor.Address.Fields.Country.Required"))- .When(x => x.CountryEnabled);- RuleFor(x => x.CountryId)- .NotEqual("")- .WithMessage(translationService.GetResource("Vendor.Address.Fields.Country.Required"))- .When(x => x.CountryEnabled);- RuleFor(x => x.City)- .NotEmpty()- .WithMessage(translationService.GetResource("Vendor.Address.Fields.City.Required"))- .When(x => x.CityEnabled && x.CityRequired);- RuleFor(x => x.Address1)- .NotEmpty()- .WithMessage(translationService.GetResource("Vendor.Address.Fields.Address1.Required"))- .When(x => x.StreetAddressEnabled && x.StreetAddressRequired);- RuleFor(x => x.Address2)- .NotEmpty()- .WithMessage(translationService.GetResource("Vendor.Address.Fields.Address2.Required"))- .When(x => x.StreetAddress2Enabled && x.StreetAddress2Required);- RuleFor(x => x.ZipPostalCode)- .NotEmpty()- .WithMessage(translationService.GetResource("Vendor.Address.Fields.ZipPostalCode.Required"))- .When(x => x.ZipPostalCodeEnabled && x.ZipPostalCodeRequired);- RuleFor(x => x.PhoneNumber)- .NotEmpty()- .WithMessage(translationService.GetResource("Vendor.Address.Fields.PhoneNumber.Required"))- .When(x => x.PhoneEnabled && x.PhoneRequired);- RuleFor(x => x.FaxNumber)- .NotEmpty()- .WithMessage(translationService.GetResource("Vendor.Address.Fields.FaxNumber.Required"))- .When(x => x.FaxEnabled && x.FaxRequired);- }+ RuleFor(x => x.FirstName)+ .NotEmpty()+ .WithMessage(translationService.GetResource("Vendor.Address.Fields.FirstName.Required"))+ .When(x => x.FirstNameEnabled && x.FirstNameRequired);+ RuleFor(x => x.LastName)+ .NotEmpty()+ .WithMessage(translationService.GetResource("Vendor.Address.Fields.LastName.Required"))+ .When(x => x.LastNameEnabled && x.LastNameRequired);+ RuleFor(x => x.Email)+ .NotEmpty()+ .WithMessage(translationService.GetResource("Vendor.Address.Fields.Email.Required"))+ .When(x => x.EmailEnabled && x.EmailRequired);+ RuleFor(x => x.Email)+ .EmailAddress()+ .WithMessage(translationService.GetResource("Vendor.Common.WrongEmail"))+ .When(x => x.EmailEnabled && x.EmailRequired);+ RuleFor(x => x.Company)+ .NotEmpty()+ .WithMessage(translationService.GetResource("Vendor.Address.Fields.Company.Required"))+ .When(x => x.CompanyEnabled && x.CompanyRequired);+ RuleFor(x => x.VatNumber)+ .NotEmpty()+ .WithMessage(translationService.GetResource("Vendor.Address.Fields.VatNumber.Required"))+ .When(x => x.VatNumberEnabled && x.VatNumberRequired);+ RuleFor(x => x.CountryId)+ .NotNull()+ .WithMessage(translationService.GetResource("Vendor.Address.Fields.Country.Required"))+ .When(x => x.CountryEnabled);+ RuleFor(x => x.CountryId)+ .NotEqual("")+ .WithMessage(translationService.GetResource("Vendor.Address.Fields.Country.Required"))+ .When(x => x.CountryEnabled);+ RuleFor(x => x.City)+ .NotEmpty()+ .WithMessage(translationService.GetResource("Vendor.Address.Fields.City.Required"))+ .When(x => x.CityEnabled && x.CityRequired);+ RuleFor(x => x.Address1)+ .NotEmpty()+ .WithMessage(translationService.GetResource("Vendor.Address.Fields.Address1.Required"))+ .When(x => x.StreetAddressEnabled && x.StreetAddressRequired);+ RuleFor(x => x.Address2)+ .NotEmpty()+ .WithMessage(translationService.GetResource("Vendor.Address.Fields.Address2.Required"))+ .When(x => x.StreetAddress2Enabled && x.StreetAddress2Required);+ RuleFor(x => x.ZipPostalCode)+ .NotEmpty()+ .WithMessage(translationService.GetResource("Vendor.Address.Fields.ZipPostalCode.Required"))+ .When(x => x.ZipPostalCodeEnabled && x.ZipPostalCodeRequired);+ RuleFor(x => x.PhoneNumber)+ .NotEmpty()+ .WithMessage(translationService.GetResource("Vendor.Address.Fields.PhoneNumber.Required"))+ .When(x => x.PhoneEnabled && x.PhoneRequired);+ RuleFor(x => x.FaxNumber)+ .NotEmpty()+ .WithMessage(translationService.GetResource("Vendor.Address.Fields.FaxNumber.Required"))+ .When(x => x.FaxEnabled && x.FaxRequired);}}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Validators/Common/LoginValidator.cs b/src/Web/Grand.Web.Vendor/Validators/Common/LoginValidator.csindex 6d7fe7d38..b08eafa25 100644--- a/src/Web/Grand.Web.Vendor/Validators/Common/LoginValidator.cs+++ b/src/Web/Grand.Web.Vendor/Validators/Common/LoginValidator.cs@@ -1,108 +1,108 @@using FluentValidation;using Grand.Business.Core.Events.Customers;using Grand.Business.Core.Interfaces.Common.Directory;-using Grand.Domain.Customers;-using Grand.Infrastructure.Validators;using Grand.Business.Core.Interfaces.Common.Localization;using Grand.Business.Core.Interfaces.Common.Security;using Grand.Business.Core.Interfaces.Customers;+using Grand.Domain.Customers;using Grand.Infrastructure.Models;-using Grand.Web.Vendor.Models.Common;+using Grand.Infrastructure.Validators;using Grand.Web.Common.Security.Captcha;using Grand.Web.Common.Validators;+using Grand.Web.Vendor.Models.Common;using MediatR;using Microsoft.AspNetCore.Http;using Microsoft.Extensions.DependencyInjection;-namespace Grand.Web.Vendor.Validators.Common+namespace Grand.Web.Vendor.Validators.Common;++public class LoginValidator : BaseGrandValidator<LoginModel>{- public class LoginValidator : BaseGrandValidator<LoginModel>+ public LoginValidator(+ IEnumerable<IValidatorConsumer<LoginModel>> validators,+ IEnumerable<IValidatorConsumer<ICaptchaValidModel>> validatorsCaptcha,+ ICustomerService customerService, IGroupService groupService, IEncryptionService encryptionService,+ ITranslationService translationService, CustomerSettings customerSettings, CaptchaSettings captchaSettings,+ IHttpContextAccessor contextAccessor, GoogleReCaptchaValidator googleReCaptchaValidator)+ : base(validators){- public LoginValidator(- IEnumerable<IValidatorConsumer<LoginModel>> validators,- IEnumerable<IValidatorConsumer<ICaptchaValidModel>> validatorsCaptcha,- ICustomerService customerService, IGroupService groupService, IEncryptionService encryptionService,- ITranslationService translationService, CustomerSettings customerSettings, CaptchaSettings captchaSettings,- IHttpContextAccessor contextAccessor, GoogleReCaptchaValidator googleReCaptchaValidator)- : base(validators)+ if (!customerSettings.UsernamesEnabled){- if (!customerSettings.UsernamesEnabled)- {- RuleFor(x => x.Email).NotEmpty()- .WithMessage(translationService.GetResource("Account.Login.Fields.Email.Required"));+ RuleFor(x => x.Email).NotEmpty()+ .WithMessage(translationService.GetResource("Account.Login.Fields.Email.Required"));- RuleFor(x => x.Email).EmailAddress().WithMessage(translationService.GetResource("Common.WrongEmail"));- }- else- {- RuleFor(x => x.Username).NotEmpty()- .WithMessage(translationService.GetResource("Account.Login.Fields.UserName.Required"));- }+ RuleFor(x => x.Email).EmailAddress().WithMessage(translationService.GetResource("Common.WrongEmail"));+ }+ else+ {+ RuleFor(x => x.Username).NotEmpty()+ .WithMessage(translationService.GetResource("Account.Login.Fields.UserName.Required"));+ }- RuleFor(x => x.Password).NotEmpty()- .WithMessage(translationService.GetResource("Account.Login.Fields.Password.Required"));+ RuleFor(x => x.Password).NotEmpty()+ .WithMessage(translationService.GetResource("Account.Login.Fields.Password.Required"));- RuleFor(x => x).CustomAsync(async (x, context, _) =>- {- var customer = customerSettings.UsernamesEnabled- ? await customerService.GetCustomerByUsername(x.Username)- : await customerService.GetCustomerByEmail(x.Email);+ RuleFor(x => x).CustomAsync(async (x, context, _) =>+ {+ var customer = customerSettings.UsernamesEnabled+ ? await customerService.GetCustomerByUsername(x.Username)+ : await customerService.GetCustomerByEmail(x.Email);- switch (customer)+ switch (customer)+ {+ case null:+ context.AddFailure(+ translationService.GetResource("Account.Login.WrongCredentials.CustomerNotExist"));+ break;+ case { Deleted: true }:+ context.AddFailure(translationService.GetResource("Account.Login.WrongCredentials.Deleted"));+ break;+ case { Active: false }:+ context.AddFailure(translationService.GetResource("Account.Login.WrongCredentials.NotActive"));+ break;+ case not null when !await groupService.IsRegistered(customer):+ context.AddFailure(+ translationService.GetResource("Account.Login.WrongCredentials.NotRegistered"));+ break;+ case not null when !await groupService.IsVendor(customer):+ context.AddFailure(+ translationService.GetResource("Account.Login.WrongPortal.Vendor"));+ break;+ case { CannotLoginUntilDateUtc: not null }+ when customer.CannotLoginUntilDateUtc.Value > DateTime.UtcNow:+ context.AddFailure(translationService.GetResource("Account.Login.WrongCredentials.LockedOut"));+ break;+ case not null:{- case null:- context.AddFailure(- translationService.GetResource("Account.Login.WrongCredentials.CustomerNotExist"));- break;- case { Deleted: true }:- context.AddFailure(translationService.GetResource("Account.Login.WrongCredentials.Deleted"));- break;- case { Active: false }:- context.AddFailure(translationService.GetResource("Account.Login.WrongCredentials.NotActive"));- break;- case not null when !await groupService.IsRegistered(customer):- context.AddFailure(- translationService.GetResource("Account.Login.WrongCredentials.NotRegistered"));- break;- case not null when !await groupService.IsVendor(customer):- context.AddFailure(- translationService.GetResource("Account.Login.WrongPortal.Vendor"));- break;- case { CannotLoginUntilDateUtc: not null } when customer.CannotLoginUntilDateUtc.Value > DateTime.UtcNow:- context.AddFailure(translationService.GetResource("Account.Login.WrongCredentials.LockedOut"));- break;- case not null:+ var pwd = customer.PasswordFormatId switch {+ PasswordFormat.Clear => x.Password,+ PasswordFormat.Encrypted =>+ encryptionService.EncryptText(x.Password, customer.PasswordSalt),+ PasswordFormat.Hashed => encryptionService.CreatePasswordHash(x.Password,+ customer.PasswordSalt,+ customerSettings.HashedPasswordFormat),+ _ => throw new Exception("PasswordFormat not supported")+ };+ var isValid = pwd == customer.Password;+ if (!isValid){- var pwd = customer.PasswordFormatId switch {- PasswordFormat.Clear => x.Password,- PasswordFormat.Encrypted =>- encryptionService.EncryptText(x.Password, customer.PasswordSalt),- PasswordFormat.Hashed => encryptionService.CreatePasswordHash(x.Password,- customer.PasswordSalt,- customerSettings.HashedPasswordFormat),- _ => throw new Exception("PasswordFormat not supported")- };- var isValid = pwd == customer.Password;- if (!isValid)- {- context.AddFailure(translationService.GetResource("Account.Login.WrongCredentials"));- await contextAccessor.HttpContext!.RequestServices.GetRequiredService<IMediator>()- .Publish(new CustomerLoginFailedEvent(customer), _);- }-- break;+ context.AddFailure(translationService.GetResource("Account.Login.WrongCredentials"));+ await contextAccessor.HttpContext!.RequestServices.GetRequiredService<IMediator>()+ .Publish(new CustomerLoginFailedEvent(customer), _);}- }- });- if (captchaSettings.Enabled && captchaSettings.ShowOnLoginPage)- {- RuleFor(x => x.Captcha).NotNull()- .WithMessage(translationService.GetResource("Account.Captcha.Required"));-- RuleFor(x => x.Captcha)- .SetValidator(new CaptchaValidator(validatorsCaptcha, contextAccessor, googleReCaptchaValidator));+ break;+ }}+ });++ if (captchaSettings.Enabled && captchaSettings.ShowOnLoginPage)+ {+ RuleFor(x => x.Captcha).NotNull()+ .WithMessage(translationService.GetResource("Account.Captcha.Required"));++ RuleFor(x => x.Captcha)+ .SetValidator(new CaptchaValidator(validatorsCaptcha, contextAccessor, googleReCaptchaValidator));}}}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Validators/Vendor/VendorValidator.cs b/src/Web/Grand.Web.Vendor/Validators/Vendor/VendorValidator.csindex 127fcd302..589f35532 100644--- a/src/Web/Grand.Web.Vendor/Validators/Vendor/VendorValidator.cs+++ b/src/Web/Grand.Web.Vendor/Validators/Vendor/VendorValidator.cs@@ -1,24 +1,23 @@using FluentValidation;-using Grand.Infrastructure.Validators;using Grand.Business.Core.Interfaces.Common.Localization;+using Grand.Infrastructure.Validators;+using Grand.Web.Vendor.Models.Common;using Grand.Web.Vendor.Models.Vendor;using Grand.Web.Vendor.Validators.Common;-namespace Grand.Web.Vendor.Validators.Vendor+namespace Grand.Web.Vendor.Validators.Vendor;++public class VendorValidator : BaseGrandValidator<VendorModel>{- public class VendorValidator : BaseGrandValidator<VendorModel>+ public VendorValidator(+ IEnumerable<IValidatorConsumer<VendorModel>> validators,+ IEnumerable<IValidatorConsumer<AddressModel>> addressValidators,+ ITranslationService translationService)+ : base(validators){- public VendorValidator(- IEnumerable<IValidatorConsumer<VendorModel>> validators,- IEnumerable<IValidatorConsumer<Models.Common.AddressModel>> addressValidators,- ITranslationService translationService)- : base(validators)- {- RuleFor(x => x.Name).NotEmpty().WithMessage(translationService.GetResource("Vendor.Fields.Name.Required"));- RuleFor(x => x.Email).NotEmpty().WithMessage(translationService.GetResource("Vendor.Fields.Email.Required"));- RuleFor(x => x.Email).EmailAddress().WithMessage(translationService.GetResource("Vendor.Common.WrongEmail"));- RuleFor(x => x.Address).SetValidator(new AddressValidator(addressValidators, translationService));-- }+ RuleFor(x => x.Name).NotEmpty().WithMessage(translationService.GetResource("Vendor.Fields.Name.Required"));+ RuleFor(x => x.Email).NotEmpty().WithMessage(translationService.GetResource("Vendor.Fields.Email.Required"));+ RuleFor(x => x.Email).EmailAddress().WithMessage(translationService.GetResource("Vendor.Common.WrongEmail"));+ RuleFor(x => x.Address).SetValidator(new AddressValidator(addressValidators, translationService));}}\ No newline at end of file