complete first version of main proccess

This commit is contained in:
aminhashemi92 2025-08-27 07:11:26 +03:30
parent 6ff4740d04
commit f2fc2362a7
61 changed files with 3280 additions and 28 deletions

View file

@ -43,6 +43,7 @@
<tr>
<th>شناسه</th>
<th>فرآیند</th>
<th>مرحله فعلی</th>
<th>شماره اشتراک آب</th>
<th>نماینده</th>
<th>درخواست‌کننده</th>
@ -57,6 +58,7 @@
<tr>
<td>{{ inst.code }}</td>
<td>{{ inst.process.name }}</td>
<td class="text-primary">{{ inst.current_step.name|default:"--" }}</td>
<td>{{ inst.well.water_subscription_number }}</td>
<td>{% if inst.representative %}{{ inst.representative.get_full_name }}{% else %}-{% endif %}</td>
<td>{% if inst.requester %}{{ inst.requester.get_full_name }}{% else %}-{% endif %}</td>
@ -247,6 +249,10 @@
<label class="form-label" for="id_account_number">{{ customer_form.account_number.label }}</label>
{{ customer_form.account_number }}
</div>
<div class="col-sm-6">
<label class="form-label" for="id_bank_name">{{ customer_form.bank_name.label }}</label>
{{ customer_form.bank_name }}
</div>
<div class="col-sm-12">
<label class="form-label" for="id_address">{{ customer_form.address.label }}</label>
{{ customer_form.address }}
@ -426,6 +432,7 @@
case 'phone_number_2': return '#id_phone_number_2';
case 'card_number': return '#id_card_number';
case 'account_number': return '#id_account_number';
case 'bank_name': return '#id_bank_name';
case 'address': return '#id_address';
default: return '#id_' + field;
}
@ -549,6 +556,7 @@
$('#id_phone_number_2').val(resp.user.profile.phone_number_2 || '');
$('#id_card_number').val(resp.user.profile.card_number || '');
$('#id_account_number').val(resp.user.profile.account_number || '');
$('#id_bank_name').val(resp.user.profile.bank_name || '');
$('#id_address').val(resp.user.profile.address || '');
} else {
$('#id_national_code').val(nc);
@ -556,6 +564,7 @@
$('#id_phone_number_2').val('');
$('#id_card_number').val('');
$('#id_account_number').val('');
$('#id_bank_name').val('');
$('#id_address').val('');
}
setStatus('#repStatus', 'نماینده یافت شد.', 'success');
@ -570,6 +579,7 @@
$('#id_phone_number_2').val('');
$('#id_card_number').val('');
$('#id_account_number').val('');
$('#id_bank_name').val('');
$('#id_address').val('');
setStatus('#repStatus', 'نماینده یافت نشد. لطفا اطلاعات را تکمیل کنید.', 'danger');
}
@ -595,7 +605,7 @@
formData.append('card_number', $('#id_card_number').val() || '');
formData.append('account_number', $('#id_account_number').val() || '');
formData.append('address', $('#id_address').val() || '');
formData.append('bank_name', $('#id_bank_name').val() || '');
// Include WellForm fields so edits are saved
if ($('#wellFormBlock').is(':visible')) {
formData.append('electricity_subscription_number', $('#id_electricity_subscription_number').val() || '');

View file

@ -46,3 +46,5 @@ def stepper_header(instance, current_step=None):
'instance': instance,
'steps_context': steps_context,
}
# moved to _base/common/templatetags/common_tags.py

View file

@ -106,6 +106,7 @@ def lookup_representative_by_national_code(request):
'phone_number_2': profile.phone_number_2,
'card_number': profile.card_number,
'account_number': profile.account_number,
'bank_name': profile.bank_name,
'address': profile.address,
}
}
@ -135,6 +136,7 @@ def create_request_with_entities(request):
representative_phone_number_2 = request.POST.get('phone_number_2') or request.POST.get('representative_phone_number_2')
representative_card_number = request.POST.get('card_number') or request.POST.get('representative_card_number')
representative_account_number = request.POST.get('account_number') or request.POST.get('representative_account_number')
representative_bank_name = request.POST.get('bank_name') or request.POST.get('representative_bank_name')
representative_address = request.POST.get('address') or request.POST.get('representative_address')
if not process_id:
@ -174,6 +176,8 @@ def create_request_with_entities(request):
representative_profile.card_number = representative_card_number
if representative_account_number is not None:
representative_profile.account_number = representative_account_number
if representative_bank_name is not None:
representative_profile.bank_name = representative_bank_name
if representative_address is not None:
representative_profile.address = representative_address
representative_profile.save()
@ -191,6 +195,7 @@ def create_request_with_entities(request):
'address': representative_address or '',
'card_number': representative_card_number or '',
'account_number': representative_account_number or '',
'bank_name': representative_bank_name or '',
}
customer_form = CustomerForm(customer_data, instance=profile_instance)
customer_form.request = request
@ -365,6 +370,18 @@ def step_detail(request, instance_id, step_id):
return redirect('invoices:quote_preview_step', instance_id=instance.id, step_id=step.id)
elif step.order == 3: # مرحله سوم - ثبت فیش‌های واریزی
return redirect('invoices:quote_payment_step', instance_id=instance.id, step_id=step.id)
elif step.order == 4: # مرحله چهارم - قرارداد
return redirect('contracts:contract_step', instance_id=instance.id, step_id=step.id)
elif step.order == 5: # مرحله پنجم - انتخاب نصاب
return redirect('installations:installation_assign_step', instance_id=instance.id, step_id=step.id)
elif step.order == 6: # مرحله ششم - گزارش نصب
return redirect('installations:installation_report_step', instance_id=instance.id, step_id=step.id)
elif step.order == 7: # مرحله هفتم - فاکتور نهایی
return redirect('invoices:final_invoice_step', instance_id=instance.id, step_id=step.id)
elif step.order == 8: # مرحله هشتم - تسویه حساب نهایی
return redirect('invoices:final_settlement_step', instance_id=instance.id, step_id=step.id)
elif step.order == 9: # مرحله نهم - گواهی نهایی
return redirect('certificates:certificate_step', instance_id=instance.id, step_id=step.id)
# برای سایر مراحل، template عمومی نمایش داده می‌شود
step_instance = instance.step_instances.filter(step=step).first()