@arsedizioni/ars-utils 18.4.96 → 18.4.97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1647,17 +1647,23 @@ class ClipperDashboard {
1647
1647
  * @param increment : the increment (can be negative)
1648
1648
  */
1649
1649
  updateUnreadItems(module, model, increment) {
1650
- let item = this.items()?.find((x) => x.id == module);
1651
- if (item) {
1652
- item.unreadItems += increment;
1653
- if (model) {
1650
+ if (model) {
1651
+ this.items().forEach(item => {
1654
1652
  let itemModel = item.models.find(x => x.id === model);
1655
1653
  if (itemModel) {
1654
+ item.unreadItems += increment;
1656
1655
  itemModel.unreadItems += increment;
1656
+ return;
1657
1657
  }
1658
+ });
1659
+ }
1660
+ else {
1661
+ let item = this.items()?.find((x) => x.id == module);
1662
+ if (item) {
1663
+ item.unreadItems += increment;
1658
1664
  }
1659
- this.items.update((values) => [...values]);
1660
1665
  }
1666
+ this.items.update((values) => [...values]);
1661
1667
  }
1662
1668
  /***
1663
1669
  * Get the module unread items