mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Highlight amount sum in part tables and part info page, when amount is less than minAmount
This commit is contained in:
parent
69fdc85c99
commit
5330476dbe
4 changed files with 29 additions and 5 deletions
|
@ -202,6 +202,12 @@ final class PartsDataTable implements DataTableTypeInterface
|
||||||
htmlspecialchars($this->amountFormatter->format($expiredAmount, $context->getPartUnit())));
|
htmlspecialchars($this->amountFormatter->format($expiredAmount, $context->getPartUnit())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//When the amount is below the minimum amount, we highlight the number red
|
||||||
|
if ($context->isNotEnoughInstock()) {
|
||||||
|
$ret = sprintf('<b class="text-danger" title="%s">%s</b>',
|
||||||
|
$this->translator->trans('part.info.amount.less_than_desired'),
|
||||||
|
$ret);
|
||||||
|
}
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
},
|
},
|
||||||
|
|
|
@ -151,6 +151,15 @@ trait InstockTrait
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true, if the total instock amount of this part is less than the minimum amount.
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isNotEnoughInstock(): bool
|
||||||
|
{
|
||||||
|
return $this->getAmountSum() < $this->getMinAmount();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the summed amount of this part (over all part lots)
|
* Returns the summed amount of this part (over all part lots)
|
||||||
* Part Lots that have unknown value or are expired, are not used for this value.
|
* Part Lots that have unknown value or are expired, are not used for this value.
|
||||||
|
|
|
@ -41,11 +41,14 @@
|
||||||
<span class="text-muted">{{ helper.structural_entity_link(part.category) }}</span>
|
<span class="text-muted">{{ helper.structural_entity_link(part.category) }}</span>
|
||||||
</h6>
|
</h6>
|
||||||
<h6><i class="fas fa-shapes fa-fw"></i>
|
<h6><i class="fas fa-shapes fa-fw"></i>
|
||||||
<span class="text-muted">
|
<span class="{% if part.notEnoughInstock %}text-danger font-weight-bold{% else %}text-muted{% endif %}">
|
||||||
<span title="{% trans %}instock.label{% endtrans %}">{{ part.amountSum | format_amount(part.partUnit) }}</span>
|
<span title="{% trans %}instock.label{% endtrans %}">{{ part.amountSum | format_amount(part.partUnit) }}</span>
|
||||||
/
|
/
|
||||||
<span title="{% trans %}mininstock.label{% endtrans %}">{{ part.minAmount | format_amount(part.partUnit) }}</span>
|
<span title="{% trans %}mininstock.label{% endtrans %}">{{ part.minAmount | format_amount(part.partUnit) }}</span>
|
||||||
</span>
|
</span>
|
||||||
|
{% if part.notEnoughInstock %}
|
||||||
|
<span class="badge badge-warning bg-warning rounded-pill"><i class="fa-solid fa-less-than-equal"></i> {% trans %}part.info.amount.less_than_desired{% endtrans %}</span>
|
||||||
|
{% endif %}
|
||||||
</h6>
|
</h6>
|
||||||
<h6 class="">
|
<h6 class="">
|
||||||
<i class="fas fa-microchip fa-fw" title="{% trans %}footprint.label{% endtrans %}"></i>
|
<i class="fas fa-microchip fa-fw" title="{% trans %}footprint.label{% endtrans %}"></i>
|
||||||
|
|
|
@ -11253,5 +11253,11 @@ Element 3</target>
|
||||||
<target>Not allowed to do the desired action. Please check your permissions and the owner of the part lots.</target>
|
<target>Not allowed to do the desired action. Please check your permissions and the owner of the part lots.</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
|
<unit id="Dwo4KWP" name="part.info.amount.less_than_desired">
|
||||||
|
<segment>
|
||||||
|
<source>part.info.amount.less_than_desired</source>
|
||||||
|
<target>Less than desired</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue