Add progress to req_list

This commit is contained in:
aminhashemi92 2025-09-07 12:00:34 +03:30
parent 7a153c46e6
commit 5ce94214d5
6 changed files with 29261 additions and 27 deletions

View file

@ -144,31 +144,41 @@
<th>نماینده</th>
<th>استان</th>
<th>امور</th>
<th>پیشرفت</th>
<th>وضعیت</th>
<th>تاریخ ایجاد</th>
<th>عملیات</th>
</tr>
</thead>
<tbody>
{% for inst in instances %}
{% for item in instances_with_progress %}
<tr>
<td>{{ inst.code }}</td>
<td>{{ inst.process.name }}</td>
<td>{{ item.instance.code }}</td>
<td>{{ item.instance.process.name }}</td>
<td class="text-primary">
{% if inst.status == 'completed' %}
<a href="{% url 'processes:instance_summary' inst.id %}" class="text-primary">{{ inst.current_step.name|default:"--" }}</a>
{% elif inst.current_step %}
<a href="{% url 'processes:instance_steps' inst.id %}" class="text-primary">{{ inst.current_step.name }}</a>
{% if item.instance.status == 'completed' %}
<a href="{% url 'processes:instance_summary' item.instance.id %}" class="text-primary">{{ item.instance.current_step.name|default:"--" }}</a>
{% elif item.instance.current_step %}
<a href="{% url 'processes:instance_steps' item.instance.id %}" class="text-primary">{{ item.instance.current_step.name }}</a>
{% else %}
--
{% endif %}
</td>
<td>{{ inst.well.water_subscription_number }}</td>
<td>{% if inst.representative %}{{ inst.representative.get_full_name }}{% else %}-{% endif %}</td>
<td>{% if inst.well and inst.well.county %}{{ inst.well.county }}{% else %}-{% endif %}</td>
<td>{% if inst.well and inst.well.affairs %}{{ inst.well.affairs }}{% else %}-{% endif %}</td>
<td>{{ inst.get_status_display_with_color|safe }}</td>
<td>{{ inst.jcreated }}</td>
<td>{{ item.instance.well.water_subscription_number }}</td>
<td>{% if item.instance.representative %}{{ item.instance.representative.get_full_name }}{% else %}-{% endif %}</td>
<td>{% if item.instance.well and item.instance.well.county %}{{ item.instance.well.county }}{% else %}-{% endif %}</td>
<td>{% if item.instance.well and item.instance.well.affairs %}{{ item.instance.well.affairs }}{% else %}-{% endif %}</td>
<td>
<div class="d-flex align-items-center">
<div class="progress me-2" style="width: 80px; height: 6px;">
<div class="progress-bar {% if item.progress_percentage == 100 %}bg-success{% elif item.progress_percentage >= 70 %}bg-info{% elif item.progress_percentage >= 40 %}bg-warning{% else %}bg-secondary{% endif %}" role="progressbar" style="width: {{ item.progress_percentage }}%;" aria-valuenow="{{ item.progress_percentage }}" aria-valuemin="0" aria-valuemax="100">
</div>
</div>
<small class="text-muted">{{ item.progress_percentage }}%</small>
</div>
</td>
<td>{{ item.instance.get_status_display_with_color|safe }}</td>
<td>{{ item.instance.jcreated }}</td>
<td>
<div class="d-inline-block">
<a href="javascript:;" class="btn btn-icon dropdown-toggle hide-arrow" data-bs-toggle="dropdown">
@ -176,19 +186,19 @@
</a>
<ul class="dropdown-menu dropdown-menu-end m-0">
<li>
{% if inst.status == 'completed' %}
<a href="{% url 'processes:instance_summary' inst.id %}" class="dropdown-item">
{% if item.instance.status == 'completed' %}
<a href="{% url 'processes:instance_summary' item.instance.id %}" class="dropdown-item">
<i class="bx bx-show me-1"></i>مشاهده گزارش
</a>
{% else %}
<a href="{% url 'processes:instance_steps' inst.id %}" class="dropdown-item">
<a href="{% url 'processes:instance_steps' item.instance.id %}" class="dropdown-item">
<i class="bx bx-show me-1"></i>مشاهده جزئیات
</a>
{% endif %}
</li>
<div class="dropdown-divider"></div>
<li>
<a href="#" class="dropdown-item text-danger" data-instance-id="{{ inst.id }}" data-instance-code="{{ inst.code }}" onclick="deleteRequest(this.getAttribute('data-instance-id'), this.getAttribute('data-instance-code'))">
<a href="#" class="dropdown-item text-danger" data-instance-id="{{ item.instance.id }}" data-instance-code="{{ item.instance.code }}" onclick="deleteRequest(this.getAttribute('data-instance-id'), this.getAttribute('data-instance-code'))">
<i class="bx bx-trash me-1"></i>حذف
</a>
</li>
@ -198,7 +208,7 @@
</tr>
{% empty %}
<tr>
<td colspan="9" class="text-center text-muted">موردی ثبت نشده است</td>
<td colspan="11" class="text-center text-muted">موردی ثبت نشده است</td>
</tr>
{% endfor %}
</tbody>