fix date in payment and imporove contract page.

This commit is contained in:
aminhashemi92 2025-09-08 16:55:43 +03:30
parent af40e169ae
commit 204b0aa48e
14 changed files with 295 additions and 74 deletions

View file

@ -2,45 +2,71 @@
<html lang="fa" dir="rtl">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>چاپ قرارداد {{ instance.code }}</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
{% load static %}
<!-- Match app fonts and theme -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Public+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500,1,600,1,700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="{% static 'assets/vendor/fonts/boxicons.css' %}">
<link rel="stylesheet" href="{% static 'assets/vendor/fonts/fontawesome.css' %}">
<link rel="stylesheet" href="{% static 'assets/vendor/css/rtl/core.css' %}">
<link rel="stylesheet" href="{% static 'assets/vendor/css/rtl/theme-default.css' %}">
<link rel="stylesheet" href="{% static 'assets/css/demo.css' %}">
<link rel="stylesheet" href="{% static 'assets/css/persian-fonts.css' %}">
<style>
@page { size: A4; margin: 1.2cm; }
body { font-family: 'Vazirmatn', sans-serif; }
.logo { max-height: 80px; }
.signature { height: 90px; border: 1px dashed #ccc; }
.invoice-header { border-bottom: 1px solid #dee2e6; padding-bottom: 16px; margin-bottom: 24px; }
.brand-box { width:64px; height:64px; display:flex; align-items:center; justify-content:center; background:#eef2ff; border-radius:8px; }
.logo { max-height: 58px; max-width: 120px; }
.contract-title { font-size: 20px; font-weight: 600; }
.small-muted { font-size: 12px; color: #6c757d; }
.signature-box { border: 1px dashed #ccc; height: 210px; display:flex; align-items:center; justify-content:center; }
</style>
<script>
window.addEventListener('load', function(){ setTimeout(function(){ window.print(); }, 300); });
window.onload = function(){
window.print();
setTimeout(function(){ window.close(); }, 200);
};
</script>
</head>
<body>
<div class="container-fluid">
<div class="d-flex justify-content-between align-items-center mb-3">
<div>
<h5>{{ contract.template.company.name }}</h5>
<h5 class="mb-1">{{ contract.template.name }}</h5>
<div class="text-muted small">کد درخواست: {{ instance.code }} | تاریخ: {{ contract.jcreated }}</div>
</div>
{% if contract.template.company.logo %}
<img class="logo" src="{{ contract.template.company.logo.url }}" alt="لوگو" />
{% endif %}
<!-- Header: Company and contract info -->
<div class="invoice-header">
<div class="small text-end text-muted mb-2">تاریخ: {{ contract.jcreated_date }} | کد درخواست: {{ instance.code }}</div>
<h5 class="text-center mb-3">
{% if instance.broker and instance.broker.company %}
{{ instance.broker.company.name }}
{% elif template.company %}
{{ template.company.name }}
{% else %}
شرکت آب منطقه‌ای
{% endif %}
</h5>
<h4 class="text-center mb-3">{{ contract.template.name }}</h4>
</div>
<hr>
<!-- Contract body -->
<div style="white-space: pre-line; line-height: 1.9;">{{ contract.rendered_body|safe }}</div>
<hr>
<!-- Signatures -->
<div class="row mt-4">
<div class="col-6 text-center">
<div>امضای مشترک</div>
<div class="signature mt-2"></div>
<div class="signature-box mt-2"></div>
</div>
<div class="col-6 text-center">
<div>امضای شرکت</div>
<div class="signature mt-2">
{% if contract.template.company.signature %}
<img src="{{ contract.template.company.signature.url }}" alt="امضای شرکت" style="max-height: 80px;" />
<div class="signature-box mt-2">
{% if instance.broker and instance.broker.company and instance.broker.company.signature %}
<img src="{{ instance.broker.company.signature.url }}" alt="امضای شرکت" style="max-height: 200px;" />
{% elif contract.template.company and contract.template.company.signature %}
<img src="{{ contract.template.company.signature.url }}" alt="امضای شرکت" style="max-height: 200px;" />
{% endif %}
</div>
</div>

View file

@ -19,6 +19,10 @@
{% 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">
@ -26,13 +30,18 @@
<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>
<div class="d-flex gap-2">
<a href="{% url 'processes:request_list' %}" class="btn btn-outline-secondary">بازگشت</a>
<a href="{% url 'contracts:contract_print' instance.id %}" target="_blank" class="btn btn-outline-secondary">پرینت</a>
<a href="{% url 'contracts:contract_print' instance.id %}" target="_blank" class="btn btn-outline-secondary">
<i class="bx bx-printer me-2"></i> پرینت
</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>
@ -41,29 +50,32 @@
<div class="bs-stepper-content">
<div class="card border">
<div class="card-body">
<div class="small text-end text-muted mb-2">تاریخ: {{ contract.jcreated_date }} | کد درخواست: {{ instance.code }}</div>
<h5 class="text-center mb-3">
{% if instance.broker and instance.broker.company %}
{{ instance.broker.company.name }}
{% elif template.company %}
{{ template.company.name }}
{% else %}
شرکت آب منطقه‌ای
{% endif %}</h5>
<h4 class="text-center mb-3">{{ contract.template.name }}</h4>
{% if can_view_contract_body %}
{% if template.company.logo %}
<div class="text-center mb-3">
<img src="{{ template.company.logo.url }}" alt="لوگوی شرکت" style="max-height:80px;">
<h4 class="text-muted">{{ contract.template.company.name }}</h4>
<h5 class="text-muted">{{ contract.template.name }}</h5>
</div>
{% endif %}
<div class="small text-muted mb-2">تاریخ: {{ contract.jcreated }}</div>
<hr>
<div class="contract-body" style="white-space: pre-line; line-height:1.9;">{{ contract.rendered_body|safe }}</div>
<hr>
<div class="row mt-4">
<div class="col-6 text-center">
<div>امضای مشترک</div>
<div style="height:90px;border:1px dashed #ccc; margin-top:10px;"></div>
<div style="height:210px;border:1px dashed #ccc; margin-top:10px;"></div>
</div>
<div class="col-6 text-center">
<div>امضای شرکت</div>
<div style="height:90px;border:1px dashed #ccc; margin-top:10px;">
{% if template.company.signature %}
<img src="{{ template.company.signature.url }}" alt="امضای شرکت" style="max-height:80px;">
<div style="height:210px;border:1px dashed #ccc; margin-top:10px;">
{% if instance.broker and instance.broker.company and instance.broker.company.signature %}
<img src="{{ instance.broker.company.signature.url }}" alt="امضای شرکت" style="max-height:200px;">
{% elif template.company and template.company.signature %}
<img src="{{ template.company.signature.url }}" alt="امضای شرکت" style="max-height:200px;">
{% endif %}
</div>
</div>
@ -76,15 +88,23 @@
<form method="post" class="d-flex justify-content-between mt-3">
{% csrf_token %}
{% 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 me-sm-2"></i>
قبلی
</a>
{% else %}
<span></span>
{% endif %}
{% if next_step %}
{% if is_broker %}
<button type="submit" class="btn btn-primary">تایید و بعدی</button>
<button type="submit" class="btn btn-primary">تایید و بعدی
<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 %}
{% else %}
{% if is_broker %}