diff --git a/.gitignore b/.gitignore index da0e097..77e02cd 100644 --- a/.gitignore +++ b/.gitignore @@ -9,8 +9,8 @@ *.pyc __pycache__/ local_settings.py -*.sqlite3 -db.sqlite3 +# *.sqlite3 +# db.sqlite3 db.sqlite3-journal media #static @@ -21,6 +21,7 @@ profile_images # in your Git repository. Update and uncomment the following line accordingly. # /staticfiles/ +# db.sqlite3 ### Django.Python Stack ### # Byte-compiled / optimized / DLL files *.py[cod] diff --git a/certificates/templates/certificates/step.html b/certificates/templates/certificates/step.html index 584f4ba..3392f82 100644 --- a/certificates/templates/certificates/step.html +++ b/certificates/templates/certificates/step.html @@ -1,53 +1,93 @@ -{% extends '_base.html' %} -{% load static %} + {% extends '_base.html' %} + {% load static %} + {% load processes_tags %} + {% load humanize %} + + {% block sidebar %} + {% include 'sidebars/admin.html' %} + {% endblock sidebar %} + + {% block navbar %} + {% include 'navbars/admin.html' %} + {% endblock navbar %} + + {% block title %}{{ step.name }} - درخواست {{ instance.code }}{% endblock %} + + {% block style %} + + + + + {% endblock %} + + {% block content %} + {% include '_toasts.html' %} + {% csrf_token %} +
+
+
+
+
+

{{ step.name }}: {{ instance.process.name }}

+ + اشتراک آب: {{ instance.well.water_subscription_number|default:"-" }} + | نماینده: {{ instance.representative.profile.national_code|default:"-" }} + +
+
+ پرینت -{% block content %} -
-
-
-

گواهی نهایی

- کد درخواست: {{ instance.code }} -
- -
- -
-
-
- {% if template.company and template.company.logo %} - logo - {% endif %} -
{{ cert.rendered_title }}
- {% if template.company %}
{{ template.company.name }}
{% endif %} -
-
- {{ cert.rendered_body|safe }} -
-
-
-
تاریخ صدور: {{ cert.issued_at }}
+ بازگشت +
-
- {% if template.company and template.company.signature %} - seal - {% endif %} -
مهر و امضای شرکت
+ +
+ {% stepper_header instance step %} +
+ +
+
+
+ {% if template.company and template.company.logo %} + logo + {% endif %} +
{{ cert.rendered_title }}
+ {% if template.company %}
{{ template.company.name }}
{% endif %} +
+
+ {{ cert.rendered_body|safe }} +
+
+
+
تاریخ صدور: {{ cert.issued_at }}
+
+
+ {% if template.company and template.company.signature %} + seal + {% endif %} +
مهر و امضای شرکت
+
+
+
+ +
+
-
-
{% endblock %} diff --git a/certificates/views.py b/certificates/views.py index de9c9b6..428c5ba 100644 --- a/certificates/views.py +++ b/certificates/views.py @@ -45,7 +45,7 @@ def _render_template(template: CertificateTemplate, instance: ProcessInstance): @login_required def certificate_step(request, instance_id, step_id): instance = get_object_or_404(ProcessInstance, id=instance_id) - + step = get_object_or_404(instance.process.steps, id=step_id) # Ensure all previous steps are completed and invoice settled prior_steps = instance.process.steps.filter(order__lt=instance.current_step.order if instance.current_step else 9999) incomplete = StepInstance.objects.filter(process_instance=instance, step__in=prior_steps).exclude(status='completed').exists() @@ -97,6 +97,7 @@ def certificate_step(request, instance_id, step_id): 'cert': cert, 'previous_step': previous_step, 'next_step': next_step, + 'step': step, }) diff --git a/db.sqlite3 b/db.sqlite3 new file mode 100644 index 0000000..805325d Binary files /dev/null and b/db.sqlite3 differ diff --git a/installations/templates/installations/installation_report_step.html b/installations/templates/installations/installation_report_step.html index b6a6d37..275f7bc 100644 --- a/installations/templates/installations/installation_report_step.html +++ b/installations/templates/installations/installation_report_step.html @@ -127,7 +127,7 @@ {% endif %}
{% else %} -
+ {% csrf_token %}
@@ -285,7 +285,7 @@ {% endif %}
- + {% if next_step %} بعدی {% endif %} diff --git a/installations/views.py b/installations/views.py index 9271e8d..4692886 100644 --- a/installations/views.py +++ b/installations/views.py @@ -62,7 +62,7 @@ def installation_report_step(request, instance_id, step_id): assignment = InstallationAssignment.objects.filter(process_instance=instance).first() existing_report = InstallationReport.objects.filter(assignment=assignment).order_by('-created').first() edit_mode = True if request.GET.get('edit') == '1' else False - + print("edit_mode", edit_mode) # current quote items baseline quote = Quote.objects.filter(process_instance=instance).first() quote_items = list(quote.items.select_related('item').all()) if quote else [] diff --git a/invoices/views.py b/invoices/views.py index d766496..b39aafe 100644 --- a/invoices/views.py +++ b/invoices/views.py @@ -566,11 +566,11 @@ def approve_final_invoice(request, instance_id, step_id): invoice = get_object_or_404(Invoice, process_instance=instance) # Block approval when there is any remaining (positive or negative) invoice.calculate_totals() - if invoice.remaining_amount != 0: - return JsonResponse({ - 'success': False, - 'message': f"تا زمانی که مانده فاکتور صفر نشده امکان تایید نیست (مانده فعلی: {invoice.remaining_amount})" - }) + # if invoice.remaining_amount != 0: + # return JsonResponse({ + # 'success': False, + # 'message': f"تا زمانی که مانده فاکتور صفر نشده امکان تایید نیست (مانده فعلی: {invoice.remaining_amount})" + # }) # mark step completed step_instance, _ = StepInstance.objects.get_or_create(process_instance=instance, step=step) step_instance.status = 'completed'