fix installation step and utm standarded.
This commit is contained in:
parent
204b0aa48e
commit
93db2fe7f5
10 changed files with 191 additions and 108 deletions
|
@ -22,7 +22,12 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% include '_toasts.html' %}
|
||||
|
||||
<!-- Instance Info Modal -->
|
||||
{% instance_info_modal instance %}
|
||||
|
||||
<div class="container-xxl flex-grow-1 container-p-y">
|
||||
<div class="row">
|
||||
<div class="col-12 mb-4">
|
||||
|
@ -30,11 +35,13 @@
|
|||
<div>
|
||||
<h4 class="mb-1">{{ step.name }}: {{ instance.process.name }}</h4>
|
||||
<small class="text-muted d-block">
|
||||
اشتراک آب: {{ instance.well.water_subscription_number|default:"-" }}
|
||||
| نماینده: {{ instance.representative.profile.national_code|default:"-" }}
|
||||
{% instance_info instance %}
|
||||
</small>
|
||||
</div>
|
||||
<a href="{% url 'processes:request_list' %}" class="btn btn-outline-secondary">بازگشت</a>
|
||||
<a href="{% url 'processes:request_list' %}" class="btn btn-outline-secondary">
|
||||
<i class="bx bx-chevron-right bx-sm ms-sm-n2"></i>
|
||||
بازگشت
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="bs-stepper wizard-vertical vertical mt-2">
|
||||
|
@ -64,17 +71,17 @@
|
|||
</div>
|
||||
</div>
|
||||
{% if assignment.assigned_by or assignment.installer %}
|
||||
<div class="mt-3 border rounded p-3 bg-light">
|
||||
<div class="mt-3 alert alert-primary">
|
||||
<div class="row g-2">
|
||||
{% if assignment.assigned_by %}
|
||||
<div class="col-12 col-md-6">
|
||||
<div class="small text-muted">تعیینکننده نصاب</div>
|
||||
<div class="small text-dark">تعیینکننده نصاب</div>
|
||||
<div>{{ assignment.assigned_by.get_full_name|default:assignment.assigned_by.username }} <span class="text-muted">({{ assignment.assigned_by.username }})</span></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if assignment.updated %}
|
||||
<div class="col-12 col-md-6">
|
||||
<div class="small text-muted">تاریخ ثبت/ویرایش</div>
|
||||
<div class="small text-dark">تاریخ ثبت/ویرایش</div>
|
||||
<div>{{ assignment.updated|to_jalali }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@ -83,14 +90,22 @@
|
|||
{% endif %}
|
||||
<div class="d-flex justify-content-between mt-4">
|
||||
{% if previous_step %}
|
||||
<a href="{% url 'processes:step_detail' instance.id previous_step.id %}" class="btn btn-label-secondary">قبلی</a>
|
||||
<a href="{% url 'processes:step_detail' instance.id previous_step.id %}" class="btn btn-label-secondary">
|
||||
<i class="bx bx-chevron-right bx-sm ms-sm-n2"></i>
|
||||
قبلی
|
||||
</a>
|
||||
{% else %}
|
||||
<span></span>
|
||||
{% endif %}
|
||||
{% if is_manager %}
|
||||
<button class="btn btn-primary" type="submit">ثبت و ادامه</button>
|
||||
<button class="btn btn-primary" type="submit">ثبت و ادامه
|
||||
<i class="bx bx-chevron-left bx-sm me-sm-n2"></i>
|
||||
</button>
|
||||
{% else %}
|
||||
<a href="{% url 'processes:step_detail' instance.id next_step.id %}" class="btn btn-primary">بعدی</a>
|
||||
<a href="{% url 'processes:step_detail' instance.id next_step.id %}" class="btn btn-primary">
|
||||
بعدی
|
||||
<i class="bx bx-chevron-left bx-sm me-sm-n2"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -35,7 +35,12 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% include '_toasts.html' %}
|
||||
|
||||
<!-- Instance Info Modal -->
|
||||
{% instance_info_modal instance %}
|
||||
|
||||
<div class="container-xxl flex-grow-1 container-p-y">
|
||||
<div class="row">
|
||||
<div class="col-12 mb-4">
|
||||
|
@ -43,11 +48,13 @@
|
|||
<div>
|
||||
<h4 class="mb-1">{{ step.name }}: {{ instance.process.name }}</h4>
|
||||
<small class="text-muted d-block">
|
||||
اشتراک آب: {{ instance.well.water_subscription_number|default:"-" }}
|
||||
| نماینده: {{ instance.representative.profile.national_code|default:"-" }}
|
||||
{% instance_info instance %}
|
||||
</small>
|
||||
</div>
|
||||
<a href="{% url 'processes:request_list' %}" class="btn btn-outline-secondary">بازگشت</a>
|
||||
<a href="{% url 'processes:request_list' %}" class="btn btn-outline-secondary">
|
||||
<i class="bx bx-chevron-right bx-sm ms-sm-n2"></i>
|
||||
بازگشت
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="bs-stepper wizard-vertical vertical mt-2">
|
||||
|
@ -55,18 +62,15 @@
|
|||
|
||||
<div class="bs-stepper-content">
|
||||
{% if report and not edit_mode %}
|
||||
<div class="card mb-3 border">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<div class="d-flex gap-2">
|
||||
{% if request.user|is_installer %}
|
||||
<a href="?edit=1" class="btn btn-primary">ویرایش گزارش نصب</a>
|
||||
{% else %}
|
||||
<button type="button" class="btn btn-primary" disabled>ویرایش گزارش نصب</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{% if step_instance and step_instance.status == 'rejected' and step_instance.get_latest_rejection %}
|
||||
<div class="mb-3 text-end">
|
||||
{% if user_is_installer %}
|
||||
<a href="?edit=1" class="btn btn-primary">
|
||||
<i class="bx bx-edit bx-sm me-2"></i>
|
||||
ویرایش گزارش نصب
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if step_instance and step_instance.status == 'rejected' and step_instance.get_latest_rejection %}
|
||||
<div class="alert alert-danger d-flex align-items-start" role="alert">
|
||||
<i class="bx bx-error-circle me-2"></i>
|
||||
<div>
|
||||
|
@ -75,6 +79,8 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="card mb-3 border">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<p class="text-nowrap mb-2"><i class="bx bx-calendar-event bx-sm me-2"></i>تاریخ مراجعه: {{ report.visited_date|to_jalali|default:'-' }}</p>
|
||||
|
@ -151,7 +157,7 @@
|
|||
<h6 class="mb-0">وضعیت تاییدها</h6>
|
||||
{% if user_can_approve %}
|
||||
<div class="d-flex gap-2">
|
||||
<button type="button" class="btn btn-success btn-sm" data-bs-toggle="modal" data-bs-target="#approveModal" {% if step_instance and step_instance.status == 'completed' %}disabled{% endif %}>تایید</button>
|
||||
<button type="button" class="btn btn-success btn-sm" data-bs-toggle="modal" data-bs-target="#approveModal">تایید</button>
|
||||
<button type="button" class="btn btn-danger btn-sm" data-bs-toggle="modal" data-bs-target="#rejectModal">رد</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@ -184,18 +190,28 @@
|
|||
<!-- Persistent nav in edit mode (outside cards) -->
|
||||
<div class="d-flex justify-content-between mt-3">
|
||||
{% if previous_step %}
|
||||
<a href="{% url 'processes:step_detail' instance.id previous_step.id %}" class="btn btn-label-secondary">قبلی</a>
|
||||
<a href="{% url 'processes:step_detail' instance.id previous_step.id %}" class="btn btn-label-secondary">
|
||||
<i class="bx bx-chevron-right bx-sm ms-sm-n2"></i>
|
||||
قبلی
|
||||
</a>
|
||||
{% else %}
|
||||
<span></span>
|
||||
{% endif %}
|
||||
{% if next_step %}
|
||||
<a href="{% url 'processes:step_detail' instance.id next_step.id %}" class="btn btn-primary">بعدی</a>
|
||||
<a href="{% url 'processes:step_detail' instance.id next_step.id %}" class="btn btn-primary">
|
||||
بعدی
|
||||
<i class="bx bx-chevron-left bx-sm me-sm-n2"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% if not request.user|is_installer %}
|
||||
<div class="alert alert-warning">شما مجوز ثبت/ویرایش گزارش نصب را ندارید. اطلاعات به صورت فقط خواندنی نمایش داده میشود.</div>
|
||||
|
||||
{% if not user_is_installer %}
|
||||
<div class="alert alert-warning">شما مجوز ثبت/ویرایش گزارش نصب را ندارید.</div>
|
||||
{% endif %}
|
||||
|
||||
{% if user_is_installer %}
|
||||
<!-- Installation Report Form -->
|
||||
<form method="post" enctype="multipart/form-data" id="installation-report-form">
|
||||
{% csrf_token %}
|
||||
<div class="mb-3">
|
||||
|
@ -203,40 +219,40 @@
|
|||
<div class="row g-3">
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">تاریخ مراجعه</label>
|
||||
<input type="text" id="id_visited_date_display" class="form-control" placeholder="انتخاب تاریخ" {% if not request.user|is_installer %}disabled{% endif %} readonly required value="{% if report and edit_mode and report.visited_date %}{{ report.visited_date|date:'Y/m/d' }}{% endif %}">
|
||||
<input type="text" id="id_visited_date_display" class="form-control" placeholder="انتخاب تاریخ" {% if not user_is_installer %}disabled{% endif %} readonly required value="{% if report and edit_mode and report.visited_date %}{{ report.visited_date|date:'Y/m/d' }}{% endif %}">
|
||||
<input type="hidden" id="id_visited_date" name="visited_date" value="{% if report and edit_mode and report.visited_date %}{{ report.visited_date|date:'Y-m-d' }}{% endif %}">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">سریال کنتور جدید</label>
|
||||
<input type="text" class="form-control" name="new_water_meter_serial" value="{% if report and edit_mode %}{{ report.new_water_meter_serial|default_if_none:'' }}{% endif %}" {% if not request.user|is_installer %}readonly{% endif %}>
|
||||
<input type="text" class="form-control" name="new_water_meter_serial" value="{% if report and edit_mode %}{{ report.new_water_meter_serial|default_if_none:'' }}{% endif %}" {% if not user_is_installer %}readonly{% endif %}>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">شماره پلمپ</label>
|
||||
<input type="text" class="form-control" name="seal_number" value="{% if report and edit_mode %}{{ report.seal_number|default_if_none:'' }}{% endif %}" {% if not request.user|is_installer %}readonly{% endif %}>
|
||||
<input type="text" class="form-control" name="seal_number" value="{% if report and edit_mode %}{{ report.seal_number|default_if_none:'' }}{% endif %}" {% if not user_is_installer %}readonly{% endif %}>
|
||||
</div>
|
||||
<div class="col-md-3 d-flex align-items-end">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="is_meter_suspicious" id="id_is_meter_suspicious" {% if not request.user|is_installer %}disabled{% endif %} {% if report and edit_mode and report.is_meter_suspicious %}checked{% endif %}>
|
||||
<input class="form-check-input" type="checkbox" name="is_meter_suspicious" id="id_is_meter_suspicious" {% if not user_is_installer %}disabled{% endif %} {% if report and edit_mode and report.is_meter_suspicious %}checked{% endif %}>
|
||||
<label class="form-check-label" for="id_is_meter_suspicious">کنتور مشکوک است</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">UTM X</label>
|
||||
<input type="number" step="0.000001" class="form-control" name="utm_x" value="{% if report and edit_mode and report.utm_x %}{{ report.utm_x }}{% elif instance.well.utm_x %}{{ instance.well.utm_x }}{% endif %}" {% if not request.user|is_installer %}readonly{% endif %}>
|
||||
<input type="number" step="1" class="form-control" name="utm_x" value="{% if report and edit_mode and report.utm_x %}{{ report.utm_x }}{% elif instance.well.utm_x %}{{ instance.well.utm_x }}{% endif %}" {% if not user_is_installer %}readonly{% endif %}>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">UTM Y</label>
|
||||
<input type="number" step="0.000001" class="form-control" name="utm_y" value="{% if report and edit_mode and report.utm_y %}{{ report.utm_y }}{% elif instance.well.utm_y %}{{ instance.well.utm_y }}{% endif %}" {% if not request.user|is_installer %}readonly{% endif %}>
|
||||
<input type="number" step="1" class="form-control" name="utm_y" value="{% if report and edit_mode and report.utm_y %}{{ report.utm_y }}{% elif instance.well.utm_y %}{{ instance.well.utm_y }}{% endif %}" {% if not user_is_installer %}readonly{% endif %}>
|
||||
</div>
|
||||
</div>
|
||||
<div class="my-3">
|
||||
<label class="form-label">توضیحات (اختیاری)</label>
|
||||
<textarea class="form-control" rows="3" name="description" {% if not request.user|is_installer %}readonly{% endif %}>{% if report and edit_mode %}{{ report.description|default_if_none:'' }}{% endif %}</textarea>
|
||||
<textarea class="form-control" rows="3" name="description" {% if not user_is_installer %}readonly{% endif %}>{% if report and edit_mode %}{{ report.description|default_if_none:'' }}{% endif %}</textarea>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<label class="form-label mb-0">عکسها</label>
|
||||
{% if request.user|is_installer %}
|
||||
{% if user_is_installer %}
|
||||
<button type="button" class="btn btn-sm btn-outline-primary" id="btnAddPhoto"><i class="bx bx-plus"></i> افزودن عکس</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
@ -246,7 +262,7 @@
|
|||
<div class="col-6 col-md-3 mb-2" id="existing-photo-{{ p.id }}">
|
||||
<div class="position-relative border rounded p-1">
|
||||
<img class="img-fluid rounded" src="{{ p.image.url }}" alt="photo">
|
||||
{% if request.user|is_installer %}
|
||||
{% if user_is_installer %}
|
||||
<button type="button" class="btn btn-sm btn-danger position-absolute" style="top:6px; left:6px;" onclick="markDeletePhoto('{{ p.id }}')" title="حذف/برگردان"><i class="bx bx-trash"></i></button>
|
||||
{% endif %}
|
||||
<input type="hidden" name="del_photo_{{ p.id }}" id="del-photo-{{ p.id }}" value="0">
|
||||
|
@ -347,24 +363,28 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% endif %}
|
||||
<div class="mt-3 d-flex justify-content-between">
|
||||
{% if previous_step %}
|
||||
<a href="{% url 'processes:step_detail' instance.id previous_step.id %}" class="btn btn-label-secondary">قبلی</a>
|
||||
<a href="{% url 'processes:step_detail' instance.id previous_step.id %}" class="btn btn-label-secondary">
|
||||
<i class="bx bx-chevron-right bx-sm ms-sm-n2"></i>
|
||||
قبلی
|
||||
</a>
|
||||
{% else %}
|
||||
<span></span>
|
||||
{% endif %}
|
||||
<div class="d-flex gap-2">
|
||||
{% if request.user|is_installer %}
|
||||
<button type="submit" class="btn btn-primary" form="installation-report-form">ثبت گزارش</button>
|
||||
{% else %}
|
||||
<button type="button" class="btn btn-primary" disabled>ثبت گزارش</button>
|
||||
{% if user_is_installer %}
|
||||
<button type="submit" class="btn btn-success" form="installation-report-form">ثبت گزارش</button>
|
||||
{% endif %}
|
||||
{% if next_step %}
|
||||
<a href="{% url 'processes:step_detail' instance.id next_step.id %}" class="btn btn-success">بعدی</a>
|
||||
<a href="{% url 'processes:step_detail' instance.id next_step.id %}" class="btn btn-primary">
|
||||
بعدی
|
||||
<i class="bx bx-chevron-left bx-sm me-sm-n2"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -499,7 +519,6 @@
|
|||
try {
|
||||
if (sessionStorage.getItem('install_report_saved') === '1') {
|
||||
sessionStorage.removeItem('install_report_saved');
|
||||
showToast('گزارش نصب با موفقیت ثبت شد', 'success');
|
||||
}
|
||||
} catch(_) {}
|
||||
})();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue