Подправил реестр сменных заданий, права опрератора, добавил поле для хранения сколько сделано (для оператора) подправил ui в окне карточки сменного задания
All checks were successful
Deploy MES Core / deploy (push) Successful in 12s
All checks were successful
Deploy MES Core / deploy (push) Successful in 12s
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
<th>Материал</th>
|
||||
<th data-sort="false" class="text-center">Файлы</th>
|
||||
<th data-sort="false" style="width: 160px;">Прогресс</th>
|
||||
<th data-sort-type="number">План / Факт</th>
|
||||
<th data-sort-type="number">План / Прогресс</th>
|
||||
<th>Статус</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -64,7 +64,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<span class="text-info fw-bold">{{ wi.quantity_plan }}</span> /
|
||||
<span class="text-success">{{ wi.quantity_done }}</span>
|
||||
<span class="text-success">{{ wi.quantity_reported|default:0 }}</span>
|
||||
</td>
|
||||
<td>
|
||||
{% if wi.status == 'done' %}
|
||||
@@ -93,5 +93,11 @@ document.addEventListener("DOMContentLoaded", function() {
|
||||
if (href) window.location.href = href;
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelectorAll('.sf-item-progress').forEach(function (el) {
|
||||
const w = parseInt(el.getAttribute('data-fact-width') || '0', 10) || 0;
|
||||
const bar = el.querySelector('.sf-item-progress-bar');
|
||||
if (bar) bar.style.width = `${w}%`;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -41,7 +41,7 @@
|
||||
<form method="post" action="{% url 'workitem_update' %}" class="mb-4" id="workitemForm">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="workitem_id" value="{{ workitem.id }}">
|
||||
<input type="hidden" name="next" value="{{ request.get_full_path }}">
|
||||
<input type="hidden" name="next" value="{{ back_url }}">
|
||||
|
||||
<div class="row g-3 mb-4 border-bottom border-secondary pb-3 text-body">
|
||||
<div class="col-md-4">
|
||||
@@ -93,11 +93,11 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<small class="text-muted d-block">Факт</small>
|
||||
{% if user_role in 'admin,technologist,master,operator' %}
|
||||
<input type="number" min="0" class="form-control border-secondary" name="quantity_done" id="wiDone" value="{{ workitem.quantity_done }}">
|
||||
<small class="text-muted d-block">Прогресс</small>
|
||||
{% if user_role in 'admin,technologist,master,operator,prod_head' %}
|
||||
<input type="number" min="0" class="form-control border-secondary" name="quantity_reported" id="wiReported" value="{{ workitem.quantity_reported|default:0 }}">
|
||||
{% else %}
|
||||
<strong class="text-success fs-5">{{ workitem.quantity_done }} шт.</strong>
|
||||
<strong class="text-success fs-5">{{ workitem.quantity_reported|default:0 }} шт.</strong>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -279,7 +279,7 @@
|
||||
<div class="d-flex justify-content-between mt-4">
|
||||
<a href="{{ back_url }}" class="btn btn-outline-secondary">Назад</a>
|
||||
{% if user_role in 'admin,technologist,master,operator' %}
|
||||
<button type="button" class="btn btn-outline-accent px-4 fw-bold" onclick="document.getElementById('workitemForm')?.requestSubmit()">
|
||||
<button type="button" class="btn btn-outline-accent px-4 fw-bold" onclick="const f=document.getElementById('workitemForm'); if(!f) return; if(f.requestSubmit){f.requestSubmit();} else {f.submit();}">
|
||||
<i class="bi bi-save me-2"></i>Сохранить
|
||||
</button>
|
||||
{% endif %}
|
||||
@@ -289,20 +289,44 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ back_url|json_script:"wiBackUrl" }}
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const done = document.getElementById('wiDone');
|
||||
const form = document.getElementById('workitemForm');
|
||||
if (done) {
|
||||
done.focus({ preventScroll: true });
|
||||
done.select();
|
||||
done.addEventListener('keydown', function (e) {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
if (form) form.requestSubmit();
|
||||
}
|
||||
});
|
||||
|
||||
function getBackUrl() {
|
||||
const el = document.getElementById('wiBackUrl');
|
||||
return el ? JSON.parse(el.textContent || '""') : '';
|
||||
}
|
||||
|
||||
const reported = document.getElementById('wiReported');
|
||||
if (reported) {
|
||||
reported.focus({ preventScroll: true });
|
||||
reported.select();
|
||||
}
|
||||
|
||||
document.addEventListener('keydown', function (e) {
|
||||
if (e.key === 'Escape') {
|
||||
const url = getBackUrl();
|
||||
if (url) window.location.href = url;
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.key !== 'Enter') return;
|
||||
|
||||
const t = e.target;
|
||||
const tag = (t && t.tagName) ? t.tagName.toLowerCase() : '';
|
||||
if (tag === 'textarea') return;
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
if (!form) return;
|
||||
if (form.requestSubmit) {
|
||||
form.requestSubmit();
|
||||
} else {
|
||||
form.submit();
|
||||
}
|
||||
}, true);
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user