-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmaterials_detail.html
236 lines (163 loc) · 6.46 KB
/
materials_detail.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
{% extends "layouts/base.html" %}
{% load static %}
{% block title %} Dashboard {% endblock %}
<!-- Specific Page CSS goes HERE -->
{% block stylesheets %}{% endblock stylesheets %}
{% block content %}
{% load mptt_tags %}
<div class="row">
<div class="col-md-12">
<div class="card card-plain" align="right" dir="rtl">
<div class="card-header">
<h3 class="card-title" dir="rtl" align="center"> قطعه {{ material.name }}</h3>
<div class="row">
<div class="col-md-6" align="right">
<button style="background-color:#0c5ba9bd;color:white;text-align:center;border-radius:8px;padding:10px;font-size:16px;border:none;"> کد: {{ material.code }} </button>
</div>
<div class="col-md-6" align="left">
<button style="background-color:#0c5ba9bd;color:white;text-align:center;border-radius:8px;padding:10px;font-size:16px;border:none;"> {{ material.position }} </button>
</div>
</div>
</div>
</div>
</div>
</div>
{% if material.inventory <= material.min_inventory %}
<p align="right" dir="rtl" style="color:red;"> موجودی از حداقل کمتر است </p>
{% endif %}
<div class="row">
<div class="col-md-12">
<div class="card card-user">
<div class="card-body">
<p class="card-text">
<div class="author">
<div class="block block-one"></div>
<div class="block block-two"></div>
<div class="block block-three"></div>
<div class="block block-four"></div>
<img width="20%" src="{{ material.image.url }}">
</div>
</p>
<div align="right" dir="rtl" class="card-description">
<p class="category"> {{ material.description|linebreaks }} </p>
</div>
</div>
</div>
</div>
</div>
<div class="row" dir="rtl" align="right">
{% if material.position != 'سطح اولیه' %}
{% if material.position != 'اقلام مصرفی' %}
<div class="col-md-6">
<div class="card card-user">
<div class="card-header">
<h4 class="card-title" align="center">
BOM
</h4>
</div>
<div class="card-body" style="font-size:11px; color:black;">
<section id='eg1' class="ladder tree">
<ul>
{% recursetree bom %}
<li>
<a style="color:black;" href=".">
{{ node.name.name }}
ضریب مصرف: {{ node.quantity }}
<img width="30px" src="{{ node.name.image.url }}" alt="Profile Photo">
<hr>
</a>
<ul>{% if not node.is_leaf_node %}<li>{{ children }}</li>{% endif %}</ul>
</li>
{% endrecursetree %}
</ul>
</section>
</div>
</div>
</div>
{% endif %}
{% endif %}
<div class="col-md-6">
<div class="card card-user">
<div class="card-header">
<h4 class="card-title" align="center"> آمار </h4>
</div>
<div class="card-body" style="font-size:11px; color:black; ">
<div class="row">
<div class="col-md-6">
<p> موجودی : {{ material.inventory.normalize }} {{ material.unit }} </p>
</div>
<div class="col-md-6">
<p> حداقل موجودی : {{ material.min_inventory.normalize }} {{ material.unit }} </p>
</div>
</div>
<hr><br>
<p style="color:black;">
ایستگاه های استفاده کننده:
{% for Station in stations %}
<a style="color:black;" href="{{ Station.get_absolute_url }}"> {{ Station.name }} </a>
{% endfor %}
<hr><br>
<div id="relProduct"></div>
{% if material.position != 'سطح اولیه' %}
{% if material.position != 'اقلام مصرفی' %}
<hr><br>
خروجی ایستگاه های:
{% for Station in exit_station %}
<a style="color:black;" href="{{ Station.get_absolute_url }}"> {{ Station.name }} </a>
{% endfor %}
<hr><br>
موجودی های خارج نشده
{% for Station in exit_station %}
{% if Station.inventory != 0 %}
<a style="color:black;" href="{{ Station.get_absolute_url }}"> {{ Station.name }} </a>[ {{ Station.inventory.normalize }} ]
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
<hr><br>
موجودی در قطعات دیگر:
{% for Bom_material in bom_material %}
{{ Bom_material.parent.name }} {% widthratio Bom_material.parent.inventory Bom_material.quantity 1%}
{{ Bom_material.relatedProduct.name }} {% widthratio Bom_material.relatedProduct.inventory Bom_material.quantity 1%}
{% endfor %}
</p>
</div>
</div>
</div>
</div>
{% endblock content %}
<!-- Specific Page JS goes HERE -->
{% block javascripts %}
<script>
var tree = [
{% for Tree in tree %}
{ "name":"{{Tree.relatedProduct.name}}", "tot":1 },
{% endfor %}
];
var relProduct_div = document.getElementById("relProduct");
var relProduct = tree.reduce(function (agg, obj) {
var objForName = agg.filter(function (nameObj) { return nameObj.name === obj.name})[0]
if (objForName) {
objForName.total += obj.tot;
} else {
agg.push({
name: obj.name,
total: obj.tot
})
}
return agg;
}, [])
for(var i=0; i < relProduct.length; i++){
relProduct_div.innerHTML += "<p> محصولات استفاده کننده: "+relProduct[i].name+"</p> ";
}
$("#eg1 li ul").slideToggle(); // hide all nested lists
$("#eg1 li ul").prev("a").click(function(){ // add fn to list items that have a nested list
$(this).next("ul").slideToggle(100); // show/hide the nested list
return false; // prevent scrolling
});
$(document).ready(function() {
// Javascript method's body can be found in assets/js/demos.js
demo.initDashboardPageCharts();
});
</script>
{% endblock javascripts %}