Skip to content

Commit

Permalink
#1052. Highlighting the names of products when they are low in quanti…
Browse files Browse the repository at this point in the history
…ty on the Stock Management page in the Admin. (#1084)
  • Loading branch information
s04v committed Feb 24, 2024
1 parent 3f389c8 commit c615a6a
Show file tree
Hide file tree
Showing 6 changed files with 4,796 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public void Build(ModelBuilder modelBuilder)

modelBuilder.Entity<AppSetting>().HasData(
new AppSetting("Catalog.ProductPageSize") { Module = "Catalog", IsVisibleInCommonSettingPage = true, Value = "10" },
new AppSetting("Catalog.IsProductPriceIncludeTax") { Module = "Catalog", IsVisibleInCommonSettingPage = true, Value = "true" }
new AppSetting("Catalog.IsProductPriceIncludeTax") { Module = "Catalog", IsVisibleInCommonSettingPage = true, Value = "true" },
new AppSetting("Catalog.MinimumProductQuantityForHighlighting") { Module = "Catalog", IsVisibleInCommonSettingPage = true, Value = "5" }
);

modelBuilder.Entity<EntityType>().HasData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ <h2>{{::vm.translate.get('Stock management for warehouse')}} <strong>{{ vm.selec
</tr>
</thead>
<tbody ng-show="!vm.isLoading">
<tr ng-repeat="item in vm.stocks">
<tr ng-repeat="item in vm.stocks"
style="{{item.quantity < vm.minimumQuantityForHighlighting ? 'background-color: #ffff8f;' : ''}}"
>
<td>{{item.productName}}</td>
<td>{{item.productSku}}</td>
<td class="text-right">{{item.quantity}}</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
(function () {
angular
.module('simplAdmin.inventory')
.controller('StockFormCtrl', ['stockService', 'translateService', StockFormCtrl]);
.controller('StockFormCtrl', ['configurationService','stockService', 'translateService', StockFormCtrl]);

function StockFormCtrl(stockService, translateService) {
function StockFormCtrl(configurationService, stockService, translateService) {
var vm = this;
vm.tableStateRef = {};
vm.translate = translateService;
Expand Down Expand Up @@ -42,5 +42,11 @@
vm.selectedWarehouse = vm.warehouses[0];
}
});

configurationService.getSettings().then(function (result) {
const minimumQuantityForHighlighting = result.data.find(o => o.key === "Catalog.MinimumProductQuantityForHighlighting");

vm.minimumQuantityForHighlighting = minimumQuantityForHighlighting ? minimumQuantityForHighlighting.value : 0;
});
}
})();

0 comments on commit c615a6a

Please sign in to comment.