Skip to content

Commit 335ade8

Browse files
committed
update production table
1 parent 91c8369 commit 335ade8

2 files changed

Lines changed: 23 additions & 13 deletions

File tree

src/OpenIntranet/templates/production.bom_table.hbs

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,28 @@
4242

4343
<div>
4444
{%try%}
45-
{%for packets in row['packets'] %}
46-
{% set count = 0 %}
47-
{%for packet in packets['packets'] %}
48-
{% set this_warehouse = bool(packet['packets']['position'][0]['warehouse'] == current_warehouse) %}
49-
{% if this_warehouse %} <div> <span class="text-muted hover-packet" packet_id="{{packet['packets']['_id']}}"><i class="bi bi-box-seam"></i> {{str(packet['packets']['_id'])[-4:]}}</span> &middot; <b>{{packet['packet_count']}}</b><small>/{{packet['packet_count']}}</small> ks &middot; <span class="text-muted" data-toggle="tooltip" data-placement="top" title="{{ packet['packets']['position'][0]['text']}}">(<i class="bi bi-inboxes"></i> {{ packet['packets']['position'][0]['name']}})</span></div> {%end%}
50-
{%set count += packet['packet_count'] %}
51-
{%end%}
52-
<hr style="margin: 2px;">
53-
<div><span data-toggle="tooltip" data-placement="top" title="V tomto skladě" unit_required="{{len(row['Ref'])}}" unit_available="{{count}}" class="count_validation"><i class="bi bi-shop"></i> {{count}} ks</span> <span data-toggle="tooltip" data-placement="top" title="Ostatní sklady" class="text-muted"><i class="bi bi-building"></i> {{packets['component_count'] - count}} ks</span></div>
54-
<hr style="margin: 2px;">
55-
<div> {%if packets['component_count']%} <i class="bi bi-cash-stack"> </i>{{ round(packets['component_price']/packets['component_count']*len(row['Ref']), 2) }} Czk &middot; <span class="text-muted"><i class="bi bi-cash"> </i>{{ round(packets['component_price']/packets['component_count'], 2) }} Czk/ks </span>{%else%} <span class="text-muted">Není možné určit cenu.</span> {%end%}</div>
45+
{% if not len(row['packets']) %}
46+
<div>
47+
<i class="bi bi-exclamation-square"></i> Není ve skladu
48+
<span unit_required="{{len(row['Ref'])}}" unit_available="0" class="count_validation"></span>
49+
</div>
50+
{%else%}
51+
{%for packets in row['packets'] %}
52+
{% set count = 0 %}
53+
{% for packet in packets['packets'] %}
54+
{% set this_warehouse = bool(packet['packets']['position'][0]['warehouse'] == current_warehouse) %}
55+
{% if this_warehouse %}
56+
<div> <span class="text-muted hover-packet" packet_id="{{packet['packets']['_id']}}"><i class="bi bi-box-seam"></i> {{str(packet['packets']['_id'])[-4:]}}</span> &middot; <b>{{packet['packet_count']}}</b><small>/{{packet['packet_count']}}</small> ks &middot; <span class="text-muted" data-toggle="tooltip" data-placement="top" title="{{ packet['packets']['position'][0]['text']}}">(<i class="bi bi-inboxes"></i> {{ packet['packets']['position'][0]['name']}})</span></div>
57+
{%set count += packet['packet_count'] %}
58+
{%end%}
59+
{%end%}
60+
<hr style="margin: 2px;">
61+
<div><span data-toggle="tooltip" data-placement="top" title="V tomto skladě" unit_required="{{len(row['Ref'])}}" unit_available="{{count}}" class="count_validation"><i class="bi bi-shop"></i> {{count}} ks</span> <span data-toggle="tooltip" data-placement="top" title="Ostatní sklady" class="text-muted"><i class="bi bi-building"></i> {{packets['component_count'] - count}} ks</span></div>
62+
<hr style="margin: 2px;">
63+
<div> {%if packets['component_count']%} <i class="bi bi-cash-stack"> </i>{{ round(packets['component_price']/packets['component_count']*len(row['Ref']), 2) }} Czk &middot; <span class="text-muted"><i class="bi bi-cash"> </i>{{ round(packets['component_price']/packets['component_count'], 2) }} Czk/ks </span>{%else%} <span class="text-muted">Není možné určit cenu.</span> {%end%}</div>
5664

57-
{%end%}
65+
{%end%}
66+
{%end%}
5867
{% except%}
5968
ERROR...
6069
{%end%}

src/OpenIntranet/templates/production.flow.hbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,15 +242,16 @@ F{% extends "base.hbs" %}
242242
update_multiplication(multiplication);
243243
$(".count_validation").each(function(){
244244
var table_row = $(this).closest('td');
245+
console.log($(this));
245246
table_row.removeClass("bg-danger");
246247
table_row.removeClass("bg-warning");
248+
table_row.removeClass("bg-secondary");
247249
248250
if(Number($(this).attr("unit_required"))*multiplication > Number($(this).attr("unit_available"))) {
249251
table_row.addClass("bg-danger");
250252
} else if (Number($(this).attr("unit_required"))*(multiplication+1) > Number($(this).attr("unit_available"))) {
251253
table_row.addClass("bg-warning");
252254
}
253-
254255
});
255256
}
256257

0 commit comments

Comments
 (0)