Skip to content

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.

Grand.Web.Admin - remove all dependencies to vendor

support12e821055186
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Home/Index.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Home/Index.cshtml
index 6e3d99112..5744d3ce1 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Home/Index.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Home/Index.cshtml
@@ -1,5 +1,4 @@
@using Grand.Business.Core.Interfaces.Common.Directory
-@model DashboardModel
@inject Grand.Domain.Customers.CustomerSettings customerSettings
@inject Grand.Business.Core.Interfaces.Common.Security.IPermissionService permissionService
@@ -22,7 +21,7 @@
}
<vc:admin-widget widget-zone="admin_dashboard_top" additional-data="null"/>
-@if (!Model.IsLoggedInAsVendor && canManageOrders)
+@if (canManageOrders)
{
<div class="form-row top_tiles">
<div class="animated flipInY col-lg-4 col-md-4 col-sm-6 col-12">
@@ -143,33 +142,7 @@
}
</div>
</div>
-}
-@if (Model.IsLoggedInAsVendor)
-{
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel">
- <div class="x_title">
- <h2>@Loc["Admin.Dashboard.Summary"]</h2>
- <div class="filter">
- <div class="page-bar" style="height:43px;">
- <div class="page-toolbar">
- <div id="dashboard-report-range" class="pull-right btn btn-fit-height green" data-original-title="Change dashboard date range">
- <i class="icon-calendar"></i>&nbsp;
- <span class="thin uppercase d-none d-sm-inline"></span>&nbsp;
- <i class="fa fa-angle-down"></i>
- </div>
- </div>
- </div>
- </div>
- <div class="clearfix"></div>
- </div>
- </div>
- </div>
- </div>
-}
-@if (canManageOrders)
-{
+
<div class="row">
<div class="col-md-12">
<div class="x_panel light bordered">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Home/Statistics.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Home/Statistics.cshtml
index ee4316fb7..2427586d2 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Home/Statistics.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Home/Statistics.cshtml
@@ -1,5 +1,4 @@
-@model DashboardModel
-@inject Grand.Business.Core.Interfaces.Common.Security.IPermissionService permissionService
+@inject Grand.Business.Core.Interfaces.Common.Security.IPermissionService permissionService
@{
//page title
@@ -28,7 +27,7 @@
<div class="content">
<div class="row">
<div class="col-md-12">
- @if (!Model.IsLoggedInAsVendor && canManageOrders)
+ @if (canManageOrders)
{
<div class="row">
<div class="col-md-12">
@@ -45,10 +44,9 @@
</div>
</div>
}
- @if (!Model.IsLoggedInAsVendor)
+
+ @if (canManageOrders || canManageCustomers || canManageProducts)
{
- if (canManageOrders || canManageCustomers || canManageProducts)
- {
<div class="row">
@if (canManageOrders)
{
@@ -115,9 +113,8 @@
}
</div>
- }
}
-
+
@if (canManageOrders)
{
<div class="row">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Edit.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Edit.cshtml
index 3d6f34839..1272b21d5 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Edit.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Edit.cshtml
@@ -8,7 +8,7 @@
var canManageMessageQueue = await permissionService.Authorize(Grand.Business.Core.Utilities.Common.Security.StandardPermission.ManageMessageQueue);
}
<form asp-area="@Constants.AreaAdmin" 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">
@@ -17,22 +17,23 @@
<div class="caption">
<i class="icon-basket"></i>
@Loc["Admin.Orders.EditOrderDetails"] - @Model.OrderNumber
- <small><i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["Admin.Orders.BackToList"], "List")</small>
+ <small>
+ <i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["Admin.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.AreaAdmin })" class="btn purple">
<i class="fa fa-file-pdf-o"></i> @Loc["Admin.Orders.PdfInvoice"]
</a>
- @if (!Model.IsLoggedInAsVendor)
- {
- <span id="order-delete" class="btn red"><i class="fa fa-trash-o"></i> @Loc["Admin.Common.Delete"]</span>
- <a asp-action="CancelOrder" asp-route-id="@Model.Id" class="btn border-red" onclick="return confirm('@Loc["Admin.Common.AreYouSure"]');">
- <i class="red fa fa-times-circle-o"></i>
- @Loc["Admin.Common.Cancel"]
- </a>
- }
- <input type="submit" id="btnRefreshPage" style="display: none" />
+ <span id="order-delete" class="btn red">
+ <i class="fa fa-trash-o"></i> @Loc["Admin.Common.Delete"]
+ </span>
+ <a asp-action="CancelOrder" asp-route-id="@Model.Id" class="btn border-red" onclick="return confirm('@Loc["Admin.Common.AreYouSure"]');">
+ <i class="red fa fa-times-circle-o"></i>
+ @Loc["Admin.Common.Cancel"]
+ </a>
+ <input type="submit" id="btnRefreshPage" style="display: none"/>
<script>
$(document).ready(function () {
$('#btnRefreshPage').click(function () {
@@ -41,7 +42,7 @@
});
});
</script>
- <vc:admin-widget widget-zone="order_details_buttons" additional-data="Model" />
+ <vc:admin-widget widget-zone="order_details_buttons" additional-data="Model"/>
</div>
</div>
</div>
@@ -51,7 +52,7 @@
<tabstrip-item text="@Loc["Admin.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>
@@ -59,7 +60,7 @@
<tabstrip-item text="@Loc["Admin.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>
@@ -68,7 +69,7 @@
<tabstrip-item text="@Loc["Admin.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>
@@ -76,26 +77,23 @@
<tabstrip-item text="@Loc["Admin.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>
+ <tabstrip-item text="@Loc["Admin.Orders.OrderNotes"]" tab-index="4">
+ <content>
+ <div>
+ <partial name="Partials/OrderDetails.Notes" model="Model"/>
</div>
</content>
</tabstrip-item>
- @if (!Model.IsLoggedInAsVendor)
- {
- <tabstrip-item text="@Loc["Admin.Orders.OrderNotes"]" tab-index="4">
- <content>
- <div>
- <partial name="Partials/OrderDetails.Notes" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- }
@if (canManageDocuments)
{
<tabstrip-item text="@Loc["Admin.Orders.Documents"]" tab-index="5">
<content>
<div>
- <partial name="Partials/OrderDetails.Documents" model="Model" />
+ <partial name="Partials/OrderDetails.Documents" model="Model"/>
</div>
</content>
</tabstrip-item>
@@ -104,10 +102,10 @@
<content>
<div>
<div class="form-actions">
- <input type="submit" value="@Loc["Admin.Common.Save"]" id="btnSaveUserFields" name="save-generic-attributes" asp-action="EditUserFields" class="k-button" />
+ <input type="submit" value="@Loc["Admin.Common.Save"]" id="btnSaveUserFields" name="save-generic-attributes" asp-action="EditUserFields" class="k-button"/>
</div>
<div class="form-horizontal">
- <partial name="Partials/UserFields" model="Model" />
+ <partial name="Partials/UserFields" model="Model"/>
</div>
</div>
</content>
@@ -117,12 +115,12 @@
<tabstrip-item text="@Loc["Admin.Orders.Notifications"]" tab-index="7">
<content>
<div>
- <partial name="Partials/OrderDetails.Notifications" model="Model" />
+ <partial name="Partials/OrderDetails.Notifications" model="Model"/>
</div>
</content>
</tabstrip-item>
}
- <vc:admin-widget widget-zone="order_details_tabs" additional-data="Model" />
+ <vc:admin-widget widget-zone="order_details_tabs" additional-data="Model"/>
</items>
</admin-tabstrip>
</div>
@@ -130,4 +128,4 @@
</div>
</div>
</form>
-<admin-delete-confirmation button-id="order-delete" />
+<admin-delete-confirmation button-id="order-delete"/>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/List.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/List.cshtml
index 1623635d8..840cfbecb 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/List.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/List.cshtml
@@ -5,121 +5,120 @@
ViewBag.Title = Loc["Admin.Orders"];
}
<form asp-area="@Constants.AreaAdmin" 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">
- <div class="x_title">
- <div class="caption">
- <i class="icon-basket"></i>
- @Loc["Admin.Orders"]
- </div>
- <div class="actions btn-group btn-group-devided util-btn-margin-bottom-5">
- @if (!Model.IsLoggedInAsVendor)
- {
- <div class="btn-group btn-group-devided">
- <a class="btn default" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
- <i class="fa fa-download"></i>
- @Loc["Admin.Common.Export"]
- <i class="fa fa-angle-down"></i>
- </a>
- <ul class="dropdown-menu pull-right">
- <li>
- <input type="submit" name="exportexcel-all" asp-action="ExportExcelAll" class="btn default" style="width: 100%;" value="@Loc["Admin.Common.ExportToExcel.All"]" />
- </li>
- <li>
- <input type="button" id="exportexcel-selected" class="btn default" style="width: 100%;" value="@Loc["Admin.Common.ExportToExcel.Selected"]" />
- </li>
- </ul>
- <vc:admin-widget widget-zone="order_list_buttons" additional-data="null" />
- </div>
- }
- <button type="submit" name="pdf-invoice-all" asp-action="PdfInvoiceAll" class="btn green">
- <i class="fa fa-file-pdf-o"></i>
- @Loc["Admin.Orders.PdfInvoice.All"]
- </button>
- <button type="button" id="pdf-invoice-selected" class="btn green">
- <i class="fa fa-file-pdf-o"></i>
- @Loc["Admin.Orders.PdfInvoice.Selected"]
- </button>
- <button type="button" name="delete-selected" id="delete-selected" class="btn red">
- <i class="fa fa-trash-o"></i>
- @Loc["Admin.Common.Delete.Selected"]
- </button>
+
+<div class="row">
+ <div class="col-md-12">
+ <div class="x_panel light form-fit popup-window">
+ <div class="x_title">
+ <div class="caption">
+ <i class="icon-basket"></i>
+ @Loc["Admin.Orders"]
+ </div>
+ <div class="actions btn-group btn-group-devided util-btn-margin-bottom-5">
+
+ <div class="btn-group btn-group-devided">
+ <a class="btn default" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
+ <i class="fa fa-download"></i>
+ @Loc["Admin.Common.Export"]
+ <i class="fa fa-angle-down"></i>
+ </a>
+ <ul class="dropdown-menu pull-right">
+ <li>
+ <input type="submit" name="exportexcel-all" asp-action="ExportExcelAll" class="btn default" style="width: 100%;" value="@Loc["Admin.Common.ExportToExcel.All"]"/>
+ </li>
+ <li>
+ <input type="button" id="exportexcel-selected" class="btn default" style="width: 100%;" value="@Loc["Admin.Common.ExportToExcel.Selected"]"/>
+ </li>
+ </ul>
+ <vc:admin-widget widget-zone="order_list_buttons" additional-data="null"/>
</div>
+ <button type="submit" name="pdf-invoice-all" asp-action="PdfInvoiceAll" class="btn green">
+ <i class="fa fa-file-pdf-o"></i>
+ @Loc["Admin.Orders.PdfInvoice.All"]
+ </button>
+ <button type="button" id="pdf-invoice-selected" class="btn green">
+ <i class="fa fa-file-pdf-o"></i>
+ @Loc["Admin.Orders.PdfInvoice.Selected"]
+ </button>
+ <button type="button" name="delete-selected" id="delete-selected" class="btn red">
+ <i class="fa fa-trash-o"></i>
+ @Loc["Admin.Common.Delete.Selected"]
+ </button>
</div>
- <div class="x_content form">
- <div class="form-horizontal">
- <div class="main-header col-12 px-0">
- <div class="row align-items-end">
- <div class="col-md-8 col-ms-12 col-12">
- <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" />
- </div>
+
+ </div>
+ <div class="x_content form">
+ <div class="form-horizontal">
+ <div class="main-header col-12 px-0">
+ <div class="row align-items-end">
+ <div class="col-md-8 col-ms-12 col-12">
+ <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"/>
</div>
- <div class="col-md-6 col-sm-12 col-12">
- <admin-label asp-for="GoDirectlyToNumber" class="control-label" />
- <div class="input-group mb-0">
- <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["Admin.Common.Go"]" />
- </div>
+ </div>
+ <div class="col-md-6 col-sm-12 col-12">
+ <admin-label asp-for="GoDirectlyToNumber" class="control-label"/>
+ <div class="input-group mb-0">
+ <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["Admin.Common.Go"]"/>
</div>
</div>
</div>
</div>
- <div class="col-md-4 col-sm-12 col-12">
- <div class="form-actions">
- <div class="btn-group">
- <button class="btn btn-success filter-submit" id="search-orders">
- <i class="fa fa-search"></i> @Loc["Admin.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>&nbsp; @Loc["Admin.Common.Filters"]
- </button>
- </div>
+ </div>
+ <div class="col-md-4 col-sm-12 col-12">
+ <div class="form-actions">
+ <div class="btn-group">
+ <button class="btn btn-success filter-submit" id="search-orders">
+ <i class="fa fa-search"></i> @Loc["Admin.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>&nbsp; @Loc["Admin.Common.Filters"]
+ </button>
</div>
</div>
</div>
</div>
- <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" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="StartDate" />
- </div>
+ </div>
+ <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"/>
+ <div class="col-md-9 col-sm-9">
+ <admin-input asp-for="StartDate"/>
</div>
- <div class="form-group">
- <admin-label asp-for="EndDate" class="col-sm-3 control-label" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="EndDate" />
- </div>
+ </div>
+ <div class="form-group">
+ <admin-label asp-for="EndDate" class="col-sm-3 control-label"/>
+ <div class="col-md-9 col-sm-9">
+ <admin-input asp-for="EndDate"/>
</div>
- <div class="form-group">
- <admin-label asp-for="OrderGuid" class="col-sm-3 control-label" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="OrderGuid" />
- </div>
+ </div>
+ <div class="form-group">
+ <admin-label asp-for="OrderGuid" class="col-sm-3 control-label"/>
+ <div class="col-md-9 col-sm-9">
+ <admin-input asp-for="OrderGuid"/>
</div>
- <div class="form-group">
- <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" />
- </div>
+ </div>
+ <div class="form-group">
+ <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"/>
</div>
- <div class="form-group">
- <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" />
- <span id="search-product-friendly-name"></span>
- <input type="button" id="search-product-clear" class="k-button" style="display:none;" value="@Loc["Admin.Common.Clear"]" />
- @Html.TextBoxFor(model => model.ProductId, new { autocomplete = "off", style = "display:none;" })
- <script>
+ </div>
+ <div class="form-group">
+ <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"/>
+ <span id="search-product-friendly-name"></span>
+ <input type="button" id="search-product-clear" class="k-button" style="display:none;" value="@Loc["Admin.Common.Clear"]"/>
+ @Html.TextBoxFor(model => model.ProductId, new { autocomplete = "off", style = "display:none;" })
+ <script>
$(document).ready(function() {
$('#search-product-name').autocomplete({
delay: 500,
@@ -143,74 +142,74 @@
});
});
</script>
- </div>
</div>
- <div class="form-group">
- <admin-label asp-for="BillingLastName" class="col-sm-3 control-label" />
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="BillingLastName" />
- </div>
+ </div>
+ <div class="form-group">
+ <admin-label asp-for="BillingLastName" class="col-sm-3 control-label"/>
+ <div class="col-md-9 col-sm-9">
+ <admin-input asp-for="BillingLastName"/>
</div>
- <div class="form-group" @(Model.IsLoggedInAsVendor ? Html.Raw("style='display: none;'") : null)>
- <admin-label asp-for="OrderStatusId" class="col-sm-3 control-label" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="OrderStatusId" asp-items="Model.AvailableOrderStatuses" />
- </div>
+ </div>
+ <div class="form-group">
+ <admin-label asp-for="OrderStatusId" class="col-sm-3 control-label"/>
+ <div class="col-md-9 col-sm-9">
+ <admin-select asp-for="OrderStatusId" asp-items="Model.AvailableOrderStatuses"/>
</div>
- <div class="form-group" @(Model.IsLoggedInAsVendor ? Html.Raw("style='display: none;'") : null)>
- <admin-label asp-for="VendorId" class="col-sm-3 control-label" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="VendorId" asp-items="Model.AvailableVendors" />
- </div>
+ </div>
+ <div class="form-group">
+ <admin-label asp-for="VendorId" class="col-sm-3 control-label"/>
+ <div class="col-md-9 col-sm-9">
+ <admin-select asp-for="VendorId" asp-items="Model.AvailableVendors"/>
</div>
- <div class="form-group" @(Model.IsLoggedInAsVendor ? Html.Raw("style='display: none;'") : null)>
- <admin-label asp-for="ShippingStatusId" class="col-sm-3 control-label" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="ShippingStatusId" asp-items="Model.AvailableShippingStatuses" />
- </div>
+ </div>
+ <div class="form-group">
+ <admin-label asp-for="ShippingStatusId" class="col-sm-3 control-label"/>
+ <div class="col-md-9 col-sm-9">
+ <admin-select asp-for="ShippingStatusId" asp-items="Model.AvailableShippingStatuses"/>
</div>
- <div class="form-group">
- <admin-label asp-for="StoreId" class="col-sm-3 control-label" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="StoreId" asp-items="Model.AvailableStores" />
- </div>
+ </div>
+ <div class="form-group">
+ <admin-label asp-for="StoreId" class="col-sm-3 control-label"/>
+ <div class="col-md-9 col-sm-9">
+ <admin-select asp-for="StoreId" asp-items="Model.AvailableStores"/>
</div>
- <div class="form-group">
- <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" />
- </div>
+ </div>
+ <div class="form-group">
+ <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"/>
</div>
- <div class="form-group">
- <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" />
- </div>
+ </div>
+ <div class="form-group">
+ <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"/>
</div>
- <div class="form-group" @(Model.IsLoggedInAsVendor ? Html.Raw("style='display: none;'") : null)>
- <admin-label asp-for="PaymentMethodSystemName" class="col-sm-3 control-label" />
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="PaymentMethodSystemName" asp-items="Model.AvailablePaymentMethods" />
- </div>
+ </div>
+ <div class="form-group">
+ <admin-label asp-for="PaymentMethodSystemName" class="col-sm-3 control-label"/>
+ <div class="col-md-9 col-sm-9">
+ <admin-select asp-for="PaymentMethodSystemName" asp-items="Model.AvailablePaymentMethods"/>
</div>
- <div class="form-group">
- <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" />
- </div>
+ </div>
+ <div class="form-group">
+ <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"/>
</div>
</div>
</div>
- <div class="x_content">
- <div id="orders-grid"></div>
- </div>
+ </div>
+ <div class="x_content">
+ <div id="orders-grid"></div>
</div>
</div>
</div>
</div>
</div>
+</div>
- <script>
+<script>
$(document).ready(function () {
$('.extend-collapse').hide();
@@ -285,10 +284,7 @@
width: 50,
template: '<a class="k-link" href="Edit/#=Id#">#=OrderNumber#</a>'
},
- @if (!Model.IsLoggedInAsVendor)
{
- //a vendor does not have access to this functionality
- <text>{
field: "OrderStatus",
title: "@Loc["Admin.Orders.Fields.OrderStatus"]",
width: 120,
@@ -300,37 +296,27 @@
'# if(OrderStatusId == 40) {#danger #} #' +
'# if(OrderStatusId > 40) {#primary #} #' +
'">#=OrderStatus#</span></a></h4>'
- },</text>
- }
+ },
{
field: "PaymentStatus",
title: "@Loc["Admin.Orders.Fields.PaymentStatus"]",
width: 120,
template: '<a class="k-link" href="Edit/#=Id#">#=PaymentStatus#</a>'
},
- @if (!Model.IsLoggedInAsVendor)
{
- //a vendor does not have access to this functionality
- <text>{
field: "ShippingStatus",
title: "@Loc["Admin.Orders.Fields.ShippingStatus"]",
width: 120,
- template: '<a class="k-link" href="Edit/#=Id#">#=ShippingStatus#</a>'
- },</text>
- }
+ template: '<a class="k-link" href="Edit/#=Id#">#=ShippingStatus#</a>'
+ },
{
field: "CustomerEmail",
title: "@Loc["Admin.Orders.Fields.Customer"]",
width: 220,
- @if (!Model.IsLoggedInAsVendor)
- {
- <text>
- template: function(dataItem) {
+ template: function(dataItem) {
return "<a class=\"k-link\" href='@Url.Action("Edit", "Customer", new { area = Constants.AreaAdmin })/" + dataItem.CustomerId + "'>" + kendo.htmlEncode(dataItem.CustomerFullName) + " (" + dataItem.CustomerEmail + ")</a>";
- }
- </text>
}
- },
+ },
@if (!adminAreaSettings.HideStoreColumn)
{
<text>
@@ -350,24 +336,20 @@
format: "{0:G}",
},
- @if (!Model.IsLoggedInAsVendor)
{
- //a vendor does not have access to this functionality
- <text>{
field: "OrderTotal",
title: "@Loc["Admin.Orders.Fields.OrderTotal"]",
width: 150,
template: '#=OrderTotal#',
headerAttributes: { style: "text-align:right" },
- attributes: { style: "text-align:right" },
- },</text>
+ attributes: { style: "text-align:right" },
}
]
} );
});
</script>
- <script>
+<script>
var selectedIds = [];
@@ -542,8 +524,8 @@
</script>
<form asp-area="@Constants.AreaAdmin" asp-controller="Order" asp-action="ExportExcelSelected" method="post" id="export-excel-selected-form">
-
- <input type="hidden" id="selectedIds" name="selectedIds" value="" />
+
+ <input type="hidden" id="selectedIds" name="selectedIds" value=""/>
</form>
<script>
@@ -558,9 +540,9 @@
});
</script>
-<form asp-area="@Constants.AreaAdmin" asp-controller="Order" asp-action="PdfInvoiceSelected" method="post" id="pdf-invoice-selected-form">
-
- <input type="hidden" id="selectedIds" name="selectedIds" value="" />
+<form asp-area="@Constants.AreaAdmin" asp-controller="Order" asp-action="PdfInvoiceSelected" method="post" id="pdf-invoice-selected-form">
+
+ <input type="hidden" id="selectedIds" name="selectedIds" value=""/>
</form>
<script>
@@ -575,4 +557,4 @@
});
});
-</script>
+</script>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Addresses.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Addresses.cshtml
index c306e1732..eb2568e2e 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Addresses.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Addresses.cshtml
@@ -1,5 +1,5 @@
@model OrderModel
-<vc:admin-widget widget-zone="order_details_address_top" additional-data="Model" />
+<vc:admin-widget widget-zone="order_details_address_top" additional-data="Model"/>
<div class="card col-md-6">
<div class="card-body">
<h4 class="card-title">@Loc["Admin.Orders.BillingInfo"]</h4>
@@ -145,14 +145,13 @@
</td>
</tr>
}
- @if (!Model.IsLoggedInAsVendor)
- {
- <tr>
- <td colspan="2">
- <a href="@Url.Action("AddressEdit", new { addressId = Model.BillingAddress.Id, orderId = Model.Id, BillingAddress = true, area = Constants.AreaAdmin })" class="k-button"><span class="k-icon k-i-edit"></span>&nbsp;@Loc["Admin.Common.Edit"]</a>
- </td>
- </tr>
- }
+
+ <tr>
+ <td colspan="2">
+ <a href="@Url.Action("AddressEdit", new { addressId = Model.BillingAddress.Id, orderId = Model.Id, BillingAddress = true, area = Constants.AreaAdmin })" class="k-button"><span class="k-icon k-i-edit"></span>&nbsp;@Loc["Admin.Common.Edit"]</a>
+ </td>
+ </tr>
+
</table>
</p>
</div>
@@ -161,225 +160,221 @@
@if (Model.IsShippable)
{
<div class="card col-md-6">
- <div class="card-body">
- <h4 class="card-title">@Loc["Admin.Orders.ShippingInfo"]</h4>
- <p class="card-text">
+ <div class="card-body">
+ <h4 class="card-title">@Loc["Admin.Orders.ShippingInfo"]</h4>
+ <p class="card-text">
- @if (Model.ShippingAddress != null)
- {
+ @if (Model.ShippingAddress != null)
+ {
+ <table class="table table-bordered table-striped table-hover">
+ @if (Model.ShippingAddress.FirstNameEnabled || Model.ShippingAddress.LastNameEnabled)
+ {
+ <tr>
+ <td>
+ @Loc["Admin.Orders.Address.FullName"]:
+ </td>
+ <td>
+ @Model.ShippingAddress.FirstName @Model.ShippingAddress.LastName
+ </td>
+ </tr>
+ }
+ @if (Model.ShippingAddress.EmailEnabled)
+ {
+ <tr>
+ <td>
+ @Loc["Admin.Orders.Address.Email"]:
+ </td>
+ <td>
+ @Model.ShippingAddress.Email
+ </td>
+ </tr>
+ }
+ @if (Model.ShippingAddress.PhoneEnabled)
+ {
+ <tr>
+ <td>
+ @Loc["Admin.Orders.Address.Phone"]:
+ </td>
+ <td>
+ @Model.ShippingAddress.PhoneNumber
+ </td>
+ </tr>
+ }
+ @if (Model.ShippingAddress.FaxEnabled)
+ {
+ <tr>
+ <td>
+ @Loc["Admin.Orders.Address.Fax"]:
+ </td>
+ <td>
+ @Model.ShippingAddress.FaxNumber
+ </td>
+ </tr>
+ }
+ @if (Model.ShippingAddress.CompanyEnabled)
+ {
+ <tr>
+ <td>
+ @Loc["Admin.Orders.Address.Company"]:
+ </td>
+ <td>
+ @Model.ShippingAddress.Company
+ </td>
+ </tr>
+ }
+ @if (Model.ShippingAddress.StreetAddressEnabled)
+ {
+ <tr>
+ <td>
+ @Loc["Admin.Orders.Address.Address1"]:
+ </td>
+ <td>
+ @Model.ShippingAddress.Address1
+ </td>
+ </tr>
+ }
+ @if (Model.ShippingAddress.StreetAddress2Enabled)
+ {
+ <tr>
+ <td>
+ @Loc["Admin.Orders.Address.Address2"]:
+ </td>
+ <td>
+ @Model.ShippingAddress.Address2
+ </td>
+ </tr>
+ }
+ @if (Model.ShippingAddress.CityEnabled)
+ {
+ <tr>
+ <td>
+ @Loc["Admin.Orders.Address.City"]:
+ </td>
+ <td>
+ @Model.ShippingAddress.City
+ </td>
+ </tr>
+ }
+ @if (Model.ShippingAddress.StateProvinceEnabled)
+ {
+ <tr>
+ <td>
+ @Loc["Admin.Orders.Address.StateProvince"]:
+ </td>
+ <td>
+ @Model.ShippingAddress.StateProvinceName
+ </td>
+ </tr>
+ }
+ @if (Model.ShippingAddress.ZipPostalCodeEnabled)
+ {
+ <tr>
+ <td>
+ @Loc["Admin.Orders.Address.ZipPostalCode"]:
+ </td>
+ <td>
+ @Model.ShippingAddress.ZipPostalCode
+ </td>
+ </tr>
+ }
+ @if (Model.ShippingAddress.CountryEnabled)
+ {
+ <tr>
+ <td>
+ @Loc["Admin.Orders.Address.Country"]:
+ </td>
+ <td>
+ @Model.ShippingAddress.CountryName
+ </td>
+ </tr>
+ }
+ @if (!string.IsNullOrEmpty(Model.ShippingAddress.FormattedCustomAddressAttributes))
+ {
+ <tr class="custom-attributes-view">
+ <td colspan="2">
+ @Html.Raw(Model.ShippingAddress.FormattedCustomAddressAttributes)
+ </td>
+ </tr>
+ }
- <table class="table table-bordered table-striped table-hover">
- @if (Model.ShippingAddress.FirstNameEnabled || Model.ShippingAddress.LastNameEnabled)
- {
- <tr>
- <td>
- @Loc["Admin.Orders.Address.FullName"]:
- </td>
- <td>
- @Model.ShippingAddress.FirstName @Model.ShippingAddress.LastName
- </td>
- </tr>
- }
- @if (Model.ShippingAddress.EmailEnabled)
- {
- <tr>
- <td>
- @Loc["Admin.Orders.Address.Email"]:
- </td>
- <td>
- @Model.ShippingAddress.Email
- </td>
- </tr>
- }
- @if (Model.ShippingAddress.PhoneEnabled)
- {
- <tr>
- <td>
- @Loc["Admin.Orders.Address.Phone"]:
- </td>
- <td>
- @Model.ShippingAddress.PhoneNumber
- </td>
- </tr>
- }
- @if (Model.ShippingAddress.FaxEnabled)
- {
- <tr>
- <td>
- @Loc["Admin.Orders.Address.Fax"]:
- </td>
- <td>
- @Model.ShippingAddress.FaxNumber
- </td>
- </tr>
- }
- @if (Model.ShippingAddress.CompanyEnabled)
- {
- <tr>
- <td>
- @Loc["Admin.Orders.Address.Company"]:
- </td>
- <td>
- @Model.ShippingAddress.Company
- </td>
- </tr>
- }
- @if (Model.ShippingAddress.StreetAddressEnabled)
- {
- <tr>
- <td>
- @Loc["Admin.Orders.Address.Address1"]:
- </td>
- <td>
- @Model.ShippingAddress.Address1
- </td>
- </tr>
- }
- @if (Model.ShippingAddress.StreetAddress2Enabled)
- {
- <tr>
- <td>
- @Loc["Admin.Orders.Address.Address2"]:
- </td>
- <td>
- @Model.ShippingAddress.Address2
- </td>
- </tr>
- }
- @if (Model.ShippingAddress.CityEnabled)
- {
- <tr>
- <td>
- @Loc["Admin.Orders.Address.City"]:
- </td>
- <td>
- @Model.ShippingAddress.City
- </td>
- </tr>
- }
- @if (Model.ShippingAddress.StateProvinceEnabled)
- {
- <tr>
- <td>
- @Loc["Admin.Orders.Address.StateProvince"]:
- </td>
- <td>
- @Model.ShippingAddress.StateProvinceName
- </td>
- </tr>
- }
- @if (Model.ShippingAddress.ZipPostalCodeEnabled)
- {
- <tr>
- <td>
- @Loc["Admin.Orders.Address.ZipPostalCode"]:
- </td>
- <td>
- @Model.ShippingAddress.ZipPostalCode
- </td>
- </tr>
- }
- @if (Model.ShippingAddress.CountryEnabled)
- {
- <tr>
- <td>
- @Loc["Admin.Orders.Address.Country"]:
- </td>
- <td>
- @Model.ShippingAddress.CountryName
- </td>
- </tr>
- }
- @if (!string.IsNullOrEmpty(Model.ShippingAddress.FormattedCustomAddressAttributes))
- {
- <tr class="custom-attributes-view">
- <td colspan="2">
- @Html.Raw(Model.ShippingAddress.FormattedCustomAddressAttributes)
- </td>
- </tr>
- }
- @if (!Model.IsLoggedInAsVendor)
- {
- <tr>
- <td colspan="2">
- <a href="@Url.Action("AddressEdit", new { addressId = Model.ShippingAddress.Id, orderId = Model.Id, area = Constants.AreaAdmin })" class="k-button"><span class="k-icon k-i-edit"></span>&nbsp;@Loc["Admin.Common.Edit"]</a>
- </td>
- </tr>
- }
- </table>
- <div style="padding-top: 15px;">
- <img alt="google maps" src="@Url.Content($"{Common.WwwRoot}/administration/build/images/google-maps.gif")" />
- <a href="@Html.Raw(Model.ShippingAddressGoogleMapsUrl)" target="_blank">@Loc["Admin.Orders.Fields.ShippingAddress.ViewOnGoogleMaps"]</a>
- </div>
+ <tr>
+ <td colspan="2">
+ <a href="@Url.Action("AddressEdit", new { addressId = Model.ShippingAddress.Id, orderId = Model.Id, area = Constants.AreaAdmin })" class="k-button"><span class="k-icon k-i-edit"></span>&nbsp;@Loc["Admin.Common.Edit"]</a>
+ </td>
+ </tr>
- }
- @if (Model.PickupAddress != null)
- {
- <div class="form-group">
- <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))
- {
- <tr>
- <td>
- @Loc["Admin.Orders.Address.Address1"]:
- </td>
- <td>
- @Model.PickupAddress.Address1
- </td>
- </tr>
- }
- @if (!string.IsNullOrEmpty(Model.PickupAddress.City))
- {
- <tr>
- <td>
- @Loc["Admin.Orders.Address.City"]:
- </td>
- <td>
- @Model.PickupAddress.City
- </td>
- </tr>
- }
- @if (!string.IsNullOrEmpty(Model.PickupAddress.ZipPostalCode))
- {
- <tr>
- <td>
- @Loc["Admin.Orders.Address.ZipPostalCode"]:
- </td>
- <td>
- @Model.PickupAddress.ZipPostalCode
- </td>
- </tr>
- }
- @if (!string.IsNullOrEmpty(Model.PickupAddress.CountryName))
- {
- <tr>
- <td>
- @Loc["Admin.Orders.Address.Country"]:
- </td>
- <td>
- @Model.PickupAddress.CountryName
- </td>
- </tr>
- }
- </table>
- </div>
- </div>
- }
+ </table>
+ <div style="padding-top: 15px;">
+ <img alt="google maps" src="@Url.Content($"{Common.WwwRoot}/administration/build/images/google-maps.gif")"/>
+ <a href="@Html.Raw(Model.ShippingAddressGoogleMapsUrl)" target="_blank">@Loc["Admin.Orders.Fields.ShippingAddress.ViewOnGoogleMaps"]</a>
+ </div>
+ }
+ @if (Model.PickupAddress != null)
+ {
+ <div class="form-group">
+ <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))
+ {
+ <tr>
+ <td>
+ @Loc["Admin.Orders.Address.Address1"]:
+ </td>
+ <td>
+ @Model.PickupAddress.Address1
+ </td>
+ </tr>
+ }
+ @if (!string.IsNullOrEmpty(Model.PickupAddress.City))
+ {
+ <tr>
+ <td>
+ @Loc["Admin.Orders.Address.City"]:
+ </td>
+ <td>
+ @Model.PickupAddress.City
+ </td>
+ </tr>
+ }
+ @if (!string.IsNullOrEmpty(Model.PickupAddress.ZipPostalCode))
+ {
+ <tr>
+ <td>
+ @Loc["Admin.Orders.Address.ZipPostalCode"]:
+ </td>
+ <td>
+ @Model.PickupAddress.ZipPostalCode
+ </td>
+ </tr>
+ }
+ @if (!string.IsNullOrEmpty(Model.PickupAddress.CountryName))
+ {
+ <tr>
+ <td>
+ @Loc["Admin.Orders.Address.Country"]:
+ </td>
+ <td>
+ @Model.PickupAddress.CountryName
+ </td>
+ </tr>
+ }
+ </table>
+ </div>
+ </div>
+ }
- @if (Model.IsShippable)
- {
- <div class="form-horizontal">
- <div class="form-body">
+ @if (Model.IsShippable)
+ {
+ <div class="form-horizontal">
+ <div class="form-body">
- <div class="form-group">
- <admin-label asp-for="ShippingMethod" />
- <div class="col-md-9 col-sm-9">
- <label class="control-label" id="lblShippingMethod">@Model.ShippingMethod</label>
- @if (!Model.IsLoggedInAsVendor)
- {
- <script>
+ <div class="form-group">
+ <admin-label asp-for="ShippingMethod"/>
+ <div class="col-md-9 col-sm-9">
+ <label class="control-label" id="lblShippingMethod">@Model.ShippingMethod</label>
+
+ <script>
$(document).ready(function () {
toggleEditShippingMethod(false);
});
@@ -402,41 +397,41 @@
}
</script>
- <div id="divShippingMethod" style="display: inline-block;"><admin-input asp-for="ShippingMethod" /></div>
- <button type="submit" id="btnEditShippingMethod" onclick=" toggleEditShippingMethod(true);return false; " class="k-button"><span class="k-icon k-i-edit"></span>&nbsp;@Loc["Admin.Common.Edit"]</button>
- <input type="submit" value="@Loc["Admin.Common.Save"]" id="btnSaveShippingMethod" asp-action="EditShippingMethod" name="save-shipping-method" class="k-button" onclick=" return confirm('@Loc["Admin.Common.AreYouSure"]'); " />
- <input type="submit" value="@Loc["Admin.Common.Cancel"]" onclick=" toggleEditShippingMethod(false);return false; " id="btnCancelShippingMethod" class="k-button" />
- }
- @if (!string.IsNullOrEmpty(Model.ShippingAdditionDescription))
- {
- <br />
- <label>@Html.Raw(Model.ShippingAdditionDescription)</label>
- }
- </div>
- </div>
- @if (!Model.IsLoggedInAsVendor)
- {
- <div class="form-group">
- <admin-label asp-for="ShippingStatus" />
- <div class="col-md-9 col-sm-9">
- <label class="control-label">@Model.ShippingStatus</label>
- </div>
- </div>
- }
+ <div id="divShippingMethod" style="display: inline-block;">
+ <admin-input asp-for="ShippingMethod"/>
</div>
+ <button type="submit" id="btnEditShippingMethod" onclick=" toggleEditShippingMethod(true);return false; " class="k-button"><span class="k-icon k-i-edit"></span>&nbsp;@Loc["Admin.Common.Edit"]</button>
+ <input type="submit" value="@Loc["Admin.Common.Save"]" id="btnSaveShippingMethod" asp-action="EditShippingMethod" name="save-shipping-method" class="k-button" onclick=" return confirm('@Loc["Admin.Common.AreYouSure"]'); "/>
+ <input type="submit" value="@Loc["Admin.Common.Cancel"]" onclick=" toggleEditShippingMethod(false);return false; " id="btnCancelShippingMethod" class="k-button"/>
+
+ @if (!string.IsNullOrEmpty(Model.ShippingAdditionDescription))
+ {
+ <br/>
+ <label>@Html.Raw(Model.ShippingAdditionDescription)</label>
+ }
</div>
- }
+ </div>
- </p>
+ <div class="form-group">
+ <admin-label asp-for="ShippingStatus"/>
+ <div class="col-md-9 col-sm-9">
+ <label class="control-label">@Model.ShippingStatus</label>
+ </div>
+ </div>
+
+ </div>
</div>
+ }
+
+ </p>
+ </div>
</div>
}
else
{
- <div class="card col-md-6">
- <div class="note note-info">@Loc["Admin.Orders.ShippingInfo.NotRequired"]</div>
- </div>
-
+ <div class="card col-md-6">
+ <div class="note note-info">@Loc["Admin.Orders.ShippingInfo.NotRequired"]</div>
+ </div>
}
-<vc:admin-widget widget-zone="order_details_address_bottom" additional-data="Model" />
\ No newline at end of file
+<vc:admin-widget widget-zone="order_details_address_bottom" additional-data="Model"/>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Info.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Info.cshtml
index b76d89f4f..e3951ec1f 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Info.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Info.cshtml
@@ -27,8 +27,6 @@
orderTagsSB.Append("]");
}
-@if (!Model.IsLoggedInAsVendor)
-{
<script>
$(document).ready(function() {
toggleChangeOrderStatus(false);
@@ -72,7 +70,7 @@
}
</script>
-}
+
<div class="form-horizontal">
<vc:admin-widget widget-zone="order_details_info_top" additional-data="Model" />
<div class="form-body">
@@ -82,8 +80,7 @@
<label class="control-label">@Model.OrderNumber</label>
</div>
</div>
- @if (!Model.IsLoggedInAsVendor)
- {
+
<div class="form-group order-status-block @Model.OrderStatus">
<admin-label asp-for="OrderStatus" asp-display-hint="false" class="control-label col-12 col-md-3 col-sm-3 pt-2"></admin-label>
<div class="col-12 col-md-9 col-sm-9 orderEditBtn">
@@ -107,22 +104,7 @@
</div>
</div>
</div>
- }
- @if (Model.IsLoggedInAsVendor && Model.OrderStatusId == (int)OrderStatusSystem.Cancelled)
- {
- <div class="form-group">
- <admin-label asp-for="OrderStatus" asp-display-hint="false" class="control-label col-12 col-md-3 col-sm-3"></admin-label>
- <div class="col-12 col-md-9 col-sm-9">
- <label class="control-label text-danger">
- <strong>
- @Model.OrderStatus
- </strong>
- </label>
- </div>
- </div>
- }
- @if (!Model.IsLoggedInAsVendor)
- {
+
<div class="form-group">
<admin-label asp-for="ShippingStatus" asp-display-hint="false" class="control-label col-12 col-md-3 col-sm-3"></admin-label>
<div class="col-12 col-md-9 col-sm-9">
@@ -131,7 +113,7 @@
</label>
</div>
</div>
- }
+
<div class="form-group">
<admin-label asp-for="PaymentStatus" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
<div class="col-9 col-md-9 col-sm-9">
@@ -163,19 +145,13 @@
}
}
<div>
- @if (!Model.IsLoggedInAsVendor)
- {
+
<a class="btn btn-@labelStatus" href="@Url.Action("Edit", "PaymentTransaction", new { id = Model.PaymentTransactionId, area = Constants.AreaAdmin })">@Model.PaymentStatus - @Loc["Admin.Common.View"]</a>
- }
- else
- {
- @Model.PaymentStatus
- }
+
</div>
</div>
</div>
- @if (!Model.IsLoggedInAsVendor)
- {
+
<div class="form-group" id="trEditOrderTags">
<admin-label asp-for="OrderTags" />
<div class="col-md-9 col-sm-9">
@@ -186,7 +162,7 @@
</div>
</div>
</div>
- }
+
@if (!string.IsNullOrEmpty(Model.Code))
{
<div class="form-group">
@@ -208,15 +184,14 @@
</label>
</div>
</div>
- @if (!Model.IsLoggedInAsVendor)
- {
+
<div class="form-group">
<admin-label asp-for="OrderGuid" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
<div class="col-9 col-md-9 col-sm-9">
<label class="control-label">@Model.OrderGuid</label>
</div>
</div>
- }
+
<div class="form-group">
<admin-label asp-for="StoreName" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
<div class="col-9 col-md-9 col-sm-9">
@@ -224,8 +199,6 @@
</div>
</div>
- @if (!Model.IsLoggedInAsVendor)
- {
<div class="form-group">
<admin-label asp-for="CustomerId" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
<div class="col-9 col-md-9 col-sm-9">
@@ -240,7 +213,7 @@
<label class="control-label">@Model.CustomerIp</label>
</div>
</div>
- if (!string.IsNullOrEmpty(Model.UrlReferrer))
+ @if (!string.IsNullOrEmpty(Model.UrlReferrer))
{
<div class="form-group">
<admin-label asp-for="UrlReferrer" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -249,7 +222,7 @@
</div>
</div>
}
- if (!string.IsNullOrEmpty(Model.VatNumber))
+ @if (!string.IsNullOrEmpty(Model.VatNumber))
{
<div class="form-group">
<admin-label asp-for="VatNumber" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -258,7 +231,7 @@
</div>
</div>
}
- if (!string.IsNullOrEmpty(Model.AffiliateId))
+ @if (!string.IsNullOrEmpty(Model.AffiliateId))
{
<div class="form-group">
<admin-label asp-for="AffiliateId" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -269,7 +242,7 @@
</div>
</div>
}
- if (!string.IsNullOrEmpty(Model.SalesEmployeeId))
+ @if (!string.IsNullOrEmpty(Model.SalesEmployeeId))
{
<div class="form-group">
<admin-label asp-for="SalesEmployeeId" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -278,7 +251,7 @@
</div>
</div>
}
- if (Model.TaxDisplayType == TaxDisplayType.IncludingTax)
+ @if (Model.TaxDisplayType == TaxDisplayType.IncludingTax)
{
<div class="form-group">
<admin-label asp-for="OrderSubtotalInclTax" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -287,7 +260,7 @@
</div>
</div>
}
- if (Model.TaxDisplayType == TaxDisplayType.ExcludingTax)
+ @if (Model.TaxDisplayType == TaxDisplayType.ExcludingTax)
{
<div class="form-group">
<admin-label asp-for="OrderSubtotalExclTax" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -296,7 +269,7 @@
</div>
</div>
}
- if (Model.TaxDisplayType == TaxDisplayType.IncludingTax
+ @if (Model.TaxDisplayType == TaxDisplayType.IncludingTax
&& !string.IsNullOrEmpty(Model.OrderSubTotalDiscountInclTax))
{
<div class="form-group">
@@ -306,7 +279,7 @@
</div>
</div>
}
- if (Model.TaxDisplayType == TaxDisplayType.ExcludingTax
+ @if (Model.TaxDisplayType == TaxDisplayType.ExcludingTax
&& !string.IsNullOrEmpty(Model.OrderSubTotalDiscountExclTax))
{
<div class="form-group">
@@ -316,7 +289,7 @@
</div>
</div>
}
- if (Model.TaxDisplayType == TaxDisplayType.IncludingTax)
+ @if (Model.TaxDisplayType == TaxDisplayType.IncludingTax)
{
<div class="form-group">
<admin-label asp-for="OrderShippingInclTax" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -325,7 +298,7 @@
</div>
</div>
}
- if (Model.TaxDisplayType == TaxDisplayType.ExcludingTax)
+ @if (Model.TaxDisplayType == TaxDisplayType.ExcludingTax)
{
<div class="form-group">
<admin-label asp-for="OrderShippingExclTax" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -334,7 +307,7 @@
</div>
</div>
}
- if (Model.TaxDisplayType == TaxDisplayType.IncludingTax
+ @if (Model.TaxDisplayType == TaxDisplayType.IncludingTax
&& !string.IsNullOrEmpty(Model.PaymentMethodAdditionalFeeInclTax))
{
<div class="form-group">
@@ -344,7 +317,7 @@
</div>
</div>
}
- if (Model.TaxDisplayType == TaxDisplayType.ExcludingTax
+ @if (Model.TaxDisplayType == TaxDisplayType.ExcludingTax
&& !string.IsNullOrEmpty(Model.PaymentMethodAdditionalFeeExclTax))
{
<div class="form-group">
@@ -354,7 +327,7 @@
</div>
</div>
}
- if (Model.DisplayTaxRates)
+ @if (Model.DisplayTaxRates)
{
foreach (var tr in Model.TaxRates)
{
@@ -366,7 +339,7 @@
</div>
}
}
- if (Model.DisplayTax)
+ @if (Model.DisplayTax)
{
<div class="form-group">
<admin-label asp-for="Tax" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -375,7 +348,7 @@
</div>
</div>
}
- if (!string.IsNullOrEmpty(Model.OrderTotalDiscount))
+ @if (!string.IsNullOrEmpty(Model.OrderTotalDiscount))
{
<div class="form-group">
<admin-label asp-for="OrderTotalDiscount" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -384,7 +357,7 @@
</div>
</div>
}
- foreach (var gc in Model.GiftVouchers)
+ @foreach (var gc in Model.GiftVouchers)
{
<div class="form-group">
<admin-label asp-for="GiftVouchers[0].CouponCode" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -394,7 +367,7 @@
</div>
</div>
}
- if (Model.RedeemedLoyaltyPoints > 0)
+ @if (Model.RedeemedLoyaltyPoints > 0)
{
<div class="form-group">
<admin-label asp-for="RedeemedLoyaltyPoints" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -413,7 +386,7 @@
<label class="control-label">@Model.OrderTotal</label>
</div>
</div>
- if (!string.IsNullOrEmpty(Model.RefundedAmount))
+ @if (!string.IsNullOrEmpty(Model.RefundedAmount))
{
<div class="form-group">
<admin-label asp-for="RefundedAmount" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -422,7 +395,7 @@
</div>
</div>
}
- if (!string.IsNullOrEmpty(Model.SuggestedRefundedAmount))
+ @if (!string.IsNullOrEmpty(Model.SuggestedRefundedAmount))
{
<div class="form-group">
<admin-label asp-for="SuggestedRefundedAmount" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -431,7 +404,7 @@
</div>
</div>
}
- if (Model.UsedDiscounts.Count > 0)
+ @if (Model.UsedDiscounts.Count > 0)
{
<div class="form-group">
<admin-label asp-for="UsedDiscounts" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -548,7 +521,7 @@
<label class="control-label">@Model.PaymentMethod</label>
</div>
</div>
- }
+
@if (Model.CustomValues is {Count: > 0 })
{
<div class="form-group">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Products.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Products.cshtml
index 8b712150f..aba43e4c6 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Products.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Products.cshtml
@@ -1,20 +1,20 @@
@model OrderModel
@using Grand.Domain.Tax;
-<vc:admin-widget widget-zone="order_details_products_top" additional-data="Model" />
+<vc:admin-widget widget-zone="order_details_products_top" additional-data="Model"/>
<div class="table-responsive order-table">
- <table class="table table-bordered table-striped table-hover">
- <tr>
- <td>
- @foreach (var item in Model.Items)
- {
- <script>
+<table class="table table-bordered table-striped table-hover">
+<tr>
+<td>
+@foreach (var item in Model.Items)
+{
+ <script>
$(document).ready(function() {
toggleOrderItemEdit@(item.Id)(false);
});
</script>
- <script>
+ <script>
function toggleOrderItemEdit@(item.Id) (editMode) {
if (editMode) {
$('#pnlEditPvUnitPrice@(item.Id)').show();
@@ -36,165 +36,160 @@
}
}
</script>
-
- }
- <table class="table table-bordered table-striped table-hover">
- <col />
- <col />
- @if (Model.HasDownloadableProducts)
+}
+<table class="table table-bordered table-striped table-hover">
+<col/>
+<col/>
+@if (Model.HasDownloadableProducts)
+{
+ <col/>
+}
+<col/>
+<col/>
+<col/>
+<col/>
+<col/>
+<thead>
+<tr>
+ <th>
+ @Loc["Admin.Orders.Products.Picture"]
+ </th>
+ <th>
+ @Loc["Admin.Orders.Products.ProductName"]
+ </th>
+ <th>
+ @Loc["Admin.Orders.Products.Price"]
+ </th>
+ <th class="qty-head">
+ @Loc["Admin.Orders.Products.Quantity"]
+ </th>
+ @if (Model.Items.Sum(x => x.DiscountInclTaxValue) > 0)
+ {
+ <th>
+ @Loc["Admin.Orders.Products.Discount"]
+ </th>
+ }
+ @if (Model.Items.Sum(x => x.CommissionValue) > 0)
+ {
+ <th>
+ @Loc["Admin.Orders.Products.Commission"]
+ </th>
+ }
+ <th>
+ @Loc["Admin.Orders.Products.Total"]
+ </th>
+ <th>
+ @Loc["Admin.Common.Edit"]
+ </th>
+</tr>
+</thead>
+<tbody>
+@for (var j = 0; j < Model.Items.Count; j++)
+{
+ var item = Model.Items[j];
+ <input asp-for="@Model.Items[j].Id" type="hidden"/>
+ <tr>
+ <td>
+ <img src="@item.PictureThumbnailUrl" alt="" title=""/>
+ </td>
+ <td>
+ <div>
+ <em>
+ <a href="@Url.Action("Edit", "Product", new { id = item.ProductId, area = Constants.AreaAdmin })">@item.ProductName</a>
+ </em>
+ @if (!string.IsNullOrEmpty(item.AttributeInfo))
+ {
+ <p>
+ @Html.Raw(item.AttributeInfo)
+ </p>
+ }
+ @if (!string.IsNullOrEmpty(item.RecurringInfo))
+ {
+ <p>
+ @Html.Raw(item.RecurringInfo)
+ </p>
+ }
+ @if (!string.IsNullOrEmpty(item.RentalInfo))
+ {
+ <p>
+ @Html.Raw(item.RentalInfo)
+ </p>
+ }
+ @if (!string.IsNullOrEmpty(item.Sku))
+ {
+ <p>
+ <strong>@Loc["Admin.Orders.Products.SKU"]</strong><text>:</text>
+ @item.Sku
+ </p>
+ }
+ @if (!string.IsNullOrEmpty(item.VendorName))
+ {
+ <p>
+ <strong>@Loc["Admin.Orders.Products.Vendor"]</strong><text>:</text>
+ @item.VendorName
+ </p>
+ }
+ @if (item.MerchandiseReturnIds.Count > 0)
+ {
+ <p>
+ @Loc["Admin.Orders.Products.MerchandiseReturns"]<text>:</text>
+ @for (var i = 0; i < item.MerchandiseReturnIds.Count; i++)
{
- <col />
+ <a href="@Url.Action("Edit", "MerchandiseReturn", new { id = item.MerchandiseReturnIds[i], area = Constants.AreaAdmin })" class="k-button"><span class="k-icon k-i-eye"></span>&nbsp;@Loc["Admin.Orders.MerchandiseReturns.View"]</a>
+ if (i != item.MerchandiseReturnIds.Count - 1)
+ {
+ <text>,</text>
+ }
}
- <col />
- <col />
- <col />
- <col />
- @if (!Model.IsLoggedInAsVendor)
+ </p>
+ }
+ @if (item.PurchasedGiftVoucherIds.Count > 0)
+ {
+ <p>
+ @Loc["Admin.Orders.Products.GiftVouchers"]<text>:</text>
+ @for (var i = 0; i < item.PurchasedGiftVoucherIds.Count; i++)
{
- <col />
+ <a href="@Url.Action("Edit", "GiftVoucher", new { id = item.PurchasedGiftVoucherIds[i], area = Constants.AreaAdmin })" class="k-button"><span class="k-icon k-i-eye"></span>&nbsp;@Loc["Admin.Orders.Products.GiftVoucher.View"]</a>
+ if (i != item.PurchasedGiftVoucherIds.Count - 1)
+ {
+ <text>,</text>
+ }
}
- <thead>
- <tr>
- <th>
- @Loc["Admin.Orders.Products.Picture"]
- </th>
- <th>
- @Loc["Admin.Orders.Products.ProductName"]
- </th>
- <th>
- @Loc["Admin.Orders.Products.Price"]
- </th>
- <th class="qty-head">
- @Loc["Admin.Orders.Products.Quantity"]
- </th>
- @if (Model.Items.Sum(x => x.DiscountInclTaxValue) > 0)
- {
- <th>
- @Loc["Admin.Orders.Products.Discount"]
- </th>
- }
- @if (Model.Items.Sum(x => x.CommissionValue) > 0)
- {
- <th>
- @Loc["Admin.Orders.Products.Commission"]
- </th>
- }
- <th>
- @Loc["Admin.Orders.Products.Total"]
- </th>
- @if (!Model.IsLoggedInAsVendor)
+ </p>
+ }
+ @if (Model.HasDownloadableProducts)
+ {
+ <p>
+ @if (item.IsDownload)
+ {
+ <div>
+ @string.Format(Loc["Admin.Orders.Products.Download.DownloadCount"], item.DownloadCount)
+ <input type="submit" asp-action="ResetDownloadCount" asp-route-orderItemId="@(item.Id)"
+ name="btnResetDownloadCount@(item.Id)" value="@Loc["Admin.Orders.Products.Download.ResetDownloadCount"]" title="@Loc["Admin.Orders.Products.Download.ResetDownloadCount.Title"]" id="btnResetDownloadCount@(item.Id)" class="k-button"/>
+ <hr/>
+ </div>
+ if (item.DownloadActivationType == DownloadActivationType.Manually)
+ {
+ <div>
+ <input type="submit" name="btnPvActivateDownload@(item.Id)" @(item.IsDownloadActivated ? " value=" + Loc["Admin.Orders.Products.Download.Deactivate"] : " value=" + Loc["Admin.Orders.Products.Download.Activate"]) id="btnPvActivateDownload@(item.Id)" class="k-button" asp-action="ActivateDownloadItem" asp-route-orderItemId="@(item.Id)"/>
+ <hr/>
+ </div>
+ }
+ <div>
+ <strong>
+ @Loc["Admin.Orders.Products.License"]
+ </strong>
+ <br/>
+ @if (item.LicenseDownloadGuid != Guid.Empty)
{
- <th>
- @Loc["Admin.Common.Edit"]
- </th>
+ <a href="@Url.Action("DownloadFile", "Download", new { downloadGuid = item.LicenseDownloadGuid, area = Constants.AreaAdmin })" class="btn purple">@Loc["Admin.Orders.Products.License.DownloadLicense"]</a>
}
- </tr>
- </thead>
- <tbody>
- @for (var j = 0; j < Model.Items.Count; j++)
- {
- var item = Model.Items[j];
- <input asp-for="@Model.Items[j].Id" type="hidden" />
- <tr>
- <td>
- <img src="@item.PictureThumbnailUrl" alt="" title="" />
- </td>
- <td>
- <div>
- <em><a href="@Url.Action("Edit", "Product", new { id = item.ProductId, area = Constants.AreaAdmin })">@item.ProductName</a></em>
- @if (!string.IsNullOrEmpty(item.AttributeInfo))
- {
- <p>
- @Html.Raw(item.AttributeInfo)
- </p>
- }
- @if (!string.IsNullOrEmpty(item.RecurringInfo))
- {
- <p>
- @Html.Raw(item.RecurringInfo)
- </p>
- }
- @if (!string.IsNullOrEmpty(item.RentalInfo))
- {
- <p>
- @Html.Raw(item.RentalInfo)
- </p>
- }
- @if (!string.IsNullOrEmpty(item.Sku))
- {
- <p>
- <strong>@Loc["Admin.Orders.Products.SKU"]</strong><text>:</text>
- @item.Sku
- </p>
- }
- @if (!string.IsNullOrEmpty(item.VendorName))
- {
- <p>
- <strong>@Loc["Admin.Orders.Products.Vendor"]</strong><text>:</text>
- @item.VendorName
- </p>
- }
- @if (item.MerchandiseReturnIds.Count > 0)
- {
- <p>
- @Loc["Admin.Orders.Products.MerchandiseReturns"]<text>:</text>
- @for (var i = 0; i < item.MerchandiseReturnIds.Count; i++)
- {
- <a href="@Url.Action("Edit", "MerchandiseReturn", new { id = item.MerchandiseReturnIds[i], area = Constants.AreaAdmin })" class="k-button"><span class="k-icon k-i-eye"></span>&nbsp;@Loc["Admin.Orders.MerchandiseReturns.View"]</a>
- if (i != item.MerchandiseReturnIds.Count - 1)
- {
- <text>,</text>
- }
- }
- </p>
- }
- @if (item.PurchasedGiftVoucherIds.Count > 0)
- {
- <p>
- @Loc["Admin.Orders.Products.GiftVouchers"]<text>:</text>
- @for (var i = 0; i < item.PurchasedGiftVoucherIds.Count; i++)
- {
- <a href="@Url.Action("Edit", "GiftVoucher", new { id = item.PurchasedGiftVoucherIds[i], area = Constants.AreaAdmin })" class="k-button"><span class="k-icon k-i-eye"></span>&nbsp;@Loc["Admin.Orders.Products.GiftVoucher.View"]</a>
- if (i != item.PurchasedGiftVoucherIds.Count - 1)
- {
- <text>,</text>
- }
- }
- </p>
- }
- @if (Model.HasDownloadableProducts)
- {
- <p>
- @if (item.IsDownload)
- {
- <div>
- @string.Format(Loc["Admin.Orders.Products.Download.DownloadCount"], item.DownloadCount)
- <input type="submit" asp-action="ResetDownloadCount" asp-route-orderItemId="@(item.Id)"
- name="btnResetDownloadCount@(item.Id)" value="@Loc["Admin.Orders.Products.Download.ResetDownloadCount"]" title="@Loc["Admin.Orders.Products.Download.ResetDownloadCount.Title"]" id="btnResetDownloadCount@(item.Id)" class="k-button" />
- <hr />
- </div>
- if (item.DownloadActivationType == DownloadActivationType.Manually)
- {
- <div>
- <input type="submit" name="btnPvActivateDownload@(item.Id)" @(item.IsDownloadActivated ? " value=" + Loc["Admin.Orders.Products.Download.Deactivate"] : " value=" + Loc["Admin.Orders.Products.Download.Activate"]) id="btnPvActivateDownload@(item.Id)" class="k-button" asp-action="ActivateDownloadItem" asp-route-orderItemId="@(item.Id)" />
- <hr />
- </div>
- }
- <div>
- <strong>
- @Loc["Admin.Orders.Products.License"]
- </strong>
- <br />
- @if (item.LicenseDownloadGuid != Guid.Empty)
- {
- <a href="@Url.Action("DownloadFile", "Download", new { downloadGuid = item.LicenseDownloadGuid, area = Constants.AreaAdmin })" class="btn purple">@Loc["Admin.Orders.Products.License.DownloadLicense"]</a>
- }
- <br />
- <a id="pvlicensefile" name="pvlicensefile" href="@(Url.Action("UploadLicenseFilePopup", "Order", new { id = Model.Id, orderItemId = item.Id, btnId = "btnRefreshPage", formId = "order-form", area = Constants.AreaAdmin }))" class="k-button">
- @Loc["Admin.Orders.Products.License.UploadFile"]
- </a>
- </div>
- <script>
+ <br/>
+ <a id="pvlicensefile" name="pvlicensefile" href="@(Url.Action("UploadLicenseFilePopup", "Order", new { id = Model.Id, orderItemId = item.Id, btnId = "btnRefreshPage", formId = "order-form", area = Constants.AreaAdmin }))" class="k-button">
+ @Loc["Admin.Orders.Products.License.UploadFile"]
+ </a>
+ </div>
+ <script>
$(document).ready(function () {
$('#pvlicensefile').magnificPopup({
type: 'ajax',
@@ -211,145 +206,147 @@
});
});
</script>
+ }
+ </p>
+ }
+ </div>
+ </td>
+ <td>
+ @switch (Model.TaxDisplayType)
+ {
+ case TaxDisplayType.ExcludingTax:
+ {
+ @item.UnitPriceExclTax
+ }
+ break;
+ case TaxDisplayType.IncludingTax:
+ {
+ @item.UnitPriceInclTax
+ }
+ break;
+ }
- }
- </p>
- }
- </div>
- </td>
- <td>
- @switch (Model.TaxDisplayType)
- {
- case TaxDisplayType.ExcludingTax:
- {
- @item.UnitPriceExclTax
- }
- break;
- case TaxDisplayType.IncludingTax:
- {
- @item.UnitPriceInclTax
- }
- break;
- }
-
- <div id="pnlEditPvUnitPrice@(item.Id)">
- <table class="order-edit">
- <tr>
- <td>
- @Loc["Admin.Orders.Products.Edit.ExclTax"]
- </td>
- <td>
- @*
+ <div id="pnlEditPvUnitPrice@(item.Id)">
+ <table class="order-edit">
+ <tr>
+ <td>
+ @Loc["Admin.Orders.Products.Edit.ExclTax"]
+ </td>
+ <td>
+ @*
<input name="pvUnitPriceExclTax@(item.Id)" type="text" value="@item.UnitPriceExclTaxValue" id="pvUnitPriceExclTax@(item.Id)" class="adminInput" style="width:80px;" />
*@
- <input asp-for="@Model.Items[j].UnitPriceExclTaxValue" class="adminInput" style="width:40px;" />
- </td>
- </tr>
- </table>
- </div>
- </td>
- <td>
- @item.Quantity
- <div id="pnlEditPvQuantity@(item.Id)">
- <table class="order-edit">
- <tr>
- <td colspan="2">
- @*
+ <input asp-for="@Model.Items[j].UnitPriceExclTaxValue" class="adminInput" style="width:40px;"/>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ <td>
+ @item.Quantity
+ <div id="pnlEditPvQuantity@(item.Id)">
+ <table class="order-edit">
+ <tr>
+ <td colspan="2">
+ @*
<input name="pvQuantity@(item.Id)" type="text" value="@item.Quantity" id="pvQuantity@(item.Id)" class="adminInput" style="width:40px;" />
*@
- <input asp-for="@Model.Items[j].Quantity" class="adminInput" style="width:40px;" />
- </td>
- </tr>
- </table>
- </div>
- @if (item.OpenQty > 0)
- {
- <div>
- Open: @item.OpenQty
- </div>
- }
- @if (item.CancelQty > 0)
- {
- <div>
- Canceled: @item.CancelQty
- </div>
- }
- </td>
- @if (Model.Items.Sum(x => x.DiscountInclTaxValue) > 0)
- {
- <td>
- @switch (Model.TaxDisplayType)
- {
- case TaxDisplayType.ExcludingTax:
- {
- @item.DiscountExclTax
- }
- break;
- case TaxDisplayType.IncludingTax:
- {
- @item.DiscountInclTax
- }
- break;
- }
-
- </td>
- }
- @if (Model.Items.Sum(x => x.CommissionValue) > 0)
- {
- <td>
- <div>@item.Commission</div>
- </td>
- }
- <td>
-
- @switch (Model.TaxDisplayType)
- {
- case TaxDisplayType.ExcludingTax:
- {
- @item.SubTotalExclTax
- }
- break;
- case TaxDisplayType.IncludingTax:
- {
- @item.SubTotalInclTax
- }
- break;
- }
-
- </td>
+ <input asp-for="@Model.Items[j].Quantity" class="adminInput" style="width:40px;"/>
+ </td>
+ </tr>
+ </table>
+ </div>
+ @if (item.OpenQty > 0)
+ {
+ <div>
+ Open: @item.OpenQty
+ </div>
+ }
+ @if (item.CancelQty > 0)
+ {
+ <div>
+ Canceled: @item.CancelQty
+ </div>
+ }
+ </td>
+ @if (Model.Items.Sum(x => x.DiscountInclTaxValue) > 0)
+ {
+ <td>
+ @switch (Model.TaxDisplayType)
+ {
+ case TaxDisplayType.ExcludingTax:
+ {
+ @item.DiscountExclTax
+ }
+ break;
+ case TaxDisplayType.IncludingTax:
+ {
+ @item.DiscountInclTax
+ }
+ break;
+ }
- @if (!Model.IsLoggedInAsVendor)
- {
- <td align="center">
- <div class="btn-group">
- <button type="submit" name="btnEditOrderItem@(item.Id)" id="btnEditOrderItem@(item.Id)" onclick="toggleOrderItemEdit@(item.Id)(true);return false; " class="k-button" title="@Loc["Admin.Common.Edit"]"><span class="k-icon k-i-edit"></span></button>
- <button type="submit" name="btnDeleteOrderItem@(item.Id)" asp-action="DeleteOrderItem" asp-route-orderItemId="@(item.Id)" id="btnDeleteOrderItem@(item.Id)" onclick="return confirm('@Loc["Admin.Common.AreYouSure"]'); " class="k-button" title="@Loc["Admin.Common.Delete"]"><span class="k-icon k-i-delete"></span></button>
- <button type="submit" name="btnCancelOrderItem@(item.Id)" asp-action="CancelOrderItem" asp-route-orderItemId="@(item.Id)" id="btnCancelOrderItem@(item.Id)" onclick="return confirm('@Loc["Admin.Common.AreYouSure"]'); " class="k-button" title="@Loc["Admin.Common.Cancel"]"><span class="k-icon k-i-cancel"></span></button>
- <button type="submit" name="btnSaveOrderItem@(item.Id)" asp-action="SaveOrderItem" asp-route-orderItemId="@(item.Id)" id="btnSaveOrderItem@(item.Id)" style="display:none;" onclick="return confirm('@Loc["Admin.Common.AreYouSure"]'); " class="k-button" title="@Loc["Admin.Common.Save"]"><span class="k-icon k-i-save"></span></button>
- <button type="submit" name="btnCancel@(item.Id)" id="btnCancel@(item.Id)" onclick="toggleOrderItemEdit@(item.Id) (false);return false; " class="k-button"><span class="k-icon k-i-cancel" title="@Loc["Admin.Common.Cancel"]"></span></button>
- </div>
- </td>
- }
- </tr>
- }
- </tbody>
- </table>
- </td>
- </tr>
- </table>
+ </td>
+ }
+ @if (Model.Items.Sum(x => x.CommissionValue) > 0)
+ {
+ <td>
+ <div>@item.Commission</div>
+ </td>
+ }
+ <td>
+
+ @switch (Model.TaxDisplayType)
+ {
+ case TaxDisplayType.ExcludingTax:
+ {
+ @item.SubTotalExclTax
+ }
+ break;
+ case TaxDisplayType.IncludingTax:
+ {
+ @item.SubTotalInclTax
+ }
+ break;
+ }
+
+ </td>
+
+ <td align="center">
+ <div class="btn-group">
+ <button type="submit" name="btnEditOrderItem@(item.Id)" id="btnEditOrderItem@(item.Id)" onclick="toggleOrderItemEdit@(item.Id)(true);return false; " class="k-button" title="@Loc["Admin.Common.Edit"]">
+ <span class="k-icon k-i-edit"></span>
+ </button>
+ <button type="submit" name="btnDeleteOrderItem@(item.Id)" asp-action="DeleteOrderItem" asp-route-orderItemId="@(item.Id)" id="btnDeleteOrderItem@(item.Id)" onclick="return confirm('@Loc["Admin.Common.AreYouSure"]'); " class="k-button" title="@Loc["Admin.Common.Delete"]">
+ <span class="k-icon k-i-delete"></span>
+ </button>
+ <button type="submit" name="btnCancelOrderItem@(item.Id)" asp-action="CancelOrderItem" asp-route-orderItemId="@(item.Id)" id="btnCancelOrderItem@(item.Id)" onclick="return confirm('@Loc["Admin.Common.AreYouSure"]'); " class="k-button" title="@Loc["Admin.Common.Cancel"]">
+ <span class="k-icon k-i-cancel"></span>
+ </button>
+ <button type="submit" name="btnSaveOrderItem@(item.Id)" asp-action="SaveOrderItem" asp-route-orderItemId="@(item.Id)" id="btnSaveOrderItem@(item.Id)" style="display:none;" onclick="return confirm('@Loc["Admin.Common.AreYouSure"]'); " class="k-button" title="@Loc["Admin.Common.Save"]">
+ <span class="k-icon k-i-save"></span>
+ </button>
+ <button type="submit" name="btnCancel@(item.Id)" id="btnCancel@(item.Id)" onclick="toggleOrderItemEdit@(item.Id) (false);return false; " class="k-button">
+ <span class="k-icon k-i-cancel" title="@Loc["Admin.Common.Cancel"]"></span>
+ </button>
+ </div>
+ </td>
+ </tr>
+}
+</tbody>
+</table>
+</td>
+</tr>
+</table>
</div>
-<vc:admin-widget widget-zone="order_details_products_bottom" additional-data="Model" />
+<vc:admin-widget widget-zone="order_details_products_bottom" additional-data="Model"/>
-@if (!string.IsNullOrEmpty(Model.CheckoutAttributeInfo) && !Model.IsLoggedInAsVendor)
+@if (!string.IsNullOrEmpty(Model.CheckoutAttributeInfo))
{
<div class="note note-info">
@Html.Raw(Model.CheckoutAttributeInfo)
</div>
}
-@if (!Model.IsLoggedInAsVendor)
-{
- <div class="form-actions">
- <button type="submit" id="btnAddNewProduct" name="btnAddNewProduct" onclick=" javascript:setLocation('@(Url.Action("AddProductToOrder", "Order", new { orderId = Model.Id, area = Constants.AreaAdmin }))'); return false; " class="k-button"><i class="fa fa-plus"></i>&nbsp;@Loc["Admin.Orders.Products.AddNew"]</button>
- </div>
-}
-
+<div class="form-actions">
+ <button type="submit" id="btnAddNewProduct" name="btnAddNewProduct" onclick=" javascript:setLocation('@(Url.Action("AddProductToOrder", "Order", new { orderId = Model.Id, area = Constants.AreaAdmin }))'); return false; " class="k-button"><i class="fa fa-plus"></i>&nbsp;@Loc["Admin.Orders.Products.AddNew"]</button>
+</div>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/List.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/List.cshtml
index c41b5db13..f113365d7 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/List.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/List.cshtml
@@ -31,15 +31,11 @@
</li>
</ul>
</div>
- @if (!Model.IsLoggedInAsVendor)
- {
- //a vendor cannot import products
<button type="button" id="importexcel" name="importexcel" class="btn default">
<i class="fa fa-upload"></i>
@Loc["Admin.Common.ImportFromExcel"]
</button>
- }
<button type="button" name="delete-selected" id="delete-selected" class="btn red">
<i class="fa fa-trash-o"></i>
@Loc["Admin.Common.Delete.Selected"]
@@ -137,7 +133,7 @@
<admin-select asp-for="SearchStoreId" asp-items="Model.AvailableStores" />
</div>
</div>
- <div class="form-group" @(Model.IsLoggedInAsVendor ? Html.Raw("style='display: none;'") : null)>
+ <div class="form-group">
<admin-label asp-for="SearchVendorId" class="col-sm-3 control-label" />
<div class="col-md-9 col-sm-9">
<admin-input asp-for="SearchVendorId" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Categories.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Categories.cshtml
index 8039fce64..034b65d7d 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Categories.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Categories.cshtml
@@ -97,29 +97,24 @@
editor: categoryDropDownEditor,
template: '<a class="k-link" href="@Url.Action("Edit", "Category", new { area = Constants.AreaAdmin })/#=CategoryId#">#:Category#</a>'
},
- @if (!Model.IsLoggedInAsVendor)
{
- //vendor cannot edit this field
- <text>{
field: "IsFeaturedProduct",
title: "@Loc["Admin.Catalog.Products.Categories.Fields.IsFeaturedProduct"]",
width: 100,
headerAttributes: { style: "text-align:center" },
attributes: { style: "text-align:center" },
template: '# if(IsFeaturedProduct) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'
- },</text>
- }
-
- {
- field: "DisplayOrder",
- title: "@Loc["Admin.Catalog.Products.Categories.Fields.DisplayOrder"]",
- width: 100,
- minScreenWidth: 500,
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- //integer format
- format: "{0:0}"
- }, {
+ },
+ {
+ field: "DisplayOrder",
+ title: "@Loc["Admin.Catalog.Products.Categories.Fields.DisplayOrder"]",
+ width: 100,
+ minScreenWidth: 500,
+ headerAttributes: { style: "text-align:center" },
+ attributes: { style: "text-align:center" },
+ //integer format
+ format: "{0:0}"
+ }, {
command: [{
name: "edit",
text: {
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Collections.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Collections.cshtml
index 3459e21ee..343ab8f82 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Collections.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Collections.cshtml
@@ -97,29 +97,24 @@
editor: collectionDropDownEditor,
template: '<a class="k-link" href="@Url.Action("Edit", "Collection", new { area = Constants.AreaAdmin })/#=CollectionId#">#:Collection#</a>'
},
- @if (!Model.IsLoggedInAsVendor)
{
- //vendor cannot edit this field
- <text>{
field: "IsFeaturedProduct",
title: "@Loc["Admin.Catalog.Products.Collections.Fields.IsFeaturedProduct"]",
width: 100,
headerAttributes: { style: "text-align:center" },
attributes: { style: "text-align:center" },
template: '# if(IsFeaturedProduct) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'
- },</text>
- }
-
- {
- field: "DisplayOrder",
- title: "@Loc["Admin.Catalog.Products.Collections.Fields.DisplayOrder"]",
- width: 100,
- minScreenWidth: 500,
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- //integer format
- format: "{0:0}"
- }, {
+ },
+ {
+ field: "DisplayOrder",
+ title: "@Loc["Admin.Catalog.Products.Collections.Fields.DisplayOrder"]",
+ width: 100,
+ minScreenWidth: 500,
+ headerAttributes: { style: "text-align:center" },
+ attributes: { style: "text-align:center" },
+ //integer format
+ format: "{0:0}"
+ }, {
command: [{
name: "edit",
text: {
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Info.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Info.cshtml
index b65c9052c..62de28134 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Info.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Info.cshtml
@@ -11,11 +11,8 @@
<script>
$(document).ready(function() {
- @if (!Model.IsLoggedInAsVendor)
- {
- <text>$("#@Html.IdFor(model => model.ShowOnHomePage)").click(toggleShowOnHomePage);</text>
- <text>$("#@Html.IdFor(model => model.BestSeller)").click(toggleShowOnHomePage);</text>
- }
+ $("#@Html.IdFor(model => model.ShowOnHomePage)").click(toggleShowOnHomePage);
+ $("#@Html.IdFor(model => model.BestSeller)").click(toggleShowOnHomePage);
$("#@Html.IdFor(model => model.ProductTypeId)").change(toggleProductType);
$("#@Html.IdFor(model => model.RequireOtherProducts)").click(toggleRequireOtherProducts);
$("#@Html.IdFor(model => model.AvailableForPreOrder)").click(togglePreOrder);
@@ -35,10 +32,7 @@
$("#@Html.IdFor(model => model.StockAvailability)").click(toggleManageStock);
$("#@Html.IdFor(model => model.MarkAsNew)").click(toggleMarkAsNew);
- @if (!Model.IsLoggedInAsVendor)
- {
- <text>toggleShowOnHomePage();</text>
- }
+ toggleShowOnHomePage();
toggleProductType();
togglePreOrder();
toggleRequireOtherProducts();
@@ -603,14 +597,14 @@
<span asp-validation-for="BrandId"></span>
</div>
</div>
- <div class="form-group" @(Model.IsLoggedInAsVendor ? Html.Raw("style='display: none;'") : null)>
+ <div class="form-group" >
<admin-label asp-for="VendorId" />
<div class="col-md-9 col-sm-9">
<admin-input asp-for="VendorId" />
<span asp-validation-for="VendorId"></span>
</div>
</div>
- <div class="form-group" @(Model.IsLoggedInAsVendor ? Html.Raw("style='display: none;'") : null)>
+ <div class="form-group" >
<admin-label asp-for="ShowOnHomePage" />
<div class="col-md-9 col-sm-9">
<label class="mt-checkbox mt-checkbox-outline control control-checkbox">
@@ -620,14 +614,14 @@
<span asp-validation-for="ShowOnHomePage"></span>
</div>
</div>
- <div class="form-group" id="pnlDisplayOrder" @(Model.IsLoggedInAsVendor ? Html.Raw("style='display: none;'") : null)>
+ <div class="form-group" id="pnlDisplayOrder" >
<admin-label asp-for="DisplayOrder" />
<div class="col-md-9 col-sm-9">
<admin-input asp-for="DisplayOrder" />
<span asp-validation-for="DisplayOrder"></span>
</div>
</div>
- <div class="form-group" @(Model.IsLoggedInAsVendor ? Html.Raw("style='display: none;'") : null)>
+ <div class="form-group" >
<admin-label asp-for="BestSeller" />
<div class="col-md-9 col-sm-9">
<label class="mt-checkbox mt-checkbox-outline control control-checkbox">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.PurchasedWithOrders.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.PurchasedWithOrders.cshtml
index 3f3ffe7ef..8a549a1d6 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.PurchasedWithOrders.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.PurchasedWithOrders.cshtml
@@ -57,9 +57,7 @@
minScreenWidth: 500,
template: '<a class="k-link" href="@Url.Action("Edit", "Customer", new { area = Constants.AreaAdmin })/#=CustomerId#">#:CustomerEmail#</a>'
},
- @if (!Model.IsLoggedInAsVendor)
{
- <text>{
field: "OrderStatus",
title: "@Loc["Admin.Orders.Fields.OrderStatus"]",
width: 100,
@@ -71,25 +69,26 @@
'# if(OrderStatusId == 30) {#success #} #' +
'# if(OrderStatusId == 40) {#danger #} #' +
'">#=OrderStatus#</span></h4>'
- },{
+ },
+ {
field: "PaymentStatus",
title: "@Loc["Admin.Orders.Fields.PaymentStatus"]",
width: 100,
minScreenWidth: 500,
- },{
+ },
+ {
field: "ShippingStatus",
title: "@Loc["Admin.Orders.Fields.ShippingStatus"]",
width: 100,
minScreenWidth: 500,
- },</text>
- }
- {
- field: "CreatedOn",
- title: "@Loc["Admin.Orders.Fields.CreatedOn"]",
- width: 150,
- type: "date",
- format: "{0:G}"
- }]
+ },
+ {
+ field: "CreatedOn",
+ title: "@Loc["Admin.Orders.Fields.CreatedOn"]",
+ width: 150,
+ type: "date",
+ format: "{0:G}"
+ }]
});
});
</script>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Reports/BestsellersReport.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Reports/BestsellersReport.cshtml
index dc8c39972..4a37fc7d0 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Reports/BestsellersReport.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Reports/BestsellersReport.cshtml
@@ -30,7 +30,7 @@
<admin-select asp-for="StoreId" asp-items="Model.AvailableStores" />
</div>
</div>
- <div class="col-md-4 col-ms-12 col-12" @(Model.IsLoggedInAsVendor ? Html.Raw("style='display: none;'") : null)>
+ <div class="col-md-4 col-ms-12 col-12">
<div class="form-group mb-0">
<admin-label asp-for="OrderStatusId" class="control-label" />
<admin-select asp-for="OrderStatusId" asp-items="Model.AvailableOrderStatuses" />
@@ -76,7 +76,7 @@
<admin-select asp-for="BillingCountryId" asp-items="Model.AvailableCountries" />
</div>
</div>
- <div class="form-group" @(Model.IsLoggedInAsVendor ? Html.Raw("style='display: none;'") : null)>
+ <div class="form-group">
<admin-label asp-for="VendorId" class="col-sm-3 control-label" />
<div class="col-md-9 col-sm-9">
<admin-select asp-for="VendorId" asp-items="Model.AvailableVendors" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/LatestOrder/Default.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/LatestOrder/Default.cshtml
index acb706116..15785fdc7 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/LatestOrder/Default.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/LatestOrder/Default.cshtml
@@ -1,5 +1,4 @@
-@model bool
-@inject AdminAreaSettings adminAreaSettings
+@inject AdminAreaSettings adminAreaSettings
<div id="latest-orders-grid"></div>
@@ -59,12 +58,7 @@
field: "CustomerEmail",
title: "@Loc["Admin.Orders.Fields.Customer"]",
width: 300,
- @if (!Model)
- {
- <text>
- template: '<a class="k-link" href="@Url.Action("Edit", "Customer", new { area = Constants.AreaAdmin })/#=CustomerId#">#=CustomerFullName# (#=CustomerEmail#)</a>'
- </text>
- }
+ template: '<a class="k-link" href="@Url.Action("Edit", "Customer", new { area = Constants.AreaAdmin })/#=CustomerId#">#=CustomerFullName# (#=CustomerEmail#)</a>'
},
@if (!adminAreaSettings.HideStoreColumn)
{
@@ -85,18 +79,13 @@
headerAttributes: { style: "text-align:center" },
attributes: { style: "text-align:center" },
},
-
- @if (!Model)
{
- //a vendor does not have access to this functionality
- <text>{
field: "OrderTotal",
title: "@Loc["Admin.Orders.Fields.OrderTotal"]",
width: 200,
headerAttributes: { style: "text-align:center" },
attributes: { style: "text-align:center" }
- },</text>
- }
+ },
{
field: "CreatedOn",
title: "@Loc["Admin.Orders.Fields.CreatedOn"]",
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/VendorReview/Edit.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/VendorReview/Edit.cshtml
index b97797044..93deb5cda 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/VendorReview/Edit.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/VendorReview/Edit.cshtml
@@ -5,7 +5,7 @@
ViewBag.Title = Loc["Admin.VendorReviews.EditVendorReviewDetails"];
}
<form asp-area="@Constants.AreaAdmin" asp-controller="VendorReview" asp-action="Edit" method="post">
-
+
<div class="row">
<div class="col-md-12">
<div class="x_panel light form-fit">
@@ -13,22 +13,27 @@
<div class="caption">
<i class="fa fa-cube"></i>
@Loc["Admin.VendorReviews.EditVendorReviewDetails"]
- <small><i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["Admin.VendorReviews.BackToList"], "List")</small>
+ <small>
+ <i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["Admin.VendorReviews.BackToList"], "List")
+ </small>
</div>
- @if (workContext.CurrentVendor == null)
- {
- <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["Admin.Common.Save"] </button>
- <button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"] </button>
- <span id="vendorreview-delete" class="btn red"><i class="fa fa-trash-o"></i> @Loc["Admin.Common.Delete"]</span>
- <vc:admin-widget widget-zone="vendor_review_details_buttons" additional-data="Model" />
- </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["Admin.Common.Save"]
+ </button>
+ <button class="btn btn-success" type="submit" name="save-continue">
+ <i class="fa fa-check-circle"></i> @Loc["Admin.Common.SaveContinue"]
+ </button>
+ <span id="vendorreview-delete" class="btn red">
+ <i class="fa fa-trash-o"></i> @Loc["Admin.Common.Delete"]
+ </span>
+ <vc:admin-widget widget-zone="vendor_review_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>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/VendorReview/List.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/VendorReview/List.cshtml
index 9ec5aa7f5..79b9ddffa 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/VendorReview/List.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/VendorReview/List.cshtml
@@ -1,5 +1,4 @@
@model VendorReviewListModel
-@inject IWorkContext workContext
@inject AdminAreaSettings adminAreaSettings
@{
@@ -60,10 +59,7 @@
<admin-input asp-for="CreatedOnTo" />
</div>
</div>
- @if (workContext.CurrentVendor == null)
- {
- <partial name="Partials/SearchVendor" model="Model" />
- }
+ <partial name="Partials/SearchVendor" model="Model" />
</div>
</div>
</div>
@@ -154,12 +150,8 @@ $(document).ready(function () {
});
});
</script>
-
-
<script>
-
var selectedIds = [];
-
$(document).ready(function () {
//search button
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/VendorReview/Partials/CreateOrUpdate.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/VendorReview/Partials/CreateOrUpdate.cshtml
index f1c9f0baf..9f9ff08a3 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/VendorReview/Partials/CreateOrUpdate.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/VendorReview/Partials/CreateOrUpdate.cshtml
@@ -1,70 +1,53 @@
@model VendorReviewModel
@inject IWorkContext workContext
@Html.ValidationSummary(false)
-<input asp-for="Id" type="hidden" />
+<input asp-for="Id" type="hidden"/>
<div class="form-horizontal">
<div class="form-body">
<div class="form-group">
- <admin-label asp-for="VendorName" />
+ <admin-label asp-for="VendorName"/>
<div class="col-md-9 col-sm-9">
<label class="control-label">@Html.ActionLink(Model.VendorName, "Edit", "Vendor", new { id = Model.VendorId }, new { })</label>
</div>
</div>
<div class="form-group">
- <admin-label asp-for="CustomerInfo" />
+ <admin-label asp-for="CustomerInfo"/>
<div class="col-md-9 col-sm-9">
<label class="control-label">@Html.ActionLink(Model.CustomerInfo, "Edit", "Customer", new { id = Model.CustomerId }, new { })</label>
</div>
</div>
<div class="form-group">
- <admin-label asp-for="Title" />
+ <admin-label asp-for="Title"/>
<div class="col-md-9 col-sm-9">
- @if (workContext.CurrentVendor == null)
- {
- <admin-input asp-for="Title" />
- <span asp-validation-for="Title"></span>
- }
- else
- {
- <span class="form-control">@Model.Title</span>
- }
+ <admin-input asp-for="Title"/>
+ <span asp-validation-for="Title"></span>
</div>
</div>
<div class="form-group">
- <admin-label asp-for="ReviewText" />
+ <admin-label asp-for="ReviewText"/>
<div class="col-md-9 col-sm-9">
- @if (workContext.CurrentVendor == null)
- {
- <admin-textarea asp-for="ReviewText" style="height: 100px;"></admin-textarea>
- <span asp-validation-for="ReviewText"></span>
- }
- else
- {
- <span class="form-control">@Model.ReviewText</span>
- }
+ <admin-textarea asp-for="ReviewText" style="height: 100px;"></admin-textarea>
+ <span asp-validation-for="ReviewText"></span>
</div>
</div>
<div class="form-group">
- <admin-label asp-for="Rating" />
+ <admin-label asp-for="Rating"/>
<div class="col-md-9 col-sm-9">
<label class="control-label">@Model.Rating</label>
</div>
</div>
- @if (workContext.CurrentVendor == null)
- {
- <div class="form-group">
- <admin-label asp-for="IsApproved" />
- <div class="col-md-9 col-sm-9">
- <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
- <admin-input asp-for="IsApproved" />
- <div class="control__indicator"></div>
- </label>
- <span asp-validation-for="IsApproved"></span>
- </div>
+ <div class="form-group">
+ <admin-label asp-for="IsApproved"/>
+ <div class="col-md-9 col-sm-9">
+ <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
+ <admin-input asp-for="IsApproved"/>
+ <div class="control__indicator"></div>
+ </label>
+ <span asp-validation-for="IsApproved"></span>
</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">@Model.CreatedOn)</label>
</div>
diff --git a/src/Web/Grand.Web.Admin/Components/LatestOrder.cs b/src/Web/Grand.Web.Admin/Components/LatestOrder.cs
index 91a1ecb83..a0704fe48 100644
--- a/src/Web/Grand.Web.Admin/Components/LatestOrder.cs
+++ b/src/Web/Grand.Web.Admin/Components/LatestOrder.cs
@@ -22,8 +22,7 @@ namespace Grand.Web.Admin.Components
if (!await _permissionService.Authorize(StandardPermission.ManageOrders))
return Content("");
- var isLoggedInAsVendor = _workContext.CurrentVendor != null;
- return View(isLoggedInAsVendor);
+ return View();
}
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Controllers/BrandController.cs b/src/Web/Grand.Web.Admin/Controllers/BrandController.cs
index f0ef3c027..0b05c935f 100644
--- a/src/Web/Grand.Web.Admin/Controllers/BrandController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/BrandController.cs
@@ -351,10 +351,6 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> ImportFromXlsx(IFormFile importexcelfile, [FromServices] IWorkContext workContext, [FromServices] IImportManager<BrandDto> importManager)
{
- //a vendor and staff cannot import collections
- if (workContext.CurrentVendor != null || await _groupService.IsStaff(_workContext.CurrentCustomer))
- return AccessDeniedView();
-
try
{
if (importexcelfile is { Length: > 0 })
diff --git a/src/Web/Grand.Web.Admin/Controllers/CategoryController.cs b/src/Web/Grand.Web.Admin/Controllers/CategoryController.cs
index 244c50a7d..0fe938202 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CategoryController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CategoryController.cs
@@ -310,10 +310,6 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> ImportFromXlsx(IFormFile importexcelfile, [FromServices] IImportManager<CategoryDto> importManager)
{
- //a vendor and staff cannot import categories
- if (_workContext.CurrentVendor != null || await _groupService.IsStaff(_workContext.CurrentCustomer))
- return AccessDeniedView();
-
try
{
if (importexcelfile is { Length: > 0 })
diff --git a/src/Web/Grand.Web.Admin/Controllers/CollectionController.cs b/src/Web/Grand.Web.Admin/Controllers/CollectionController.cs
index 7cf36dba2..04765322c 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CollectionController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CollectionController.cs
@@ -351,10 +351,6 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> ImportFromXlsx(IFormFile importexcelfile, [FromServices] IWorkContext workContext, [FromServices] IImportManager<CollectionDto> importManager)
{
- //a vendor and staff cannot import collections
- if (workContext.CurrentVendor != null || await _groupService.IsStaff(_workContext.CurrentCustomer))
- return AccessDeniedView();
-
try
{
if (importexcelfile is { Length: > 0 })
diff --git a/src/Web/Grand.Web.Admin/Controllers/ContactFormController.cs b/src/Web/Grand.Web.Admin/Controllers/ContactFormController.cs
index f267bc39b..61d3496f0 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ContactFormController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ContactFormController.cs
@@ -1,7 +1,6 @@
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Utilities.Common.Security;
using Grand.Business.Core.Interfaces.Marketing.Contacts;
-using Grand.Infrastructure;
using Grand.Web.Common.DataSource;
using Grand.Web.Common.Security.Authorization;
using Grand.Web.Admin.Interfaces;
@@ -16,17 +15,14 @@ namespace Grand.Web.Admin.Controllers
private readonly IContactUsService _contactUsService;
private readonly IContactFormViewModelService _contactFormViewModelService;
private readonly ITranslationService _translationService;
- private readonly IWorkContext _workContext;
public ContactFormController(IContactUsService contactUsService,
IContactFormViewModelService contactFormViewModelService,
- ITranslationService translationService,
- IWorkContext workContext)
+ ITranslationService translationService)
{
_contactUsService = contactUsService;
_contactFormViewModelService = contactFormViewModelService;
_translationService = translationService;
- _workContext = workContext;
}
public IActionResult Index() => RedirectToAction("List");
@@ -56,12 +52,7 @@ namespace Grand.Web.Admin.Controllers
var contactform = await _contactUsService.GetContactUsById(id);
if (contactform == null)
return RedirectToAction("List");
-
- if (_workContext.CurrentVendor != null)
- {
- if (contactform.VendorId != _workContext.CurrentVendor.Id)
- return RedirectToAction("List");
- }
+
var model = await _contactFormViewModelService.PrepareContactFormModel(contactform);
return View(model);
}
@@ -86,19 +77,7 @@ namespace Grand.Web.Admin.Controllers
[PermissionAuthorizeAction(PermissionActionName.Delete)]
public async Task<IActionResult> DeleteAll()
{
- if (_workContext.CurrentVendor != null)
- {
- var contactforms = await _contactUsService.GetAllContactUs(
- vendorId: _workContext.CurrentVendor.Id,
- pageIndex: 0,
- pageSize: int.MaxValue);
- foreach (var item in contactforms)
- {
- await _contactUsService.DeleteContactUs(item);
- }
- }
- else
- await _contactUsService.ClearTable();
+ await _contactUsService.ClearTable();
Success(_translationService.GetResource("Admin.System.ContactForm.DeletedAll"));
return RedirectToAction("List");
diff --git a/src/Web/Grand.Web.Admin/Controllers/CourseController.cs b/src/Web/Grand.Web.Admin/Controllers/CourseController.cs
index aebcce773..81a71aa3a 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CourseController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CourseController.cs
@@ -284,11 +284,6 @@ namespace Grand.Web.Admin.Controllers
public async Task<IActionResult> AssociateProductToCoursePopupList(DataSourceRequest command,
CourseModel.AssociateProductToCourseModel model, [FromServices] IWorkContext workContext)
{
- //a vendor should have access only to his products
- if (workContext.CurrentVendor != null)
- {
- model.SearchVendorId = workContext.CurrentVendor.Id;
- }
var products = await _courseViewModelService.PrepareProductModel(model, command.Page, command.PageSize);
var gridModel = new DataSourceResult
{
@@ -307,13 +302,7 @@ namespace Grand.Web.Admin.Controllers
var associatedProduct = await productService.GetProductById(model.AssociatedToProductId);
if (associatedProduct == null)
return Content("Cannot load a product");
-
- //a vendor should have access only to his products
- if (workContext.CurrentVendor != null && associatedProduct.VendorId != workContext.CurrentVendor.Id)
- return Content("This is not your product");
-
- //a vendor should have access only to his products
- model.IsLoggedInAsVendor = workContext.CurrentVendor != null;
+
ViewBag.RefreshPage = true;
ViewBag.productIdInput = productIdInput;
ViewBag.productNameInput = productNameInput;
diff --git a/src/Web/Grand.Web.Admin/Controllers/CustomerController.cs b/src/Web/Grand.Web.Admin/Controllers/CustomerController.cs
index 78b5479f2..1263b2eb7 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CustomerController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CustomerController.cs
@@ -662,9 +662,7 @@ namespace Grand.Web.Admin.Controllers
};
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
model.StoreId = _workContext.CurrentCustomer.StaffStoreId;
- if (_workContext.CurrentVendor != null)
- model.VendorId = _workContext.CurrentVendor.Id;
-
+
var (orderModels, totalCount) = await orderViewModelService.PrepareOrderModel(model, command.Page, command.PageSize);
var gridModel = new DataSourceResult
{
@@ -689,15 +687,7 @@ namespace Grand.Web.Admin.Controllers
var order = await orderService.GetOrderById(orderId);
if (order == null)
throw new ArgumentException("No order found with the specified id");
-
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !_workContext.HasAccessToOrder(order) && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Json(new DataSourceResult
- {
- Data = null,
- Total = 0
- });
-
+
if (await _groupService.IsStaff(_workContext.CurrentCustomer) && order.StoreId != _workContext.CurrentCustomer.StaffStoreId)
return Json(new DataSourceResult
{
@@ -910,12 +900,7 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> ContactFormList(DataSourceRequest command, string customerId)
{
- var vendorId = "";
- if (_workContext.CurrentVendor != null)
- {
- vendorId = _workContext.CurrentVendor.Id;
- }
- var (contactFormModels, totalCount) = await _customerViewModelService.PrepareContactFormModel(customerId, vendorId, command.Page, command.PageSize);
+ var (contactFormModels, totalCount) = await _customerViewModelService.PrepareContactFormModel(customerId, command.Page, command.PageSize);
var gridModel = new DataSourceResult
{
Data = contactFormModels.ToList(),
@@ -951,11 +936,7 @@ namespace Grand.Web.Admin.Controllers
var customer = await _customerService.GetCustomerById(customerId);
if (customer == null || customer.Deleted || await CheckSalesManager(customer))
throw new ArgumentException("No customer found with the specified id");
-
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null)
- return Content("");
-
+
var customerNoteModels = await _customerViewModelService.PrepareCustomerNoteList(customerId);
var gridModel = new DataSourceResult
{
@@ -973,10 +954,6 @@ namespace Grand.Web.Admin.Controllers
if (customer == null || customer.Deleted || await CheckSalesManager(customer))
return Json(new { Result = false });
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null)
- return Json(new { Result = false });
-
await _customerViewModelService.InsertCustomerNote(customerId, downloadId, displayToCustomer, title, message);
return Json(new { Result = true });
@@ -990,10 +967,6 @@ namespace Grand.Web.Admin.Controllers
if (customer == null || customer.Deleted || await CheckSalesManager(customer))
throw new ArgumentException("No customer found with the specified id");
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null)
- throw new ArgumentException("AccessDenied");
-
await _customerViewModelService.DeleteCustomerNote(id, customerId);
return new JsonResult("");
diff --git a/src/Web/Grand.Web.Admin/Controllers/HomeController.cs b/src/Web/Grand.Web.Admin/Controllers/HomeController.cs
index fbc6b8fc6..06db8626c 100644
--- a/src/Web/Grand.Web.Admin/Controllers/HomeController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/HomeController.cs
@@ -68,10 +68,7 @@ namespace Grand.Web.Admin.Controllers
private async Task<DashboardActivityModel> PrepareActivityModel()
{
var model = new DashboardActivityModel();
- var vendorId = "";
- if (_workContext.CurrentVendor != null)
- vendorId = _workContext.CurrentVendor.Id;
-
+
var storeId = string.Empty;
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
storeId = _workContext.CurrentCustomer.StaffStoreId;
@@ -79,7 +76,7 @@ namespace Grand.Web.Admin.Controllers
model.OrdersPending = (await _orderReportService.GetOrderAverageReportLine(storeId: storeId, os: (int)OrderStatusSystem.Pending)).CountOrders;
model.AbandonedCarts = (await _mediator.Send(new GetCustomerQuery { StoreId = storeId, LoadOnlyWithShoppingCart = true })).Count();
- var lowStockProducts = await _productsReportService.LowStockProducts(vendorId, storeId);
+ var lowStockProducts = await _productsReportService.LowStockProducts("", storeId);
model.LowStockProducts = lowStockProducts.products.Count + lowStockProducts.combinations.Count;
model.MerchandiseReturns = await _mediator.Send(new GetMerchandiseReturnCountQuery { RequestStatusId = 0, StoreId = storeId });
@@ -97,20 +94,14 @@ namespace Grand.Web.Admin.Controllers
#region Methods
- public async Task<IActionResult> Index()
+ public IActionResult Index()
{
- var model = new DashboardModel {
- IsLoggedInAsVendor = _workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer)
- };
- return View(model);
+ return View();
}
- public async Task<IActionResult> Statistics()
+ public IActionResult Statistics()
{
- var model = new DashboardModel {
- IsLoggedInAsVendor = _workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer)
- };
- return View(model);
+ return View();
}
public async Task<IActionResult> DashboardActivity()
diff --git a/src/Web/Grand.Web.Admin/Controllers/MerchandiseReturnController.cs b/src/Web/Grand.Web.Admin/Controllers/MerchandiseReturnController.cs
index b86041e55..eb0611110 100644
--- a/src/Web/Grand.Web.Admin/Controllers/MerchandiseReturnController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/MerchandiseReturnController.cs
@@ -137,11 +137,6 @@ namespace Grand.Web.Admin.Controllers
{
return RedirectToAction("List", "MerchandiseReturn");
}
-
- //a vendor should have access only to his merchandise return
- if (_workContext.CurrentVendor != null && merchandiseReturn.VendorId != _workContext.CurrentVendor.Id)
- return RedirectToAction("List", "MerchandiseReturn");
-
var model = new MerchandiseReturnModel();
await _merchandiseReturnViewModelService.PrepareMerchandiseReturnModel(model, merchandiseReturn, false);
return View(model);
@@ -165,10 +160,6 @@ namespace Grand.Web.Admin.Controllers
return RedirectToAction("List", "MerchandiseReturn");
}
- //a vendor should have access only to his merchandise return
- if (_workContext.CurrentVendor != null && merchandiseReturn.VendorId != _workContext.CurrentVendor.Id)
- return RedirectToAction("List", "MerchandiseReturn");
-
if (ModelState.IsValid)
{
var customAddressAttributes = new List<CustomAttribute>();
@@ -201,11 +192,6 @@ namespace Grand.Web.Admin.Controllers
{
return RedirectToAction("List", "MerchandiseReturn");
}
-
- //a vendor can't delete merchandise return
- if (_workContext.CurrentVendor != null)
- return RedirectToAction("List", "MerchandiseReturn");
-
if (ModelState.IsValid)
{
await _merchandiseReturnViewModelService.DeleteMerchandiseReturn(merchandiseReturn);
@@ -232,10 +218,6 @@ namespace Grand.Web.Admin.Controllers
{
return Content("");
}
- //a vendor should have access only to his merchandise return
- if (_workContext.CurrentVendor != null && merchandiseReturn.VendorId != _workContext.CurrentVendor.Id)
- return Content("");
-
//merchandise return notes
var merchandiseReturnNoteModels = await _merchandiseReturnViewModelService.PrepareMerchandiseReturnNotes(merchandiseReturn);
var gridModel = new DataSourceResult
@@ -261,11 +243,6 @@ namespace Grand.Web.Admin.Controllers
{
return Json(new { Result = false });
}
-
- //a vendor should have access only to his merchandise return
- if (_workContext.CurrentVendor != null && merchandiseReturn.VendorId != _workContext.CurrentVendor.Id)
- return Json(new { Result = false });
-
await _merchandiseReturnViewModelService.InsertMerchandiseReturnNote(merchandiseReturn, order, downloadId, displayToCustomer, message);
return Json(new { Result = true });
@@ -279,10 +256,6 @@ namespace Grand.Web.Admin.Controllers
if (merchandiseReturn == null)
throw new ArgumentException("No merchandise return found with the specified id");
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Json(new { Result = false });
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer) && merchandiseReturn.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
return Json(new { Result = false });
diff --git a/src/Web/Grand.Web.Admin/Controllers/OrderController.cs b/src/Web/Grand.Web.Admin/Controllers/OrderController.cs
index 8eb7b23c7..0a5ceb7a6 100644
--- a/src/Web/Grand.Web.Admin/Controllers/OrderController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/OrderController.cs
@@ -97,17 +97,10 @@ namespace Grand.Web.Admin.Controllers
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
storeId = _workContext.CurrentCustomer.StaffStoreId;
- var vendorId = string.Empty;
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- {
- vendorId = _workContext.CurrentVendor.Id;
- }
//products
const int productNumber = 15;
var products = (await productService.SearchProducts(
storeId: storeId,
- vendorId: vendorId,
keywords: term,
pageSize: productNumber,
showHidden: true)).products;
@@ -126,12 +119,7 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> OrderList(DataSourceRequest command, OrderListModel model)
{
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- {
- model.VendorId = _workContext.CurrentVendor.Id;
- }
-
+
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
model.StoreId = _workContext.CurrentCustomer.StaffStoreId;
@@ -186,10 +174,6 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> ExportExcelAll(OrderListModel model)
{
- //a vendor cannot export orders
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return AccessDeniedView();
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
model.StoreId = _workContext.CurrentCustomer.StaffStoreId;
@@ -213,10 +197,6 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> ExportExcelSelected(string selectedIds)
{
- //a vendor cannot export orders
- if (_workContext.CurrentVendor != null)
- return AccessDeniedView();
-
var orders = new List<Order>();
if (selectedIds != null)
{
@@ -248,11 +228,7 @@ namespace Grand.Web.Admin.Controllers
if (order == null || await CheckSalesManager(order))
//No order found with the specified id
return RedirectToAction("List");
-
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("Edit", "Order", new { id });
-
+
if (await _groupService.IsStaff(_workContext.CurrentCustomer) && order.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
return RedirectToAction("List");
@@ -282,11 +258,7 @@ namespace Grand.Web.Admin.Controllers
if (order == null || await CheckSalesManager(order))
//No order found with the specified id
return RedirectToAction("List");
-
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("Edit", "Order", new { id = order.Id });
-
+
if (await _groupService.IsStaff(_workContext.CurrentCustomer) && order.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
return RedirectToAction("List");
@@ -317,10 +289,6 @@ namespace Grand.Web.Admin.Controllers
//No order found with the specified id
return RedirectToAction("List");
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("Edit", "Order", new { id });
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer) && order.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
return RedirectToAction("List");
@@ -368,11 +336,7 @@ namespace Grand.Web.Admin.Controllers
if (order == null || order.Deleted || await CheckSalesManager(order))
//No order found with the specified id
return RedirectToAction("List");
-
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null && !_workContext.HasAccessToOrder(order) && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("List");
-
+
if (await _groupService.IsStaff(_workContext.CurrentCustomer) && order.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
return RedirectToAction("List");
@@ -394,10 +358,6 @@ namespace Grand.Web.Admin.Controllers
//No order found with the specified id
return RedirectToAction("List");
- //a vendor or staff does not have access to this functionality
- if (_workContext.CurrentVendor != null || await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("Edit", "Order", new { model.Id });
-
if (ModelState.IsValid)
{
await _mediator.Send(new DeleteOrderCommand { Order = order });
@@ -417,7 +377,7 @@ namespace Grand.Web.Admin.Controllers
[FromServices] ICustomerActivityService customerActivityService,
[FromServices] IShipmentService shipmentService)
{
- if (_workContext.CurrentVendor != null || await _groupService.IsStaff(_workContext.CurrentCustomer))
+ if (await _groupService.IsStaff(_workContext.CurrentCustomer))
return RedirectToAction("List", "Order");
if (selectedIds != null)
@@ -446,14 +406,6 @@ namespace Grand.Web.Admin.Controllers
public async Task<IActionResult> PdfInvoice(string orderId)
{
- var vendorId = string.Empty;
-
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- {
- vendorId = _workContext.CurrentVendor.Id;
- }
-
var order = await _orderService.GetOrderById(orderId);
if ((await _groupService.IsStaff(_workContext.CurrentCustomer) && order.StoreId != _workContext.CurrentCustomer.StaffStoreId) || await CheckSalesManager(order))
{
@@ -467,7 +419,7 @@ namespace Grand.Web.Admin.Controllers
byte[] bytes;
using (var stream = new MemoryStream())
{
- await _pdfService.PrintOrdersToPdf(stream, orders, _workContext.WorkingLanguage.Id, vendorId);
+ await _pdfService.PrintOrdersToPdf(stream, orders, _workContext.WorkingLanguage.Id, "");
bytes = stream.ToArray();
}
return File(bytes, "application/pdf", $"order_{order.Id}.pdf");
@@ -477,11 +429,6 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> PdfInvoiceAll(OrderListModel model)
{
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- {
- model.VendorId = _workContext.CurrentVendor.Id;
- }
//load orders
var orders = await _orderViewModelService.PrepareOrders(model);
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
@@ -511,13 +458,7 @@ namespace Grand.Web.Admin.Controllers
.ToArray();
orders.AddRange(await _orderService.GetOrdersByIds(ids));
}
- var vendorId = string.Empty;
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- {
- orders = orders.Where(_workContext.HasAccessToOrder).ToList();
- vendorId = _workContext.CurrentVendor.Id;
- }
+
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
orders = orders.Where(x => x.StoreId == _workContext.CurrentCustomer.StaffStoreId).ToList();
@@ -533,7 +474,7 @@ namespace Grand.Web.Admin.Controllers
byte[] bytes;
using (var stream = new MemoryStream())
{
- await _pdfService.PrintOrdersToPdf(stream, orders, _workContext.WorkingLanguage.Id, vendorId);
+ await _pdfService.PrintOrdersToPdf(stream, orders, _workContext.WorkingLanguage.Id, "");
bytes = stream.ToArray();
}
return File(bytes, "application/pdf", "orders.pdf");
@@ -548,10 +489,6 @@ namespace Grand.Web.Admin.Controllers
//No order found with the specified id
return RedirectToAction("List");
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("Edit", "Order", new { id });
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer) && order.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
return RedirectToAction("Edit", "Order", new { id });
@@ -593,10 +530,6 @@ namespace Grand.Web.Admin.Controllers
//No order found with the specified id
return RedirectToAction("List");
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("Edit", "Order", new { id });
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer) && order.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
return RedirectToAction("Edit", "Order", new { id });
@@ -630,10 +563,6 @@ namespace Grand.Web.Admin.Controllers
//No order found with the specified id
return RedirectToAction("List");
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("Edit", "Order", new { id });
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer) && order.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
return RedirectToAction("Edit", "Order", new { id });
@@ -660,11 +589,7 @@ namespace Grand.Web.Admin.Controllers
if (order == null || await CheckSalesManager(order))
//No order found with the specified id
return RedirectToAction("List");
-
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("Edit", "Order", new { id });
-
+
if (await _groupService.IsStaff(_workContext.CurrentCustomer) && order.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
return RedirectToAction("Edit", "Order", new { id });
@@ -731,10 +656,6 @@ namespace Grand.Web.Admin.Controllers
//No order found with the specified id
return RedirectToAction("List");
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("Edit", "Order", new { id });
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer) && order.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
return RedirectToAction("Edit", "Order", new { id });
@@ -764,10 +685,6 @@ namespace Grand.Web.Admin.Controllers
//No order found with the specified id
return RedirectToAction("List");
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("Edit", "Order", new { id });
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer) && order.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
return RedirectToAction("Edit", "Order", new { id });
@@ -808,11 +725,6 @@ namespace Grand.Web.Admin.Controllers
if (orderItem == null)
throw new ArgumentException("No order item found with the specified id");
- //ensure a vendor has access only to his products
- if (_workContext.CurrentVendor != null && !_workContext.HasAccessToOrderItem(orderItem) && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("List");
-
-
orderItem.DownloadCount = 0;
await _orderService.UpdateOrder(order);
_ = _orderViewModelService.LogEditOrder(order.Id);
@@ -842,11 +754,7 @@ namespace Grand.Web.Admin.Controllers
var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == orderItemId);
if (orderItem == null)
throw new ArgumentException("No order item found with the specified id");
-
- //ensure a vendor has access only to his products
- if (_workContext.CurrentVendor != null && !_workContext.HasAccessToOrderItem(orderItem) && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("List");
-
+
orderItem.IsDownloadActivated = !orderItem.IsDownloadActivated;
await _orderService.UpdateOrder(order);
_ = _orderViewModelService.LogEditOrder(order.Id);
@@ -880,11 +788,6 @@ namespace Grand.Web.Admin.Controllers
if (!product.IsDownload)
throw new ArgumentException("Product is not downloadable");
-
- //ensure a vendor has access only to his products
- if (_workContext.CurrentVendor != null && !_workContext.HasAccessToOrderItem(orderItem) && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("List");
-
var model = new OrderModel.UploadLicenseModel
{
LicenseDownloadId = !string.IsNullOrEmpty(orderItem.LicenseDownloadId) ? orderItem.LicenseDownloadId : "",
@@ -913,10 +816,6 @@ namespace Grand.Web.Admin.Controllers
if (orderItem == null)
throw new ArgumentException("No order item found with the specified id");
- //ensure a vendor has access only to his products
- if (_workContext.CurrentVendor != null && !_workContext.HasAccessToOrderItem(orderItem) && await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("List");
-
//attach license
if (!string.IsNullOrEmpty(model.LicenseDownloadId))
orderItem.LicenseDownloadId = model.LicenseDownloadId;
@@ -949,10 +848,6 @@ namespace Grand.Web.Admin.Controllers
if (orderItem == null)
throw new ArgumentException("No order item found with the specified id");
- //ensure a vendor has access only to his products
- if (_workContext.CurrentVendor != null && !_workContext.HasAccessToOrderItem(orderItem) && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("List");
-
//attach license
orderItem.LicenseDownloadId = null;
await _orderService.UpdateOrder(order);
@@ -968,10 +863,6 @@ namespace Grand.Web.Admin.Controllers
[PermissionAuthorizeAction(PermissionActionName.Edit)]
public async Task<IActionResult> AddProductToOrder(string orderId)
{
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("Edit", "Order", new { id = orderId });
-
var order = await _orderService.GetOrderById(orderId);
if (order == null || await CheckSalesManager(order))
//No order found with the specified id
@@ -985,10 +876,6 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> AddProductToOrder(DataSourceRequest command, OrderModel.AddOrderProductModel model, [FromServices] IProductService productService)
{
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Content("");
-
var categoryIds = new List<string>();
if (!string.IsNullOrEmpty(model.SearchCategoryId))
categoryIds.Add(model.SearchCategoryId);
@@ -1028,10 +915,6 @@ namespace Grand.Web.Admin.Controllers
[PermissionAuthorizeAction(PermissionActionName.Edit)]
public async Task<IActionResult> AddProductToOrderDetails(string orderId, string productId)
{
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("Edit", "Order", new { id = orderId });
-
var order = await _orderService.GetOrderById(orderId);
if (order == null || await CheckSalesManager(order))
return RedirectToAction("List");
@@ -1049,10 +932,6 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> AddProductToOrderDetails(AddProductToOrderModel model)
{
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("Edit", "Order", new { id = model.OrderId });
-
var order = await _orderService.GetOrderById(model.OrderId);
if (order == null || await CheckSalesManager(order))
return RedirectToAction("List");
@@ -1086,11 +965,7 @@ namespace Grand.Web.Admin.Controllers
if (order == null || await CheckSalesManager(order))
//No order found with the specified id
return RedirectToAction("List");
-
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("Edit", "Order", new { id = orderId });
-
+
if (await _groupService.IsStaff(_workContext.CurrentCustomer) && order.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
return RedirectToAction("List");
@@ -1131,11 +1006,7 @@ namespace Grand.Web.Admin.Controllers
if (order == null || await CheckSalesManager(order))
//No order found with the specified id
return RedirectToAction("List");
-
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("Edit", "Order", new { id = order.Id });
-
+
if (await _groupService.IsStaff(_workContext.CurrentCustomer) && order.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
return RedirectToAction("List");
@@ -1182,11 +1053,7 @@ namespace Grand.Web.Admin.Controllers
var order = await _orderService.GetOrderById(orderId);
if (order == null || await CheckSalesManager(order))
throw new ArgumentException("No order found with the specified id");
-
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Content("");
-
+
if (await _groupService.IsStaff(_workContext.CurrentCustomer) && order.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
return Content("");
@@ -1207,11 +1074,7 @@ namespace Grand.Web.Admin.Controllers
var order = await _orderService.GetOrderById(orderId);
if (order == null || await CheckSalesManager(order))
return Json(new { Result = false });
-
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Json(new { Result = false });
-
+
if (await _groupService.IsStaff(_workContext.CurrentCustomer) && order.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
return Json(new { Result = false });
@@ -1228,11 +1091,7 @@ namespace Grand.Web.Admin.Controllers
var order = await _orderService.GetOrderById(orderId);
if (order == null || await CheckSalesManager(order))
throw new ArgumentException("No order found with the specified id");
-
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Json(new { Result = false });
-
+
if (await _groupService.IsStaff(_workContext.CurrentCustomer) && order.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
return Json(new { Result = false });
diff --git a/src/Web/Grand.Web.Admin/Controllers/PaymentTransactionController.cs b/src/Web/Grand.Web.Admin/Controllers/PaymentTransactionController.cs
index 4402406e7..7169201fe 100644
--- a/src/Web/Grand.Web.Admin/Controllers/PaymentTransactionController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/PaymentTransactionController.cs
@@ -524,10 +524,6 @@ namespace Grand.Web.Admin.Controllers
{
return RedirectToAction("List", "MerchandiseReturn");
}
-
- if (_workContext.CurrentVendor != null)
- return RedirectToAction("List", "PaymentTransaction");
-
if (ModelState.IsValid)
{
await _paymentTransactionService.DeletePaymentTransaction(paymentTransaction);
diff --git a/src/Web/Grand.Web.Admin/Controllers/ProductController.cs b/src/Web/Grand.Web.Admin/Controllers/ProductController.cs
index 0c5881401..ee8dcbe4e 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ProductController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ProductController.cs
@@ -85,14 +85,6 @@ namespace Grand.Web.Admin.Controllers
{
return (false, "Product not exists");
}
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- {
- if (product.VendorId != _workContext.CurrentVendor.Id)
- {
- return (false, "This is not your product");
- }
- }
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
if (!(!product.LimitedToStores || (product.Stores.Contains(_workContext.CurrentCustomer.StaffStoreId) && product.LimitedToStores)))
@@ -183,11 +175,6 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
//No product found with the specified id
return RedirectToAction("List");
-
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("List");
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
if (!product.LimitedToStores || (product.LimitedToStores && product.Stores.Contains(_workContext.CurrentCustomer.StaffStoreId) && product.Stores.Count > 1))
@@ -226,10 +213,6 @@ namespace Grand.Web.Admin.Controllers
//No product found with the specified id
return RedirectToAction("List");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("List");
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
if (!product.AccessToEntityByStore(_workContext.CurrentCustomer.StaffStoreId))
@@ -268,10 +251,6 @@ namespace Grand.Web.Admin.Controllers
//No product found with the specified id
return RedirectToAction("List");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("List");
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
if (!product.AccessToEntityByStore(_workContext.CurrentCustomer.StaffStoreId))
@@ -308,11 +287,6 @@ namespace Grand.Web.Admin.Controllers
try
{
var originalProduct = await _productService.GetProductById(copyModel.Id, true);
-
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && originalProduct.VendorId != _workContext.CurrentVendor.Id)
- return RedirectToAction("List");
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
originalProduct.LimitedToStores = true;
@@ -649,9 +623,6 @@ namespace Grand.Web.Admin.Controllers
{
await _productViewModelService.InsertRelatedProductModel(model);
}
-
- //a vendor should have access only to his products
- model.IsLoggedInAsVendor = _workContext.CurrentVendor != null;
return Content("");
}
@@ -751,8 +722,6 @@ namespace Grand.Web.Admin.Controllers
{
await _productViewModelService.InsertSimilarProductModel(model);
}
- //a vendor should have access only to his products
- model.IsLoggedInAsVendor = _workContext.CurrentVendor != null;
return Content("");
}
@@ -852,9 +821,6 @@ namespace Grand.Web.Admin.Controllers
{
await _productViewModelService.InsertBundleProductModel(model);
}
-
- //a vendor should have access only to his products
- model.IsLoggedInAsVendor = _workContext.CurrentVendor != null;
return Content("");
}
@@ -1062,15 +1028,7 @@ namespace Grand.Web.Admin.Controllers
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(parentGroupedProductId: productId,
- vendorId: vendorId,
showHidden: true);
var associatedProductsModel = associatedProducts
.Select(x => new ProductModel.AssociatedProductModel {
@@ -1198,16 +1156,6 @@ namespace Grand.Web.Admin.Controllers
}
var product = await _productService.GetProductById(objectId);
-
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Json(new
- {
- success = false,
- message = "Access denied - vendor permissions"
- });
-
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
if (!product.AccessToEntityByStore(_workContext.CurrentCustomer.StaffStoreId))
return Json(new
@@ -1480,8 +1428,6 @@ namespace Grand.Web.Admin.Controllers
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
model.StoreId = _workContext.CurrentCustomer.StaffStoreId;
- if (_workContext.CurrentVendor != null)
- model.VendorId = _workContext.CurrentVendor.Id;
var (orderModels, totalCount) = await orderViewModelService.PrepareOrderModel(model, command.Page, command.PageSize);
var gridModel = new DataSourceResult {
@@ -1562,12 +1508,6 @@ namespace Grand.Web.Admin.Controllers
.ToArray();
products.AddRange(await _productService.GetProductsByIds(ids, true));
}
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- {
- products = products.Where(p => p.VendorId == _workContext.CurrentVendor.Id).ToList();
- }
-
var bytes = await exportManager.Export(products);
return File(bytes, "text/xls", "products.xlsx");
}
@@ -1576,10 +1516,6 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> ImportExcel(IFormFile importexcelfile, [FromServices] IImportManager<ProductDto> importManager)
{
- //a vendor ans staff cannot import products
- if (_workContext.CurrentVendor != null || await _groupService.IsStaff(_workContext.CurrentCustomer))
- return AccessDeniedView();
-
try
{
if (importexcelfile is { Length: > 0 })
@@ -1831,10 +1767,6 @@ namespace Grand.Web.Admin.Controllers
if (tierPrice == null)
return Content("Empty tier price");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Content("This is not your product");
-
var model = tierPrice.ToModel(_dateTimeService);
model.ProductId = productId;
await _productViewModelService.PrepareTierPriceModel(model);
@@ -1964,11 +1896,7 @@ namespace Grand.Web.Admin.Controllers
var productAttributeMapping = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == id);
if (productAttributeMapping == null)
throw new ArgumentException("No product attribute mapping found with the specified id");
-
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Content("This is not your product");
-
+
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
if (!product.AccessToEntityByStore(_workContext.CurrentCustomer.StaffStoreId))
return ErrorForKendoGridJson(_translationService.GetResource("Admin.Catalog.Products.Permisions"));
@@ -2052,10 +1980,6 @@ namespace Grand.Web.Admin.Controllers
if (productAttributeMapping == null)
return Content("No attribute value found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Content(_translationService.GetResource("Admin.Catalog.Products.Permisions"));
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
if (!product.AccessToEntityByStore(_workContext.CurrentCustomer.StaffStoreId))
return Content(_translationService.GetResource("Admin.Catalog.Products.Permisions"));
@@ -2080,10 +2004,6 @@ namespace Grand.Web.Admin.Controllers
if (productAttributeMapping == null)
throw new ArgumentException("No product attribute mapping found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("List", "Product");
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
if (!(!product.LimitedToStores || (product.Stores.Contains(_workContext.CurrentCustomer.StaffStoreId) && product.LimitedToStores)))
@@ -2232,10 +2152,6 @@ namespace Grand.Web.Admin.Controllers
if (pav == null)
throw new ArgumentException("No product attribute value found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Content("This is not your product");
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
if (!product.AccessToEntityByStore(_workContext.CurrentCustomer.StaffStoreId))
throw new ArgumentException(_translationService.GetResource("Admin.Catalog.Products.Permisions"));
@@ -2275,10 +2191,6 @@ namespace Grand.Web.Admin.Controllers
if (associatedProduct == null)
return Content("Cannot load a product");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && associatedProduct.VendorId != _workContext.CurrentVendor.Id && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Content("This is not your product");
-
return Content("");
}
@@ -2315,11 +2227,7 @@ namespace Grand.Web.Admin.Controllers
var combination = product.ProductAttributeCombinations.FirstOrDefault(x => x.Id == id);
if (combination == null)
throw new ArgumentException("No product attribute combination found with the specified id");
-
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Content("This is not your product");
-
+
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
if (!product.AccessToEntityByStore(_workContext.CurrentCustomer.StaffStoreId))
return Content(_translationService.GetResource("Admin.Catalog.Products.Permisions"));
@@ -2360,11 +2268,7 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
//No product found with the specified id
return RedirectToAction("List", "Product");
-
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("List", "Product");
-
+
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
if (!product.AccessToEntityByStore(_workContext.CurrentCustomer.StaffStoreId))
return Content(_translationService.GetResource("Admin.Catalog.Products.Permisions"));
@@ -2388,10 +2292,6 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
throw new ArgumentException("No product found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Content("This is not your product");
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
if (!product.AccessToEntityByStore(_workContext.CurrentCustomer.StaffStoreId))
return Content(_translationService.GetResource("Admin.Catalog.Products.Permisions"));
@@ -2409,10 +2309,6 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
throw new ArgumentException("No product found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id)
- return Content("This is not your product");
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
if (!product.AccessToEntityByStore(_workContext.CurrentCustomer.StaffStoreId))
throw new ArgumentException(_translationService.GetResource("Admin.Catalog.Products.Permisions"));
@@ -2461,10 +2357,6 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
throw new ArgumentException("No product found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Content("This is not your product");
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
if (!product.AccessToEntityByStore(_workContext.CurrentCustomer.StaffStoreId))
return Content("", _translationService.GetResource("Admin.Catalog.Products.Permisions"));
@@ -2484,10 +2376,6 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
throw new ArgumentException("No product found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Content("This is not your product");
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
if (!product.AccessToEntityByStore(_workContext.CurrentCustomer.StaffStoreId))
return Content("", _translationService.GetResource("Admin.Catalog.Products.Permisions"));
@@ -2507,10 +2395,6 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
throw new ArgumentException("No product found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Content("This is not your product");
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
if (!product.AccessToEntityByStore(_workContext.CurrentCustomer.StaffStoreId))
return ErrorForKendoGridJson(_translationService.GetResource("Admin.Catalog.Products.Permisions"));
@@ -2591,11 +2475,7 @@ namespace Grand.Web.Admin.Controllers
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 (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Json(new { errors = "This is not your product" });
-
+
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
if (!product.AccessToEntityByStore(_workContext.CurrentCustomer.StaffStoreId))
return Json(new { errors = _translationService.GetResource("Admin.Catalog.Products.Permisions") });
@@ -2741,10 +2621,6 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
throw new ArgumentException("No product found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Json(new { errors = "This is not your product" });
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
if (!product.AccessToEntityByStore(_workContext.CurrentCustomer.StaffStoreId))
return Json(new { errors = _translationService.GetResource("Admin.Catalog.Products.Permisions") });
@@ -2765,10 +2641,6 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
throw new ArgumentException("No product found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Json(new { errors = "This is not your product" });
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
if (!product.AccessToEntityByStore(_workContext.CurrentCustomer.StaffStoreId))
return Json(new { errors = _translationService.GetResource("Admin.Catalog.Products.Permisions") });
@@ -2790,10 +2662,6 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
throw new ArgumentException("No product found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Json(new { errors = "This is not your product" });
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
if (!product.AccessToEntityByStore(_workContext.CurrentCustomer.StaffStoreId))
return ErrorForKendoGridJson(_translationService.GetResource("Admin.Catalog.Products.Permisions"));
@@ -2821,11 +2689,7 @@ namespace Grand.Web.Admin.Controllers
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 (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Json(new { errors = "This is not your product" });
-
+
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
if (!product.AccessToEntityByStore(_workContext.CurrentCustomer.StaffStoreId))
return Json(new { errors = _translationService.GetResource("Admin.Catalog.Products.Permisions") });
@@ -2846,10 +2710,6 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
throw new ArgumentException("No product found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Json(new { errors = "This is not your product" });
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
if (!product.AccessToEntityByStore(_workContext.CurrentCustomer.StaffStoreId))
return Json(new DataSourceResult { Errors = _translationService.GetResource("Admin.Catalog.Products.Permisions") });
diff --git a/src/Web/Grand.Web.Admin/Controllers/ReportsController.cs b/src/Web/Grand.Web.Admin/Controllers/ReportsController.cs
index d09fded93..32798c515 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ReportsController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ReportsController.cs
@@ -99,18 +99,12 @@ namespace Grand.Web.Admin.Controllers
protected async Task<DataSourceResult> GetBestsellersBriefReportModel(int pageIndex,
int pageSize, int orderBy)
{
- //a vendor should have access only to his products
- var vendorId = "";
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- vendorId = _workContext.CurrentVendor.Id;
-
var storeId = "";
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
storeId = _workContext.CurrentCustomer.StaffStoreId;
var items = await _orderReportService.BestSellersReport(
storeId: storeId,
- vendorId: vendorId,
orderBy: orderBy,
pageIndex: pageIndex,
pageSize: pageSize,
@@ -198,10 +192,7 @@ namespace Grand.Web.Admin.Controllers
public async Task<IActionResult> BestsellersReport()
{
- var model = new BestsellersReportModel {
- //vendor
- IsLoggedInAsVendor = _workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer)
- };
+ var model = new BestsellersReportModel();
var storeId = "";
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
@@ -240,12 +231,6 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> BestsellersReportList(DataSourceRequest command, BestsellersReportModel model)
{
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- {
- model.VendorId = _workContext.CurrentVendor.Id;
- }
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
model.StoreId = _workContext.CurrentCustomer.StaffStoreId;
@@ -282,13 +267,8 @@ namespace Grand.Web.Admin.Controllers
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
- result.Add(m);
+
+ result.Add(m);
}
var gridModel = new DataSourceResult {
Data = result,
@@ -339,11 +319,6 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> NeverSoldReportList(DataSourceRequest command, NeverSoldReportModel model)
{
- //a vendor should have access only to his products
- var vendorId = "";
- if (_workContext.CurrentVendor != null)
- vendorId = _workContext.CurrentVendor.Id;
-
DateTime? startDateValue = model.StartDate == null ? null
: _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
@@ -354,7 +329,7 @@ namespace Grand.Web.Admin.Controllers
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
storeId = _workContext.CurrentCustomer.StaffStoreId;
- var items = await _orderReportService.ProductsNeverSold(storeId, vendorId,
+ var items = await _orderReportService.ProductsNeverSold(storeId, "",
startDateValue, endDateValue,
command.Page - 1, command.PageSize, true);
var gridModel = new DataSourceResult {
@@ -375,10 +350,6 @@ namespace Grand.Web.Admin.Controllers
if (!await _permissionService.Authorize(StandardPermission.ManageOrders))
return Content("");
- //a vendor does have access to this report
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Content("");
-
var storeId = "";
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
storeId = _workContext.CurrentCustomer.StaffStoreId;
@@ -417,11 +388,6 @@ namespace Grand.Web.Admin.Controllers
{
if (!await _permissionService.Authorize(StandardPermission.ManageOrders))
return Content("");
-
- //a vendor does have access to this report
- if (_workContext.CurrentVendor != null)
- return Content("");
-
var storeId = "";
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
storeId = _workContext.CurrentCustomer.StaffStoreId;
@@ -466,10 +432,6 @@ namespace Grand.Web.Admin.Controllers
if (!await _permissionService.Authorize(StandardPermission.ManageOrders))
return Content("");
- //a vendor does have access to this report
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Content("");
-
var storeId = "";
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
storeId = _workContext.CurrentCustomer.StaffStoreId;
@@ -580,16 +542,11 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> LowStockReportList(DataSourceRequest command)
{
- var vendorId = "";
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- vendorId = _workContext.CurrentVendor.Id;
-
var storeId = "";
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
storeId = _workContext.CurrentCustomer.StaffStoreId;
- var lowStockProducts = await _productsReportService.LowStockProducts(vendorId, storeId);
+ var lowStockProducts = await _productsReportService.LowStockProducts("", storeId);
var models = new List<LowStockProductModel>();
//products
diff --git a/src/Web/Grand.Web.Admin/Controllers/SearchController.cs b/src/Web/Grand.Web.Admin/Controllers/SearchController.cs
index 021b133d4..4d355ec7c 100644
--- a/src/Web/Grand.Web.Admin/Controllers/SearchController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/SearchController.cs
@@ -432,12 +432,12 @@ namespace Grand.Web.Admin.Controllers
var model = new List<SearchModel>();
if (!string.IsNullOrEmpty(vendorId))
{
- var currentVendor = await _vendorService.GetVendorById(vendorId);
- if (currentVendor != null)
+ var vendor = await _vendorService.GetVendorById(vendorId);
+ if (vendor != null)
{
model.Add(new SearchModel {
- Id = currentVendor.Id,
- Name = currentVendor.Name
+ Id = vendor.Id,
+ Name = vendor.Name
});
}
}
diff --git a/src/Web/Grand.Web.Admin/Controllers/ShipmentController.cs b/src/Web/Grand.Web.Admin/Controllers/ShipmentController.cs
index f1459718d..f4ff51b5d 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ShipmentController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ShipmentController.cs
@@ -71,10 +71,6 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> ShipmentListSelect(DataSourceRequest command, ShipmentListModel model)
{
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- model.VendorId = _workContext.CurrentVendor.Id;
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
model.StoreId = _workContext.CurrentCustomer.StaffStoreId;
@@ -102,11 +98,6 @@ namespace Grand.Web.Admin.Controllers
if (order == null)
throw new ArgumentException("No order found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !_workContext.HasAccessToOrder(order) &&
- !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Content("");
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer) &&
order.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
@@ -115,24 +106,11 @@ namespace Grand.Web.Admin.Controllers
//shipments
var shipmentModels = new List<ShipmentModel>();
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- {
- var shipments = (await _shipmentService.GetShipmentsByOrder(orderId))
- //a vendor should have access only to his products
- .Where(s => _workContext.CurrentVendor == null || _workContext.HasAccessToShipment(order, s))
- .OrderBy(s => s.CreatedOnUtc)
- .ToList();
- foreach (var shipment in shipments)
- shipmentModels.Add(await _shipmentViewModelService.PrepareShipmentModel(shipment, false));
- }
- else
- {
- var shipments = (await _shipmentService.GetShipmentsByOrder(orderId))
- .OrderBy(s => s.CreatedOnUtc)
- .ToList();
- foreach (var shipment in shipments)
- shipmentModels.Add(await _shipmentViewModelService.PrepareShipmentModel(shipment, false));
- }
+ var shipments = (await _shipmentService.GetShipmentsByOrder(orderId))
+ .OrderBy(s => s.CreatedOnUtc)
+ .ToList();
+ foreach (var shipment in shipments)
+ shipmentModels.Add(await _shipmentViewModelService.PrepareShipmentModel(shipment, false));
var gridModel = new DataSourceResult {
Data = shipmentModels,
@@ -153,11 +131,6 @@ namespace Grand.Web.Admin.Controllers
if (order == null)
throw new ArgumentException("No order found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !_workContext.HasAccessToOrder(order) &&
- !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return Content("");
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer) &&
shipment.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
@@ -182,11 +155,6 @@ namespace Grand.Web.Admin.Controllers
//No order found with the specified id
return RedirectToAction("List");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !_workContext.HasAccessToOrder(order) &&
- !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("List");
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer) &&
order.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
@@ -207,11 +175,6 @@ namespace Grand.Web.Admin.Controllers
//No order found with the specified id
return RedirectToAction("List");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !_workContext.HasAccessToOrder(order) &&
- !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("List");
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer) &&
order.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
@@ -219,11 +182,6 @@ namespace Grand.Web.Admin.Controllers
}
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();
- }
var sh = await _shipmentViewModelService.PrepareShipment(order, orderItems.ToList(), model);
if (sh.shipment == null)
@@ -285,11 +243,6 @@ namespace Grand.Web.Admin.Controllers
//No order found with the specified id
return RedirectToAction("List");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !_workContext.HasAccessToShipment(order, shipment) &&
- !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("List");
-
var model = await _shipmentViewModelService.PrepareShipmentModel(shipment, true, true);
return View(model);
}
@@ -309,23 +262,12 @@ namespace Grand.Web.Admin.Controllers
return RedirectToAction("List");
}
- if (_workContext.CurrentVendor != null && _workContext.CurrentVendor.Id != shipment.VendorId)
- {
- Error(_translationService.GetResource("Admin.Orders.Shipments.VendorAccess"));
- return RedirectToAction("ShipmentDetails", new { id = shipment.Id });
- }
-
var orderId = shipment.OrderId;
var order = await _orderService.GetOrderById(orderId);
if (order == null)
//No order found with the specified id
return RedirectToAction("List");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !_workContext.HasAccessToShipment(order, shipment) &&
- !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("List");
-
//delete shipment
await _shipmentService.DeleteShipment(shipment);
@@ -360,22 +302,11 @@ namespace Grand.Web.Admin.Controllers
return RedirectToAction("List");
}
- if (_workContext.CurrentVendor != null && _workContext.CurrentVendor.Id != shipment.VendorId)
- {
- Error(_translationService.GetResource("Admin.Orders.Shipments.VendorAccess"));
- return RedirectToAction("ShipmentDetails", new { id = shipment.Id });
- }
-
var order = await _orderService.GetOrderById(shipment.OrderId);
if (order == null)
//No order found with the specified id
return RedirectToAction("List");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !_workContext.HasAccessToShipment(order, shipment) &&
- !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("List");
-
shipment.TrackingNumber = model.TrackingNumber;
await _shipmentService.UpdateShipment(shipment);
@@ -397,22 +328,11 @@ namespace Grand.Web.Admin.Controllers
return RedirectToAction("List");
}
- if (_workContext.CurrentVendor != null && _workContext.CurrentVendor.Id != shipment.VendorId)
- {
- Error(_translationService.GetResource("Admin.Orders.Shipments.VendorAccess"));
- return RedirectToAction("ShipmentDetails", new { id = shipment.Id });
- }
-
var order = await _orderService.GetOrderById(shipment.OrderId);
if (order == null)
//No order found with the specified id
return RedirectToAction("List");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !_workContext.HasAccessToShipment(order, shipment) &&
- !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("List");
-
shipment.AdminComment = model.AdminComment;
await _shipmentService.UpdateShipment(shipment);
@@ -434,22 +354,10 @@ namespace Grand.Web.Admin.Controllers
return RedirectToAction("List");
}
- if (_workContext.CurrentVendor != null && _workContext.CurrentVendor.Id != shipment.VendorId)
- {
- Error(_translationService.GetResource("Admin.Orders.Shipments.VendorAccess"));
- return RedirectToAction("ShipmentDetails", new { id = shipment.Id });
- }
-
var order = await _orderService.GetOrderById(shipment.OrderId);
if (order == null)
//No order found with the specified id
return RedirectToAction("List");
-
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !_workContext.HasAccessToShipment(order, shipment) &&
- !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("List");
-
try
{
await _mediator.Send(new ShipCommand { Shipment = shipment, NotifyCustomer = true });
@@ -478,22 +386,10 @@ namespace Grand.Web.Admin.Controllers
return RedirectToAction("List");
}
- if (_workContext.CurrentVendor != null && _workContext.CurrentVendor.Id != shipment.VendorId)
- {
- Error(_translationService.GetResource("Admin.Orders.Shipments.VendorAccess"));
- return RedirectToAction("ShipmentDetails", new { id = shipment.Id });
- }
-
var order = await _orderService.GetOrderById(shipment.OrderId);
if (order == null)
//No order found with the specified id
return RedirectToAction("List");
-
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !_workContext.HasAccessToShipment(order, shipment) &&
- !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("List");
-
try
{
if (!model.ShippedDate.HasValue)
@@ -528,22 +424,11 @@ namespace Grand.Web.Admin.Controllers
return RedirectToAction("List");
}
- if (_workContext.CurrentVendor != null && _workContext.CurrentVendor.Id != shipment.VendorId)
- {
- Error(_translationService.GetResource("Admin.Orders.Shipments.VendorAccess"));
- return RedirectToAction("ShipmentDetails", new { id = shipment.Id });
- }
-
var order = await _orderService.GetOrderById(shipment.OrderId);
if (order == null)
//No order found with the specified id
return RedirectToAction("List");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !_workContext.HasAccessToShipment(order, shipment) &&
- !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("List");
-
try
{
await _mediator.Send(new DeliveryCommand { Shipment = shipment, NotifyCustomer = true });
@@ -573,22 +458,11 @@ namespace Grand.Web.Admin.Controllers
return RedirectToAction("List");
}
- if (_workContext.CurrentVendor != null && _workContext.CurrentVendor.Id != shipment.VendorId)
- {
- Error(_translationService.GetResource("Admin.Orders.Shipments.VendorAccess"));
- return RedirectToAction("ShipmentDetails", new { id = shipment.Id });
- }
-
var order = await _orderService.GetOrderById(shipment.OrderId);
if (order == null)
//No order found with the specified id
return RedirectToAction("List");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !_workContext.HasAccessToShipment(order, shipment) &&
- !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("List");
-
try
{
if (!model.DeliveryDate.HasValue)
@@ -617,22 +491,12 @@ namespace Grand.Web.Admin.Controllers
//No order found with the specified id
return RedirectToAction("List");
- //a vendor does not have access to this functionality
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("ShipmentDetails", new { id = shipment.Id });
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer) &&
shipment.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
return RedirectToAction("ShipmentDetails", new { id = shipment.Id });
}
- if (_workContext.CurrentVendor != null && _workContext.CurrentVendor.Id != shipment.VendorId)
- {
- Error(_translationService.GetResource("Admin.Orders.Shipments.VendorAccess"));
- return RedirectToAction("ShipmentDetails", new { id = shipment.Id });
- }
-
shipment.UserFields = model.UserFields;
await _shipmentService.UpdateShipment(shipment);
@@ -661,11 +525,6 @@ namespace Grand.Web.Admin.Controllers
//No order found with the specified id
return RedirectToAction("List");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !_workContext.HasAccessToShipment(order, shipment) &&
- !await _groupService.IsStaff(_workContext.CurrentCustomer))
- return RedirectToAction("List");
-
var shipments = new List<Shipment> {
shipment
};
@@ -689,11 +548,6 @@ namespace Grand.Web.Admin.Controllers
model.StoreId = _workContext.CurrentCustomer.StaffStoreId;
}
- if (_workContext.CurrentVendor != null)
- {
- model.VendorId = _workContext.CurrentVendor.Id;
- }
-
//load shipments
var shipments = await _shipmentViewModelService.PrepareShipments(model, 1, 100);
@@ -730,27 +584,13 @@ namespace Grand.Web.Admin.Controllers
shipments.AddRange(await _shipmentService.GetShipmentsByIds(ids));
}
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
+ var storeId = "";
+ if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- foreach (var item in shipments)
- {
- var hasaccess = item.VendorId == _workContext.CurrentVendor.Id;
- if (hasaccess)
- shipments_access.Add(item);
- }
- }
- else
- {
- var storeId = "";
- if (await _groupService.IsStaff(_workContext.CurrentCustomer))
- {
- storeId = _workContext.CurrentCustomer.StaffStoreId;
- }
-
- shipments_access = shipments.Where(x => x.StoreId == storeId || string.IsNullOrEmpty(storeId)).ToList();
+ storeId = _workContext.CurrentCustomer.StaffStoreId;
}
+ shipments_access = shipments.Where(x => x.StoreId == storeId || string.IsNullOrEmpty(storeId)).ToList();
//ensure that we at least one shipment selected
if (shipments.Count == 0)
{
@@ -779,27 +619,13 @@ namespace Grand.Web.Admin.Controllers
shipments.AddRange(await _shipmentService.GetShipmentsByIds(selectedIds.ToArray()));
}
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- {
- foreach (var item in shipments)
- {
- var hasaccess = item.VendorId == _workContext.CurrentVendor.Id;
- if (hasaccess)
- shipments_access.Add(item);
- }
- }
- else
+ var storeId = "";
+ if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- var storeId = "";
- if (await _groupService.IsStaff(_workContext.CurrentCustomer))
- {
- storeId = _workContext.CurrentCustomer.StaffStoreId;
- }
-
- shipments_access = shipments.Where(x => x.StoreId == storeId || string.IsNullOrEmpty(storeId)).ToList();
+ storeId = _workContext.CurrentCustomer.StaffStoreId;
}
+ shipments_access = shipments.Where(x => x.StoreId == storeId || string.IsNullOrEmpty(storeId)).ToList();
foreach (var shipment in shipments_access)
{
try
@@ -826,27 +652,12 @@ namespace Grand.Web.Admin.Controllers
shipments.AddRange(await _shipmentService.GetShipmentsByIds(selectedIds.ToArray()));
}
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- {
- foreach (var item in shipments)
- {
- var hasaccess = item.VendorId == _workContext.CurrentVendor.Id;
- if (hasaccess)
- shipments_access.Add(item);
- }
- }
- else
+ var storeId = "";
+ if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- var storeId = "";
- if (await _groupService.IsStaff(_workContext.CurrentCustomer))
- {
- storeId = _workContext.CurrentCustomer.StaffStoreId;
- }
-
- shipments_access = shipments.Where(x => x.StoreId == storeId || string.IsNullOrEmpty(storeId)).ToList();
+ storeId = _workContext.CurrentCustomer.StaffStoreId;
}
-
+ shipments_access = shipments.Where(x => x.StoreId == storeId || string.IsNullOrEmpty(storeId)).ToList();
foreach (var shipment in shipments_access)
{
try
@@ -872,9 +683,6 @@ namespace Grand.Web.Admin.Controllers
if (shipment == null)
throw new ArgumentException("No shipment found with the specified id");
- if (_workContext.CurrentVendor != null && _workContext.CurrentVendor.Id != shipment.VendorId)
- return Json(new DataSourceResult());
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer) &&
shipment.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
@@ -898,9 +706,6 @@ namespace Grand.Web.Admin.Controllers
if (shipment == null)
return Json(new { Result = false });
- if (_workContext.CurrentVendor != null && _workContext.CurrentVendor.Id != shipment.VendorId)
- return Json(new { Result = false });
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer) &&
shipment.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
@@ -920,9 +725,6 @@ namespace Grand.Web.Admin.Controllers
if (shipment == null)
throw new ArgumentException("No shipment found with the specified id");
- if (_workContext.CurrentVendor != null && _workContext.CurrentVendor.Id != shipment.VendorId)
- return Json(new { Result = false });
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer) &&
shipment.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/SpecificationAttributeController.cs b/src/Web/Grand.Web.Admin/Controllers/SpecificationAttributeController.cs
index 11f6cbcb0..bf5d4ec55 100644
--- a/src/Web/Grand.Web.Admin/Controllers/SpecificationAttributeController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/SpecificationAttributeController.cs
@@ -347,13 +347,6 @@ namespace Grand.Web.Admin.Controllers
if (!string.IsNullOrEmpty(_workContext.CurrentCustomer.StaffStoreId))
searchStoreId = _workContext.CurrentCustomer.StaffStoreId;
- var searchVendorId = string.Empty;
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- {
- searchVendorId = _workContext.CurrentVendor.Id;
- }
-
var specificationProducts = new List<SpecificationAttributeModel.UsedByProductModel>();
var total = 0;
@@ -362,7 +355,6 @@ namespace Grand.Web.Admin.Controllers
{
var products = (await _productService.SearchProducts(
storeId: searchStoreId,
- vendorId: searchVendorId,
specificationOptions: searchspecificationOptions,
pageIndex: command.Page - 1,
pageSize: command.PageSize,
diff --git a/src/Web/Grand.Web.Admin/Controllers/VendorController.cs b/src/Web/Grand.Web.Admin/Controllers/VendorController.cs
index ee19f2808..72f491c2d 100644
--- a/src/Web/Grand.Web.Admin/Controllers/VendorController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/VendorController.cs
@@ -282,10 +282,6 @@ namespace Grand.Web.Admin.Controllers
if (vendor == null)
throw new ArgumentException("No vendor found with the specified id");
- //a vendor should have access only to his own profile
- if (workContext.CurrentVendor != null && vendor.Id != workContext.CurrentVendor.Id)
- return Content("This is not your vendor");
-
var vendorReviews = await _vendorService.GetAllVendorReviews("", null,
null, null, "", vendorId, command.Page - 1, command.PageSize);
var items = new List<VendorReviewModel>();
diff --git a/src/Web/Grand.Web.Admin/Controllers/VendorReviewController.cs b/src/Web/Grand.Web.Admin/Controllers/VendorReviewController.cs
index c51639b65..d91a33f5c 100644
--- a/src/Web/Grand.Web.Admin/Controllers/VendorReviewController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/VendorReviewController.cs
@@ -58,19 +58,6 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> List(DataSourceRequest command, VendorReviewListModel model)
{
- var vendorId = string.Empty;
- //vendor
- if (_workContext.CurrentVendor != null)
- {
- vendorId = _workContext.CurrentVendor.Id;
- }
- //admin
- else if (await _groupService.IsAdmin(_workContext.CurrentCustomer))
- {
- vendorId = model.SearchVendorId;
- }
-
- model.SearchVendorId = vendorId;
var (vendorReviewModels, totalCount) = await _vendorViewModelService.PrepareVendorReviewModel(model, command.Page, command.PageSize);
var gridModel = new DataSourceResult {
Data = vendorReviewModels.ToList(),
diff --git a/src/Web/Grand.Web.Admin/Extensions/HasAccess.cs b/src/Web/Grand.Web.Admin/Extensions/HasAccess.cs
deleted file mode 100644
index b97698649..000000000
--- a/src/Web/Grand.Web.Admin/Extensions/HasAccess.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-using Grand.Infrastructure;
-using Grand.Domain.Catalog;
-using Grand.Domain.Orders;
-using Grand.Domain.Shipping;
-
-namespace Grand.Web.Admin.Extensions
-{
- public static class HasAccess
- {
- public static bool HasAccessToProduct(this IWorkContext _workContext, Product product)
- {
- if (product == null)
- throw new ArgumentNullException(nameof(product));
-
- if (_workContext.CurrentVendor == null)
- //not a vendor; has access
- return true;
-
- var vendorId = _workContext.CurrentVendor.Id;
- return product.VendorId == vendorId;
- }
-
- public static bool HasAccessToOrder(this IWorkContext _workContext,Order order)
- {
- if (order == null)
- throw new ArgumentNullException(nameof(order));
-
- if (_workContext.CurrentVendor == null)
- //not a vendor; has access
- return true;
-
- var vendorId = _workContext.CurrentVendor.Id;
- var hasVendorProducts = order.OrderItems.Any(orderItem => orderItem.VendorId == vendorId);
- return hasVendorProducts;
- }
-
- public static bool HasAccessToOrderItem(this IWorkContext _workContext, OrderItem orderItem)
- {
- if (orderItem == null)
- throw new ArgumentNullException(nameof(orderItem));
-
- if (_workContext.CurrentVendor == null)
- //not a vendor; has access
- return true;
-
- var vendorId = _workContext.CurrentVendor.Id;
- return orderItem.VendorId == vendorId;
- }
- public static bool HasAccessToShipment(this IWorkContext _workContext, Order order, Shipment shipment)
- {
- if (shipment == null)
- throw new ArgumentNullException(nameof(shipment));
-
- if (_workContext.CurrentVendor == null)
- //not a vendor; has access
- return true;
-
- var hasVendorProducts = false;
- var vendorId = _workContext.CurrentVendor.Id;
- foreach (var shipmentItem in shipment.ShipmentItems)
- {
- var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == shipmentItem.OrderItemId);
- if (orderItem != null)
- {
- if (orderItem.VendorId == vendorId)
- {
- hasVendorProducts = true;
- break;
- }
- }
- }
- return hasVendorProducts;
- }
- }
-}
diff --git a/src/Web/Grand.Web.Admin/Interfaces/ICustomerViewModelService.cs b/src/Web/Grand.Web.Admin/Interfaces/ICustomerViewModelService.cs
index b7077cad6..13612040b 100644
--- a/src/Web/Grand.Web.Admin/Interfaces/ICustomerViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Interfaces/ICustomerViewModelService.cs
@@ -40,7 +40,7 @@ namespace Grand.Web.Admin.Interfaces
Task UpdatePersonalizedProduct(CustomerModel.ProductModel model);
Task DeletePersonalizedProduct(string id);
Task<(IEnumerable<CustomerModel.ActivityLogModel> activityLogModels, int totalCount)> PrepareActivityLogModel(string customerId, int pageIndex, int pageSize);
- Task<(IEnumerable<ContactFormModel> contactFormModels, int totalCount)> PrepareContactFormModel(string customerId, string vendorId, int pageIndex, int pageSize);
+ Task<(IEnumerable<ContactFormModel> contactFormModels, int totalCount)> PrepareContactFormModel(string customerId, int pageIndex, int pageSize);
Task<(IEnumerable<CustomerModel.OutOfStockSubscriptionModel> outOfStockSubscriptionModels, int totalCount)> PrepareOutOfStockSubscriptionModel(string customerId, int pageIndex, int pageSize);
Task<IList<CustomerModel.CustomerNote>> PrepareCustomerNoteList(string customerId);
Task<CustomerNote> InsertCustomerNote(string customerId, string downloadId, bool displayToCustomer, string title, string message);
diff --git a/src/Web/Grand.Web.Admin/Mapper/ProductProfile.cs b/src/Web/Grand.Web.Admin/Mapper/ProductProfile.cs
index 762f16faa..68082339b 100644
--- a/src/Web/Grand.Web.Admin/Mapper/ProductProfile.cs
+++ b/src/Web/Grand.Web.Admin/Mapper/ProductProfile.cs
@@ -26,7 +26,6 @@ namespace Grand.Web.Admin.Mapper
.ForMember(dest => dest.ProductPictureModels, mo => mo.Ignore())
.ForMember(dest => dest.CopyProductModel, mo => mo.Ignore())
.ForMember(dest => dest.ProductWarehouseInventoryModels, mo => mo.Ignore())
- .ForMember(dest => dest.IsLoggedInAsVendor, 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())
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/ProductListModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/ProductListModel.cs
index ad60d9480..47722acac 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/ProductListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/ProductListModel.cs
@@ -46,8 +46,6 @@ namespace Grand.Web.Admin.Models.Catalog
public string GoDirectlyToSku { get; set; }
- public bool IsLoggedInAsVendor { get; set; }
-
public IList<SelectListItem> AvailableStores { get; set; }
public IList<SelectListItem> AvailableWarehouses { get; set; }
public IList<SelectListItem> AvailableProductTypes { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/ProductModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/ProductModel.cs
index 38b5bee1b..4090cb33c 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/ProductModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/ProductModel.cs
@@ -388,9 +388,6 @@ namespace Grand.Web.Admin.Models.Catalog
[UIHint("Stores")]
public string[] Stores { get; set; }
- //vendor
- public bool IsLoggedInAsVendor { get; set; }
-
//product attributes
public IList<SelectListItem> AvailableProductAttributes { get; set; }
@@ -442,12 +439,7 @@ namespace Grand.Web.Admin.Models.Catalog
public IList<SelectListItem> AvailableStores { get; set; }
public IList<SelectListItem> AvailableVendors { get; set; }
public IList<SelectListItem> AvailableProductTypes { get; set; }
-
- //vendor
- public bool IsLoggedInAsVendor { get; set; }
}
-
-
public class AddRequiredProductModel : AddProductModel
{
diff --git a/src/Web/Grand.Web.Admin/Models/Courses/CourseModel.cs b/src/Web/Grand.Web.Admin/Models/Courses/CourseModel.cs
index 844246eb5..7ad4932c5 100644
--- a/src/Web/Grand.Web.Admin/Models/Courses/CourseModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Courses/CourseModel.cs
@@ -102,11 +102,6 @@ namespace Grand.Web.Admin.Models.Courses
public IList<SelectListItem> AvailableStores { get; set; }
public IList<SelectListItem> AvailableVendors { get; set; }
public IList<SelectListItem> AvailableProductTypes { get; set; }
-
- //vendor
- public bool IsLoggedInAsVendor { get; set; }
-
-
public string AssociatedToProductId { get; set; }
}
#endregion
diff --git a/src/Web/Grand.Web.Admin/Models/Home/DashboardModel.cs b/src/Web/Grand.Web.Admin/Models/Home/DashboardModel.cs
index c620b2b3e..b55bb3f37 100644
--- a/src/Web/Grand.Web.Admin/Models/Home/DashboardModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Home/DashboardModel.cs
@@ -4,7 +4,7 @@ namespace Grand.Web.Admin.Models.Home
{
public class DashboardModel : BaseModel
{
- public bool IsLoggedInAsVendor { get; set; }
+
}
public class DashboardActivityModel : BaseModel
{
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/BestsellersReportModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/BestsellersReportModel.cs
index 3adde294f..cb2b84055 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/BestsellersReportModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/BestsellersReportModel.cs
@@ -44,6 +44,5 @@ namespace Grand.Web.Admin.Models.Orders
public IList<SelectListItem> AvailablePaymentStatuses { get; set; }
public IList<SelectListItem> AvailableCountries { get; set; }
public IList<SelectListItem> AvailableVendors { get; set; }
- public bool IsLoggedInAsVendor { get; set; }
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/OrderListModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/OrderListModel.cs
index ababb5fdb..286a11032 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/OrderListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/OrderListModel.cs
@@ -75,8 +75,6 @@ namespace Grand.Web.Admin.Models.Orders
public string GoDirectlyToNumber { get; set; }
- public bool IsLoggedInAsVendor { get; set; }
-
[GrandResourceDisplayName("Admin.Orders.List.OrderTagId")]
public string OrderTag { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/OrderModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/OrderModel.cs
index de4d37c64..cbb0f545f 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/OrderModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/OrderModel.cs
@@ -21,8 +21,6 @@ namespace Grand.Web.Admin.Models.Orders
OrderStatuses = new List<SelectListItem>();
}
- public bool IsLoggedInAsVendor { get; set; }
-
//identifiers
[GrandResourceDisplayName("Admin.Orders.Fields.ID")]
public override string Id { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Services/ContactFormViewModelService.cs b/src/Web/Grand.Web.Admin/Services/ContactFormViewModelService.cs
index 8b0fbb549..e9fc71387 100644
--- a/src/Web/Grand.Web.Admin/Services/ContactFormViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/ContactFormViewModelService.cs
@@ -55,18 +55,11 @@ namespace Grand.Web.Admin.Services
DateTime? endDateValue = model.SearchEndDate == null ? null
: _dateTimeService.ConvertToUtcTime(model.SearchEndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
- var vendorId = "";
- if (_workContext.CurrentVendor != null)
- {
- vendorId = _workContext.CurrentVendor.Id;
- }
-
var contactform = await _contactUsService.GetAllContactUs(
fromUtc: startDateValue,
toUtc: endDateValue,
email: model.SearchEmail,
storeId: model.StoreId,
- vendorId: vendorId,
pageIndex: pageIndex - 1,
pageSize: pageSize);
var contactformmodelList = new List<ContactFormModel>();
diff --git a/src/Web/Grand.Web.Admin/Services/CourseViewModelService.cs b/src/Web/Grand.Web.Admin/Services/CourseViewModelService.cs
index 86d14f4d6..86af2c526 100644
--- a/src/Web/Grand.Web.Admin/Services/CourseViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/CourseViewModelService.cs
@@ -279,10 +279,6 @@ namespace Grand.Web.Admin.Services
public virtual async Task<CourseModel.AssociateProductToCourseModel> PrepareAssociateProductToCourseModel()
{
var model = new CourseModel.AssociateProductToCourseModel();
- //a vendor should have access only to his products
- var workContext = _serviceProvider.GetRequiredService<IWorkContext>();
- model.IsLoggedInAsVendor = workContext.CurrentVendor != null;
-
//stores
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
var storeService = _serviceProvider.GetRequiredService<IStoreService>();
diff --git a/src/Web/Grand.Web.Admin/Services/CustomerViewModelService.cs b/src/Web/Grand.Web.Admin/Services/CustomerViewModelService.cs
index 9763b3008..8540f0ac5 100644
--- a/src/Web/Grand.Web.Admin/Services/CustomerViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/CustomerViewModelService.cs
@@ -1300,10 +1300,10 @@ namespace Grand.Web.Admin.Services
}
return (items, activityLog.TotalCount);
}
- public virtual async Task<(IEnumerable<ContactFormModel> contactFormModels, int totalCount)> PrepareContactFormModel(string customerId, string vendorId, int pageIndex, int pageSize)
+ public virtual async Task<(IEnumerable<ContactFormModel> contactFormModels, int totalCount)> PrepareContactFormModel(string customerId, int pageIndex, int pageSize)
{
var contactUsService = _serviceProvider.GetRequiredService<IContactUsService>();
- var contactform = await contactUsService.GetAllContactUs(storeId: "", vendorId: vendorId, customerId: customerId, pageIndex: pageIndex - 1, pageSize: pageSize);
+ var contactform = await contactUsService.GetAllContactUs(storeId: "", vendorId: "", customerId: customerId, pageIndex: pageIndex - 1, pageSize: pageSize);
var items = new List<ContactFormModel>();
foreach (var x in contactform)
{
diff --git a/src/Web/Grand.Web.Admin/Services/MerchandiseReturnViewModelService.cs b/src/Web/Grand.Web.Admin/Services/MerchandiseReturnViewModelService.cs
index 1326e11e4..216ed4044 100644
--- a/src/Web/Grand.Web.Admin/Services/MerchandiseReturnViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/MerchandiseReturnViewModelService.cs
@@ -158,7 +158,7 @@ namespace Grand.Web.Admin.Services
var merchandiseReturns = await _merchandiseReturnService.SearchMerchandiseReturns(model.StoreId,
customerId,
"",
- _workContext.CurrentVendor?.Id,
+ "",
"",
model.SearchMerchandiseReturnStatusId >= 0 ? (MerchandiseReturnStatus?)model.SearchMerchandiseReturnStatusId : null,
pageIndex - 1,
diff --git a/src/Web/Grand.Web.Admin/Services/OrderViewModelService.cs b/src/Web/Grand.Web.Admin/Services/OrderViewModelService.cs
index fc1cea576..b860ff6d2 100644
--- a/src/Web/Grand.Web.Admin/Services/OrderViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/OrderViewModelService.cs
@@ -273,9 +273,6 @@ namespace Grand.Web.Admin.Services
model.AvailableCountries.Insert(0,
new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
- //a vendor should have access only to orders with his products
- model.IsLoggedInAsVendor = _workContext.CurrentVendor != null &&
- !await _groupService.IsStaff(_workContext.CurrentCustomer);
if (startDate.HasValue)
model.StartDate = startDate.Value;
@@ -304,7 +301,7 @@ namespace Grand.Web.Admin.Services
var filterByProductId = "";
var product = await _productService.GetProductById(model.ProductId);
- if (product != null && _workContext.HasAccessToProduct(product))
+ if (product != null)
filterByProductId = model.ProductId;
var salesEmployeeId = _workContext.CurrentCustomer.SeId;
@@ -421,11 +418,7 @@ namespace Grand.Web.Admin.Services
model.SalesEmployeeName = salesEmployee.Name;
}
}
-
- //a vendor should have access only to his products
- model.IsLoggedInAsVendor = _workContext.CurrentVendor != null &&
- !await _groupService.IsStaff(_workContext.CurrentCustomer);
-
+
//order's tags
if (order.OrderTags.Any())
{
@@ -526,7 +519,8 @@ namespace Grand.Web.Admin.Services
if (order.RedeemedLoyaltyPoints > 0)
{
model.RedeemedLoyaltyPoints = order.RedeemedLoyaltyPoints;
- model.RedeemedLoyaltyPointsAmount = _priceFormatter.FormatPrice(-order.RedeemedLoyaltyPointsAmount, orderCurrency);
+ model.RedeemedLoyaltyPointsAmount =
+ _priceFormatter.FormatPrice(-order.RedeemedLoyaltyPointsAmount, orderCurrency);
}
//total
@@ -557,47 +551,55 @@ namespace Grand.Web.Admin.Services
}
}
- //profit (not for vendors)
- if (_workContext.CurrentVendor == null)
+ //profit
+ var productCost = order.OrderItems.Sum(orderItem => orderItem.OriginalProductCost * orderItem.Quantity);
+ if (order.CurrencyRate > 0)
{
- var productCost = order.OrderItems.Sum(orderItem => orderItem.OriginalProductCost * orderItem.Quantity);
- if (order.CurrencyRate > 0)
- {
- var profit = Convert.ToDouble(order.OrderTotal / order.CurrencyRate -
- order.OrderShippingExclTax / order.CurrencyRate -
- order.OrderTax / order.CurrencyRate - productCost);
- model.Profit = _priceFormatter.FormatPrice(profit, primaryStoreCurrency);
- }
+ var profit = Convert.ToDouble(order.OrderTotal / order.CurrencyRate -
+ order.OrderShippingExclTax / order.CurrencyRate -
+ order.OrderTax / order.CurrencyRate - productCost);
+ model.Profit = _priceFormatter.FormatPrice(profit, primaryStoreCurrency);
}
if (order.PrimaryCurrencyCode != order.CustomerCurrencyCode)
{
- model.OrderTotal += $" ({_priceFormatter.FormatPrice(order.OrderTotal / order.CurrencyRate, primaryStoreCurrency)})";
- model.OrderSubtotalInclTax += $" ({_priceFormatter.FormatPrice(order.OrderSubtotalInclTax / order.CurrencyRate, primaryStoreCurrency)})";
- model.OrderSubtotalExclTax += $" ({_priceFormatter.FormatPrice(order.OrderSubtotalExclTax / order.CurrencyRate, primaryStoreCurrency)})";
+ model.OrderTotal +=
+ $" ({_priceFormatter.FormatPrice(order.OrderTotal / order.CurrencyRate, primaryStoreCurrency)})";
+ model.OrderSubtotalInclTax +=
+ $" ({_priceFormatter.FormatPrice(order.OrderSubtotalInclTax / order.CurrencyRate, primaryStoreCurrency)})";
+ model.OrderSubtotalExclTax +=
+ $" ({_priceFormatter.FormatPrice(order.OrderSubtotalExclTax / order.CurrencyRate, primaryStoreCurrency)})";
//discount (applied to order subtotal)
if (order.OrderSubTotalDiscountInclTax > 0)
- model.OrderSubTotalDiscountInclTax += $" ({_priceFormatter.FormatPrice(order.OrderSubTotalDiscountInclTax / order.CurrencyRate, primaryStoreCurrency)})";
+ model.OrderSubTotalDiscountInclTax +=
+ $" ({_priceFormatter.FormatPrice(order.OrderSubTotalDiscountInclTax / order.CurrencyRate, primaryStoreCurrency)})";
if (order.OrderSubTotalDiscountExclTax > 0)
- model.OrderSubTotalDiscountExclTax += $" ({_priceFormatter.FormatPrice(order.OrderSubTotalDiscountExclTax / order.CurrencyRate, primaryStoreCurrency)})";
+ model.OrderSubTotalDiscountExclTax +=
+ $" ({_priceFormatter.FormatPrice(order.OrderSubTotalDiscountExclTax / order.CurrencyRate, primaryStoreCurrency)})";
//shipping
- model.OrderShippingInclTax += $" ({_priceFormatter.FormatPrice(order.OrderShippingInclTax / order.CurrencyRate, primaryStoreCurrency)})";
- model.OrderShippingExclTax += $" ({_priceFormatter.FormatPrice(order.OrderShippingExclTax / order.CurrencyRate, primaryStoreCurrency)})";
+ model.OrderShippingInclTax +=
+ $" ({_priceFormatter.FormatPrice(order.OrderShippingInclTax / order.CurrencyRate, primaryStoreCurrency)})";
+ model.OrderShippingExclTax +=
+ $" ({_priceFormatter.FormatPrice(order.OrderShippingExclTax / order.CurrencyRate, primaryStoreCurrency)})";
//payment method additional fee
if (order.PaymentMethodAdditionalFeeInclTax > 0)
{
- model.PaymentMethodAdditionalFeeInclTax += $" ({_priceFormatter.FormatPrice(order.PaymentMethodAdditionalFeeInclTax / order.CurrencyRate, primaryStoreCurrency)})";
- model.PaymentMethodAdditionalFeeExclTax += $" ({_priceFormatter.FormatPrice(order.PaymentMethodAdditionalFeeExclTax / order.CurrencyRate, primaryStoreCurrency)})";
+ model.PaymentMethodAdditionalFeeInclTax +=
+ $" ({_priceFormatter.FormatPrice(order.PaymentMethodAdditionalFeeInclTax / order.CurrencyRate, primaryStoreCurrency)})";
+ model.PaymentMethodAdditionalFeeExclTax +=
+ $" ({_priceFormatter.FormatPrice(order.PaymentMethodAdditionalFeeExclTax / order.CurrencyRate, primaryStoreCurrency)})";
}
- model.Tax += $" ({_priceFormatter.FormatPrice(order.OrderTax / order.CurrencyRate, primaryStoreCurrency)})";
+ model.Tax +=
+ $" ({_priceFormatter.FormatPrice(order.OrderTax / order.CurrencyRate, primaryStoreCurrency)})";
//refunded amount
if (order.RefundedAmount > 0)
- model.RefundedAmount += $" ({_priceFormatter.FormatPrice(order.RefundedAmount / order.CurrencyRate, primaryStoreCurrency)})";
+ model.RefundedAmount +=
+ $" ({_priceFormatter.FormatPrice(order.RefundedAmount / order.CurrencyRate, primaryStoreCurrency)})";
}
#endregion
@@ -731,14 +733,6 @@ namespace Grand.Web.Admin.Services
model.CheckoutAttributeInfo = order.CheckoutAttributeDescription;
var hasDownloadableItems = false;
var products = order.OrderItems;
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
- {
- products = products
- .Where(orderItem => orderItem.VendorId == _workContext.CurrentVendor.Id)
- .ToList();
- }
-
foreach (var orderItem in products)
{
var product = await _productService.GetProductByIdIncludeArch(orderItem.ProductId);
@@ -785,13 +779,17 @@ namespace Grand.Web.Admin.Services
//unit price
orderItemModel.UnitPriceInclTaxValue = orderItem.UnitPriceInclTax;
orderItemModel.UnitPriceExclTaxValue = orderItem.UnitPriceExclTax;
- orderItemModel.UnitPriceInclTax = _priceFormatter.FormatPrice(orderItem.UnitPriceInclTax, orderCurrency);
- orderItemModel.UnitPriceExclTax = _priceFormatter.FormatPrice(orderItem.UnitPriceExclTax, orderCurrency);
+ 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);
+ orderItemModel.DiscountInclTax =
+ _priceFormatter.FormatPrice(orderItem.DiscountAmountInclTax, orderCurrency);
+ orderItemModel.DiscountExclTax =
+ _priceFormatter.FormatPrice(orderItem.DiscountAmountExclTax, orderCurrency);
//subtotal
orderItemModel.SubTotalInclTaxValue = orderItem.PriceInclTax;
orderItemModel.SubTotalExclTaxValue = orderItem.PriceExclTax;
@@ -800,12 +798,18 @@ namespace Grand.Web.Admin.Services
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)})";
+ 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
@@ -1259,7 +1263,7 @@ namespace Grand.Web.Admin.Services
var filterByProductId = "";
var product = await _productService.GetProductById(model.ProductId);
- if (product != null && _workContext.HasAccessToProduct(product))
+ if (product != null)
filterByProductId = model.ProductId;
var salesEmployeeId = _workContext.CurrentCustomer.SeId;
diff --git a/src/Web/Grand.Web.Admin/Services/ProductViewModelService.cs b/src/Web/Grand.Web.Admin/Services/ProductViewModelService.cs
index ba93ddb18..687c7b329 100644
--- a/src/Web/Grand.Web.Admin/Services/ProductViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/ProductViewModelService.cs
@@ -244,10 +244,7 @@ namespace Grand.Web.Admin.Services
protected virtual async Task<T> PrepareAddProductModel<T>() where T : ProductModel.AddProductModel, new()
{
- var model = new T {
- //a vendor should have access only to his products
- IsLoggedInAsVendor = _workContext.CurrentVendor != null
- };
+ var model = new T();
var storeId = _workContext.CurrentCustomer.StaffStoreId;
@@ -508,9 +505,6 @@ namespace Grand.Web.Admin.Services
});
}
- //vendors
- model.IsLoggedInAsVendor = _workContext.CurrentVendor != null;
-
//delivery dates
model.AvailableDeliveryDates.Add(new SelectListItem {
Text = _translationService.GetResource("Admin.Catalog.Products.Fields.DeliveryDate.None"),
@@ -625,10 +619,6 @@ namespace Grand.Web.Admin.Services
model.Published = true;
model.VisibleIndividually = true;
}
- if (_workContext.CurrentVendor != null && !string.IsNullOrEmpty(_workContext.CurrentVendor.StoreId))
- {
- model.Stores = new[] { _workContext.CurrentVendor.StoreId };
- }
}
public virtual async Task SaveProductWarehouseInventory(Product product, IList<ProductModel.ProductWarehouseInventoryModel> model)
@@ -722,10 +712,7 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task<ProductListModel> PrepareProductListModel()
{
- var model = new ProductListModel {
- //a vendor should have access only to his products
- IsLoggedInAsVendor = _workContext.CurrentVendor != null
- };
+ var model = new ProductListModel();
var storeId = _workContext.CurrentCustomer.StaffStoreId;
@@ -733,13 +720,7 @@ namespace Grand.Web.Admin.Services
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var s in (await _storeService.GetAllStores()).Where(x => x.Id == storeId || string.IsNullOrWhiteSpace(storeId)))
{
- if (_workContext.CurrentVendor != null && !string.IsNullOrEmpty(_workContext.CurrentVendor.StoreId))
- {
- if (s.Id == _workContext.CurrentVendor.StoreId)
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
- }
- else
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
}
//warehouses
model.AvailableWarehouses.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
@@ -766,12 +747,6 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task<(IEnumerable<ProductModel> productModels, int totalCount)> PrepareProductsModel(ProductListModel model, int pageIndex, int pageSize)
{
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- {
- model.SearchVendorId = _workContext.CurrentVendor.Id;
- }
-
//limit for store manager
if (!string.IsNullOrEmpty(_workContext.CurrentCustomer.StaffStoreId))
model.SearchStoreId = _workContext.CurrentCustomer.StaffStoreId;
@@ -844,11 +819,6 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task<IList<Product>> PrepareProducts(ProductListModel model)
{
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- {
- model.SearchVendorId = _workContext.CurrentVendor.Id;
- }
//limit for store manager
model.SearchStoreId = _workContext.CurrentCustomer.StaffStoreId;
@@ -891,28 +861,12 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task<Product> InsertProductModel(ProductModel model)
{
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- {
- model.VendorId = _workContext.CurrentVendor.Id;
- if (!string.IsNullOrEmpty(_workContext.CurrentVendor.StoreId))
- {
- model.Stores = new[] { _workContext.CurrentVendor.StoreId };
- }
- }
//a staff should have access only to his products
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };
}
-
- //vendors cannot edit "Show on home page" property
- if (_workContext.CurrentVendor != null && (model.ShowOnHomePage || model.BestSeller))
- {
- model.ShowOnHomePage = false;
- model.BestSeller = false;
- }
-
+
//product
var product = model.ToEntity(_dateTimeService);
product.CreatedOnUtc = DateTime.UtcNow;
@@ -951,26 +905,6 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task<Product> UpdateProductModel(Product product, ProductModel model)
{
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- {
- model.VendorId = _workContext.CurrentVendor.Id;
- if (!string.IsNullOrEmpty(_workContext.CurrentVendor.StoreId))
- {
- model.Stores = new[] { _workContext.CurrentVendor.StoreId };
- }
- }
- //vendors cannot edit "Show on home page" property
- if (_workContext.CurrentVendor != null && model.ShowOnHomePage != product.ShowOnHomePage)
- {
- model.ShowOnHomePage = product.ShowOnHomePage;
- }
- //vendors cannot edit "Best seller" property
- if (_workContext.CurrentVendor != null && model.BestSeller != product.BestSeller)
- {
- model.BestSeller = product.BestSeller;
- }
-
//a staff should have access only to his products
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
@@ -1077,10 +1011,6 @@ namespace Grand.Web.Admin.Services
for (var i = 0; i < products.Count; i++)
{
var product = products[i];
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id)
- continue;
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
if (!(product.LimitedToStores && product.Stores.Contains(_workContext.CurrentCustomer.StaffStoreId) && product.Stores.Count == 1))
@@ -1096,11 +1026,6 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task<(IList<ProductModel> products, int totalCount)> PrepareProductModel(ProductModel.AddProductModel model, int pageIndex, int pageSize)
{
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- {
- model.SearchVendorId = _workContext.CurrentVendor.Id;
- }
//limit for store manager
model.SearchStoreId = _workContext.CurrentCustomer.StaffStoreId;
@@ -1129,26 +1054,13 @@ namespace Grand.Web.Admin.Services
public virtual async Task InsertProductCategoryModel(ProductModel.ProductCategoryModel model)
{
var product = await _productService.GetProductById(model.ProductId, true);
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- {
- if (product != null && product.VendorId != _workContext.CurrentVendor.Id)
- {
- throw new ArgumentException("This is not your product");
- }
- }
-
if (product != null && product.ProductCategories.All(x => x.CategoryId != model.CategoryId))
{
var productCategory = new ProductCategory {
CategoryId = model.CategoryId,
- DisplayOrder = model.DisplayOrder
+ DisplayOrder = model.DisplayOrder,
+ IsFeaturedProduct = model.IsFeaturedProduct
};
- //a vendor cannot edit "IsFeaturedProduct" property
- if (_workContext.CurrentVendor == null)
- {
- productCategory.IsFeaturedProduct = model.IsFeaturedProduct;
- }
await _productCategoryService.InsertProductCategory(productCategory, product.Id);
}
}
@@ -1162,21 +1074,9 @@ namespace Grand.Web.Admin.Services
if (product.ProductCategories.Any(x => x.Id != model.Id && x.CategoryId == model.CategoryId))
throw new ArgumentException("This category is already mapped with this product");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- {
- if (product != null && product.VendorId != _workContext.CurrentVendor.Id)
- {
- throw new ArgumentException("This is not your product");
- }
- }
productCategory.CategoryId = model.CategoryId;
productCategory.DisplayOrder = model.DisplayOrder;
- //a vendor cannot edit "IsFeaturedProduct" property
- if (_workContext.CurrentVendor == null)
- {
- productCategory.IsFeaturedProduct = model.IsFeaturedProduct;
- }
+ productCategory.IsFeaturedProduct = model.IsFeaturedProduct;
await _productCategoryService.UpdateProductCategory(productCategory, product.Id);
}
public virtual async Task DeleteProductCategory(string id, string productId)
@@ -1186,14 +1086,6 @@ namespace Grand.Web.Admin.Services
if (productCategory == null)
throw new ArgumentException("No product category mapping found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- {
- if (product != null && product.VendorId != _workContext.CurrentVendor.Id)
- {
- throw new ArgumentException("This is not your product");
- }
- }
await _productCategoryService.DeleteProductCategory(productCategory, product.Id);
}
public virtual async Task<IList<ProductModel.ProductCollectionModel>> PrepareProductCollectionModel(Product product)
@@ -1216,26 +1108,13 @@ namespace Grand.Web.Admin.Services
{
var collectionId = model.CollectionId;
var product = await _productService.GetProductById(model.ProductId, true);
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- {
- if (product != null && product.VendorId != _workContext.CurrentVendor.Id)
- {
- throw new ArgumentException("This is not your product");
- }
- }
-
if (product != null && product.ProductCollections.All(x => x.CollectionId != collectionId))
{
var productCollection = new ProductCollection {
CollectionId = collectionId,
- DisplayOrder = model.DisplayOrder
+ DisplayOrder = model.DisplayOrder,
+ IsFeaturedProduct = model.IsFeaturedProduct
};
- //a vendor cannot edit "IsFeaturedProduct" property
- if (_workContext.CurrentVendor == null)
- {
- productCollection.IsFeaturedProduct = model.IsFeaturedProduct;
- }
await _productCollectionService.InsertProductCollection(productCollection, model.ProductId);
}
}
@@ -1249,21 +1128,10 @@ namespace Grand.Web.Admin.Services
if (product.ProductCollections.Any(x => x.Id != model.Id && x.CollectionId == model.CollectionId))
throw new ArgumentException("This collection is already mapped with this product");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- {
- if (product != null && product.VendorId != _workContext.CurrentVendor.Id)
- {
- throw new ArgumentException("This is not your product");
- }
- }
productCollection.CollectionId = model.CollectionId;
productCollection.DisplayOrder = model.DisplayOrder;
- //a vendor cannot edit "IsFeaturedProduct" property
- if (_workContext.CurrentVendor == null)
- {
- productCollection.IsFeaturedProduct = model.IsFeaturedProduct;
- }
+ productCollection.IsFeaturedProduct = model.IsFeaturedProduct;
+
await _productCollectionService.UpdateProductCollection(productCollection, product.Id);
}
public virtual async Task DeleteProductCollection(string id, string productId)
@@ -1272,14 +1140,7 @@ namespace Grand.Web.Admin.Services
var productCollection = product.ProductCollections.FirstOrDefault(x => x.Id == id);
if (productCollection == null)
throw new ArgumentException("No product collection mapping found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- {
- if (product != null && product.VendorId != _workContext.CurrentVendor.Id)
- {
- throw new ArgumentException("This is not your product");
- }
- }
+
await _productCollectionService.DeleteProductCollection(productCollection, product.Id);
}
public virtual async Task InsertRelatedProductModel(ProductModel.AddRelatedProductModel model)
@@ -1291,10 +1152,6 @@ namespace Grand.Web.Admin.Services
var product = await _productService.GetProductById(id);
if (product != null)
{
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id)
- continue;
-
var existingRelatedProducts = productId1.RelatedProducts;
if (model.ProductId != id)
if (!existingRelatedProducts.Any(x => x.ProductId2 == id))
@@ -1319,14 +1176,7 @@ namespace Grand.Web.Admin.Services
var product2 = await _productService.GetProductById(relatedProduct.ProductId2);
if (product2 == null)
throw new ArgumentException("No product found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- {
- if (product2 != null && product2.VendorId != _workContext.CurrentVendor.Id)
- {
- throw new ArgumentException("This is not your product");
- }
- }
+
relatedProduct.DisplayOrder = model.DisplayOrder;
await _productService.UpdateRelatedProduct(relatedProduct, model.ProductId1);
}
@@ -1337,14 +1187,6 @@ namespace Grand.Web.Admin.Services
if (relatedProduct == null)
throw new ArgumentException("No related product found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- {
- if (product != null && product.VendorId != _workContext.CurrentVendor.Id)
- {
- throw new ArgumentException("This is not your product");
- }
- }
await _productService.DeleteRelatedProduct(relatedProduct, model.ProductId1);
}
public virtual async Task InsertSimilarProductModel(ProductModel.AddSimilarProductModel model)
@@ -1356,10 +1198,6 @@ namespace Grand.Web.Admin.Services
var product = await _productService.GetProductById(id);
if (product != null)
{
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id)
- continue;
-
var existingSimilarProducts = productId1.SimilarProducts;
if (model.ProductId != id)
if (!existingSimilarProducts.Any(x => x.ProductId2 == id))
@@ -1385,14 +1223,7 @@ namespace Grand.Web.Admin.Services
var product2 = await _productService.GetProductById(similarProduct.ProductId2);
if (product2 == null)
throw new ArgumentException("No product found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- {
- if (product2 != null && product2.VendorId != _workContext.CurrentVendor.Id)
- {
- throw new ArgumentException("This is not your product");
- }
- }
+
similarProduct.ProductId1 = model.ProductId1;
similarProduct.DisplayOrder = model.DisplayOrder;
await _productService.UpdateSimilarProduct(similarProduct);
@@ -1404,14 +1235,6 @@ namespace Grand.Web.Admin.Services
if (similarProduct == null)
throw new ArgumentException("No similar product found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- {
- if (product != null && product.VendorId != _workContext.CurrentVendor.Id)
- {
- throw new ArgumentException("This is not your product");
- }
- }
similarProduct.ProductId1 = model.ProductId1;
await _productService.DeleteSimilarProduct(similarProduct);
}
@@ -1424,10 +1247,6 @@ namespace Grand.Web.Admin.Services
var product = await _productService.GetProductById(id);
if (product != null)
{
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id)
- continue;
-
var existingBundleProducts = productId1.BundleProducts;
if (model.ProductId != id)
if (!existingBundleProducts.Any(x => x.ProductId == id))
@@ -1453,14 +1272,7 @@ namespace Grand.Web.Admin.Services
var product2 = await _productService.GetProductById(bundleProduct.ProductId);
if (product2 == null)
throw new ArgumentException("No product found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- {
- if (product2 != null && product2.VendorId != _workContext.CurrentVendor.Id)
- {
- throw new ArgumentException("This is not your product");
- }
- }
+
bundleProduct.ProductId = model.ProductId;
bundleProduct.Quantity = model.Quantity > 0 ? model.Quantity : 1;
bundleProduct.DisplayOrder = model.DisplayOrder;
@@ -1472,15 +1284,7 @@ namespace Grand.Web.Admin.Services
var bundleProduct = product.BundleProducts.FirstOrDefault(x => x.Id == model.Id);
if (bundleProduct == null)
throw new ArgumentException("No bundle product found with the specified id");
-
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- {
- if (product != null && product.VendorId != _workContext.CurrentVendor.Id)
- {
- throw new ArgumentException("This is not your product");
- }
- }
+
await _productService.DeleteBundleProduct(bundleProduct, model.ProductBundleId);
}
public virtual async Task InsertCrossSellProductModel(ProductModel.AddCrossSellProductModel model)
@@ -1491,10 +1295,6 @@ namespace Grand.Web.Admin.Services
var product = await _productService.GetProductById(id);
if (product != null)
{
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id)
- continue;
-
if (!crossSellProduct.CrossSellProduct.Any(x => x == id))
{
if (model.ProductId != id)
@@ -1524,10 +1324,6 @@ namespace Grand.Web.Admin.Services
var product = await _productService.GetProductById(id);
if (product != null)
{
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id)
- continue;
-
if (!mainproduct.RecommendedProduct.Any(x => x == id))
{
if (model.ProductId != id)
@@ -1547,10 +1343,6 @@ namespace Grand.Web.Admin.Services
var product = await _productService.GetProductById(id);
if (product != null)
{
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id)
- continue;
-
product.ParentGroupedProductId = model.ProductId;
await _productService.UpdateAssociatedProduct(product);
}
@@ -1558,10 +1350,6 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task DeleteAssociatedProduct(Product product)
{
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id)
- throw new ArgumentException("This is not your product");
-
product.ParentGroupedProductId = "";
await _productService.UpdateAssociatedProduct(product);
}
@@ -1630,11 +1418,6 @@ namespace Grand.Web.Admin.Services
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
storeId = _workContext.CurrentCustomer.StaffStoreId;
- var vendorId = "";
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- vendorId = _workContext.CurrentVendor.Id;
-
var searchCategoryIds = new List<string>();
if (!string.IsNullOrEmpty(model.SearchCategoryId))
searchCategoryIds.Add(model.SearchCategoryId);
@@ -1642,7 +1425,6 @@ namespace Grand.Web.Admin.Services
var products = (await _productService.SearchProducts(categoryIds: searchCategoryIds,
brandId: model.SearchBrandId,
collectionId: model.SearchCollectionId,
- vendorId: vendorId,
storeId: storeId,
productType: model.SearchProductTypeId > 0 ? (ProductType?)model.SearchProductTypeId : null,
keywords: model.SearchProductName,
@@ -1674,10 +1456,6 @@ namespace Grand.Web.Admin.Services
var product = await _productService.GetProductById(pModel.Id, true);
if (product != null)
{
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id)
- continue;
-
//a staff can have access only to his products
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
@@ -1718,10 +1496,6 @@ namespace Grand.Web.Admin.Services
var product = await _productService.GetProductById(pModel.Id, true);
if (product != null)
{
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id)
- continue;
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
if (!product.AccessToEntityByStore(_workContext.CurrentCustomer.StaffStoreId))
@@ -2752,15 +2526,6 @@ namespace Grand.Web.Admin.Services
if (productPicture == null)
throw new ArgumentException("No product picture found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- {
- if (product != null && product.VendorId != _workContext.CurrentVendor.Id)
- {
- throw new ArgumentException("This is not your product");
- }
- }
-
var picture = await _pictureService.GetPictureById(productPicture.PictureId);
if (picture == null)
throw new ArgumentException("No picture found with the specified id");
@@ -2784,14 +2549,6 @@ namespace Grand.Web.Admin.Services
if (productPicture == null)
throw new ArgumentException("No product picture found with the specified id");
- //a vendor should have access only to his products
- if (_workContext.CurrentVendor != null)
- {
- if (product != null && product.VendorId != _workContext.CurrentVendor.Id)
- {
- throw new ArgumentException("This is not your product");
- }
- }
var pictureId = productPicture.PictureId;
await _productService.DeleteProductPicture(productPicture, product.Id);
diff --git a/src/Web/Grand.Web.Admin/Services/ShipmentViewModelService.cs b/src/Web/Grand.Web.Admin/Services/ShipmentViewModelService.cs
index fb0c22d55..18b728b1c 100644
--- a/src/Web/Grand.Web.Admin/Services/ShipmentViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/ShipmentViewModelService.cs
@@ -121,10 +121,6 @@ namespace Grand.Web.Admin.Services
if (orderItem == null)
continue;
- if (_workContext.CurrentVendor != null)
- if (orderItem.VendorId != _workContext.CurrentVendor.Id)
- continue;
-
//quantities
var qtyInThisShipment = shipmentItem.Quantity;
var maxQtyToAdd = orderItem.OpenQty;
@@ -367,14 +363,7 @@ namespace Grand.Web.Admin.Services
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)
+ foreach (var orderItem in order.OrderItems)
{
var product = await _productService.GetProductByIdIncludeArch(orderItem.ProductId);
//we can ship only shippable products
@@ -635,10 +624,6 @@ namespace Grand.Web.Admin.Services
CreatedOnUtc = DateTime.UtcNow,
StoreId = order.StoreId
};
- if (_workContext.CurrentVendor != null)
- {
- shipment.VendorId = _workContext.CurrentVendor.Id;
- }
}
//create a shipment item
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/AddAssociatedProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/AddAssociatedProductModelValidator.cs
index 9f65f6a24..aaefd3e91 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/AddAssociatedProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/AddAssociatedProductModelValidator.cs
@@ -27,18 +27,6 @@ namespace Grand.Web.Admin.Validators.Catalog
return true;
}).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
}
- else if (workContext.CurrentVendor != null)
- {
- RuleFor(x => x).MustAsync(async (x, _, _) =>
- {
- var product = await productService.GetProductById(x.ProductId);
- if (product != null)
- if (product.VendorId != workContext.CurrentVendor.Id)
- return false;
-
- return true;
- }).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
- }
}
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/AddBundleProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/AddBundleProductModelValidator.cs
index b6d883e1e..c128edcd3 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/AddBundleProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/AddBundleProductModelValidator.cs
@@ -27,18 +27,6 @@ namespace Grand.Web.Admin.Validators.Catalog
return true;
}).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
}
- else if (workContext.CurrentVendor != null)
- {
- RuleFor(x => x).MustAsync(async (x, _, _) =>
- {
- var product = await productService.GetProductById(x.ProductId);
- if (product != null)
- if (product.VendorId != workContext.CurrentVendor.Id)
- return false;
-
- return true;
- }).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
- }
}
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/AddCrossSellProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/AddCrossSellProductModelValidator.cs
index 9674ff1cd..a58f31212 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/AddCrossSellProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/AddCrossSellProductModelValidator.cs
@@ -27,18 +27,6 @@ namespace Grand.Web.Admin.Validators.Catalog
return true;
}).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
}
- else if (workContext.CurrentVendor != null)
- {
- RuleFor(x => x).MustAsync(async (x, _, _) =>
- {
- var product = await productService.GetProductById(x.ProductId);
- if (product != null)
- if (product.VendorId != workContext.CurrentVendor.Id)
- return false;
-
- return true;
- }).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
- }
}
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/AddProductSpecificationAttributeModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/AddProductSpecificationAttributeModelValidator.cs
index 421b78ace..eb3aca267 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/AddProductSpecificationAttributeModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/AddProductSpecificationAttributeModelValidator.cs
@@ -28,19 +28,6 @@ namespace Grand.Web.Admin.Validators.Catalog
return true;
}).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
}
- else if (workContext.CurrentVendor != null)
- {
- RuleFor(x => x).MustAsync(async (x, _, _) =>
- {
- var product = await productService.GetProductById(x.ProductId);
- if (product != null)
- if (product.VendorId != workContext.CurrentVendor.Id)
- return false;
-
- return true;
- }).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
- }
-
RuleFor(x => x).MustAsync(async (x, _, _) =>
{
if (x.AttributeTypeId == Domain.Catalog.SpecificationAttributeType.Option)
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/AddRelatedProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/AddRelatedProductModelValidator.cs
index 2ac6e96d3..77e48acbc 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/AddRelatedProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/AddRelatedProductModelValidator.cs
@@ -27,18 +27,6 @@ namespace Grand.Web.Admin.Validators.Catalog
return true;
}).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
}
- else if (workContext.CurrentVendor != null)
- {
- RuleFor(x => x).MustAsync(async (x, _, _) =>
- {
- var product = await productService.GetProductById(x.ProductId);
- if (product != null)
- if (product.VendorId != workContext.CurrentVendor.Id)
- return false;
-
- return true;
- }).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
- }
}
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/AddSimilarProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/AddSimilarProductModelValidator.cs
index 15cb73d60..78f17efea 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/AddSimilarProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/AddSimilarProductModelValidator.cs
@@ -27,18 +27,6 @@ namespace Grand.Web.Admin.Validators.Catalog
return true;
}).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
}
- else if (workContext.CurrentVendor != null)
- {
- RuleFor(x => x).MustAsync(async (x, _, _) =>
- {
- var product = await productService.GetProductById(x.ProductId);
- if (product != null)
- if (product.VendorId != workContext.CurrentVendor.Id)
- return false;
-
- return true;
- }).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
- }
}
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/AssociatedProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/AssociatedProductModelValidator.cs
index 51f3efed6..6148c8e13 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/AssociatedProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/AssociatedProductModelValidator.cs
@@ -27,18 +27,6 @@ namespace Grand.Web.Admin.Validators.Catalog
return true;
}).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
}
- else if (workContext.CurrentVendor != null)
- {
- RuleFor(x => x).MustAsync(async (x, _, _) =>
- {
- var product = await productService.GetProductById(x.ProductId);
- if (product != null)
- if (product.VendorId != workContext.CurrentVendor.Id)
- return false;
-
- return true;
- }).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
- }
}
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/BundleProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/BundleProductModelValidator.cs
index 3133ff00b..98dae05b8 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/BundleProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/BundleProductModelValidator.cs
@@ -27,18 +27,6 @@ namespace Grand.Web.Admin.Validators.Catalog
return true;
}).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
}
- else if (workContext.CurrentVendor != null)
- {
- RuleFor(x => x).MustAsync(async (x, _, _) =>
- {
- var product = await productService.GetProductById(x.ProductId);
- if (product != null)
- if (product.VendorId != workContext.CurrentVendor.Id)
- return false;
-
- return true;
- }).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
- }
}
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/CrossSellProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/CrossSellProductModelValidator.cs
index 5fc59ba35..178c9d52f 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/CrossSellProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/CrossSellProductModelValidator.cs
@@ -27,18 +27,6 @@ namespace Grand.Web.Admin.Validators.Catalog
return true;
}).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
}
- else if (workContext.CurrentVendor != null)
- {
- RuleFor(x => x).MustAsync(async (x, _, _) =>
- {
- var product = await productService.GetProductById(x.ProductId);
- if (product != null)
- if (product.VendorId != workContext.CurrentVendor.Id)
- return false;
-
- return true;
- }).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
- }
}
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductAttributeMappingModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductAttributeMappingModelValidator.cs
index 507a613cf..833723ee0 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductAttributeMappingModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductAttributeMappingModelValidator.cs
@@ -27,18 +27,6 @@ namespace Grand.Web.Admin.Validators.Catalog
return true;
}).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
}
- else if (workContext.CurrentVendor != null)
- {
- RuleFor(x => x).MustAsync(async (x, _, _) =>
- {
- var product = await productService.GetProductById(x.ProductId);
- if (product != null)
- if (product.VendorId != workContext.CurrentVendor.Id)
- return false;
-
- return true;
- }).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
- }
}
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductAttributeValueModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductAttributeValueModelValidator.cs
index 3c307c9db..43c42f63b 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductAttributeValueModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductAttributeValueModelValidator.cs
@@ -37,18 +37,6 @@ namespace Grand.Web.Admin.Validators.Catalog
return true;
}).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
}
- else if (workContext.CurrentVendor != null)
- {
- RuleFor(x => x).MustAsync(async (x, _, _) =>
- {
- var product = await productService.GetProductById(x.ProductId);
- if (product != null)
- if (product.VendorId != workContext.CurrentVendor.Id)
- return false;
-
- return true;
- }).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
- }
RuleFor(x => x).CustomAsync(async (x, context, _) =>
{
var product = await productService.GetProductById(x.ProductId);
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductCategoryModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductCategoryModelValidator.cs
index dad4adb6d..7883bcda4 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductCategoryModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductCategoryModelValidator.cs
@@ -27,18 +27,6 @@ namespace Grand.Web.Admin.Validators.Catalog
return true;
}).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
}
- else if (workContext.CurrentVendor != null)
- {
- RuleFor(x => x).MustAsync(async (x, _, _) =>
- {
- var product = await productService.GetProductById(x.ProductId);
- if (product != null)
- if (product.VendorId != workContext.CurrentVendor.Id)
- return false;
-
- return true;
- }).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
- }
}
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductCollectionModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductCollectionModelValidator.cs
index 53af30f17..a52d34464 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductCollectionModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductCollectionModelValidator.cs
@@ -27,18 +27,6 @@ namespace Grand.Web.Admin.Validators.Catalog
return true;
}).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
}
- else if (workContext.CurrentVendor != null)
- {
- RuleFor(x => x).MustAsync(async (x, _, _) =>
- {
- var product = await productService.GetProductById(x.ProductId);
- if (product != null)
- if (product.VendorId != workContext.CurrentVendor.Id)
- return false;
-
- return true;
- }).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
- }
}
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductPictureModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductPictureModelValidator.cs
index 0f8b3b72a..b0d22df78 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductPictureModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductPictureModelValidator.cs
@@ -27,18 +27,6 @@ namespace Grand.Web.Admin.Validators.Catalog
return true;
}).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
}
- else if (workContext.CurrentVendor != null)
- {
- RuleFor(x => x).MustAsync(async (x, _, _) =>
- {
- var product = await productService.GetProductById(x.ProductId);
- if (product != null)
- if (product.VendorId != workContext.CurrentVendor.Id)
- return false;
-
- return true;
- }).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
- }
}
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductSpecificationAttributeModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductSpecificationAttributeModelValidator.cs
index a741ee67d..998a5bd6f 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductSpecificationAttributeModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductSpecificationAttributeModelValidator.cs
@@ -27,18 +27,6 @@ namespace Grand.Web.Admin.Validators.Catalog
return true;
}).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
}
- else if (workContext.CurrentVendor != null)
- {
- RuleFor(x => x).MustAsync(async (x, _, _) =>
- {
- var product = await productService.GetProductById(x.ProductId);
- if (product != null)
- if (product.VendorId != workContext.CurrentVendor.Id)
- return false;
-
- return true;
- }).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
- }
}
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/RelatedProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/RelatedProductModelValidator.cs
index 337a65aa6..d93b45783 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/RelatedProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/RelatedProductModelValidator.cs
@@ -27,18 +27,6 @@ namespace Grand.Web.Admin.Validators.Catalog
return true;
}).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
}
- else if (workContext.CurrentVendor != null)
- {
- RuleFor(x => x).MustAsync(async (x, _, _) =>
- {
- var product = await productService.GetProductById(x.ProductId1);
- if (product != null)
- if (product.VendorId != workContext.CurrentVendor.Id)
- return false;
-
- return true;
- }).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
- }
}
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/SimilarProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/SimilarProductModelValidator.cs
index 5e660943c..412d84be9 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/SimilarProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/SimilarProductModelValidator.cs
@@ -27,18 +27,6 @@ namespace Grand.Web.Admin.Validators.Catalog
return true;
}).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
}
- else if (workContext.CurrentVendor != null)
- {
- RuleFor(x => x).MustAsync(async (x, _, _) =>
- {
- var product = await productService.GetProductById(x.ProductId1);
- if (product != null)
- if (product.VendorId != workContext.CurrentVendor.Id)
- return false;
-
- return true;
- }).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
- }
}
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/TierPriceModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/TierPriceModelValidator.cs
index c0b805c51..dee4deb47 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/TierPriceModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/TierPriceModelValidator.cs
@@ -27,18 +27,6 @@ namespace Grand.Web.Admin.Validators.Catalog
return true;
}).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
}
- else if (workContext.CurrentVendor != null)
- {
- RuleFor(x => x).MustAsync(async (x, _, _) =>
- {
- var product = await productService.GetProductById(x.ProductId);
- if (product != null)
- if (product.VendorId != workContext.CurrentVendor.Id)
- return false;
-
- return true;
- }).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
- }
}
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Messages/ContactFormDeleteValidator.cs b/src/Web/Grand.Web.Admin/Validators/Messages/ContactFormDeleteValidator.cs
index 255bb97e7..de29cf39a 100644
--- a/src/Web/Grand.Web.Admin/Validators/Messages/ContactFormDeleteValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Messages/ContactFormDeleteValidator.cs
@@ -1,6 +1,5 @@
using FluentValidation;
using Grand.Business.Core.Interfaces.Marketing.Contacts;
-using Grand.Infrastructure;
using Grand.Infrastructure.Validators;
using Grand.Web.Admin.Models.Messages;
@@ -9,7 +8,7 @@ namespace Grand.Web.Admin.Validators.Messages
public class ContactFormDeleteValidator : BaseGrandValidator<ContactFormDeleteModel>
{
public ContactFormDeleteValidator(IEnumerable<IValidatorConsumer<ContactFormDeleteModel>> validators,
- IContactUsService contactUsService, IWorkContext workContext)
+ IContactUsService contactUsService)
: base(validators)
{
RuleFor(x => x).CustomAsync(async (x, context, _) =>
@@ -17,12 +16,6 @@ namespace Grand.Web.Admin.Validators.Messages
var contact = await contactUsService.GetContactUsById(x.Id);
if (contact == null)
context.AddFailure("Not found with the specified id");
-
- if (workContext.CurrentVendor != null)
- {
- if (contact!.VendorId != workContext.CurrentVendor.Id)
- context.AddFailure("This is not your contact us form");
- }
});
}
}