Skip to content

Commit c615a6a

Browse files
authored
#1052. Highlighting the names of products when they are low in quantity on the Stock Management page in the Admin. (#1084)
1 parent 3f389c8 commit c615a6a

File tree

6 files changed

+4796
-4
lines changed

6 files changed

+4796
-4
lines changed

src/Modules/SimplCommerce.Module.Catalog/Data/CatalogCustomModelBuilder.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ public void Build(ModelBuilder modelBuilder)
3737

3838
modelBuilder.Entity<AppSetting>().HasData(
3939
new AppSetting("Catalog.ProductPageSize") { Module = "Catalog", IsVisibleInCommonSettingPage = true, Value = "10" },
40-
new AppSetting("Catalog.IsProductPriceIncludeTax") { Module = "Catalog", IsVisibleInCommonSettingPage = true, Value = "true" }
40+
new AppSetting("Catalog.IsProductPriceIncludeTax") { Module = "Catalog", IsVisibleInCommonSettingPage = true, Value = "true" },
41+
new AppSetting("Catalog.MinimumProductQuantityForHighlighting") { Module = "Catalog", IsVisibleInCommonSettingPage = true, Value = "5" }
4142
);
4243

4344
modelBuilder.Entity<EntityType>().HasData(

src/Modules/SimplCommerce.Module.Inventory/wwwroot/admin/stock/stock-form.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ <h2>{{::vm.translate.get('Stock management for warehouse')}} <strong>{{ vm.selec
4747
</tr>
4848
</thead>
4949
<tbody ng-show="!vm.isLoading">
50-
<tr ng-repeat="item in vm.stocks">
50+
<tr ng-repeat="item in vm.stocks"
51+
style="{{item.quantity < vm.minimumQuantityForHighlighting ? 'background-color: #ffff8f;' : ''}}"
52+
>
5153
<td>{{item.productName}}</td>
5254
<td>{{item.productSku}}</td>
5355
<td class="text-right">{{item.quantity}}</td>

src/Modules/SimplCommerce.Module.Inventory/wwwroot/admin/stock/stock-form.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
(function () {
33
angular
44
.module('simplAdmin.inventory')
5-
.controller('StockFormCtrl', ['stockService', 'translateService', StockFormCtrl]);
5+
.controller('StockFormCtrl', ['configurationService','stockService', 'translateService', StockFormCtrl]);
66

7-
function StockFormCtrl(stockService, translateService) {
7+
function StockFormCtrl(configurationService, stockService, translateService) {
88
var vm = this;
99
vm.tableStateRef = {};
1010
vm.translate = translateService;
@@ -42,5 +42,11 @@
4242
vm.selectedWarehouse = vm.warehouses[0];
4343
}
4444
});
45+
46+
configurationService.getSettings().then(function (result) {
47+
const minimumQuantityForHighlighting = result.data.find(o => o.key === "Catalog.MinimumProductQuantityForHighlighting");
48+
49+
vm.minimumQuantityForHighlighting = minimumQuantityForHighlighting ? minimumQuantityForHighlighting.value : 0;
50+
});
4551
}
4652
})();

0 commit comments

Comments
 (0)