Commit 26a4ff88 authored by DevPilot's avatar DevPilot

fix(accounting): two more submit-blockers + rate columns too narrow for real values

بعد إصلاح أسماء الحقول، اختبرت الشاشات الثلاثة على السيرفر الحي ولقيت:

- إنشاء اعتماد مستندي: تاريخ الانتهاء NOT NULL في القاعدة بس مش required
  في الفورم — الحفظ كان بيقع بـ 500. بقى required.
- إنشاء خطاب ضمان: حقل رقم الخطاب كان required في الـ HTML بس الكنترولر
  بيتجاهله ويولّد رقمه لوحده — يعني المتصفح نفسه كان بيمنع الحفظ من غير
  ما توصل السيرفر أصلًا. بقى للعرض بس زي رقم القرض.
- bank_loans.interest_rate و letters_of_guarantee.commission_rate كانوا
  DECIMAL(5,4) — أقصى قيمة 9.9999%. أي سعر فايدة حقيقي (15%، 22%...
  معدلات مصرية عادية) كان يفشل بـ Out of range. اتوسّعوا لـ DECIMAL(7,4).
parent 3479e8e6
......@@ -60,7 +60,7 @@
<div style="display:grid;grid-template-columns:1fr 1fr;gap:15px;margin-bottom:15px;">
<div>
<label class="form-label">تاريخ الانتهاء</label>
<input type="date" name="expiry_date" value="<?= e($credit['expiry_date'] ?? '') ?>" class="form-control">
<input type="date" name="expiry_date" value="<?= e($credit['expiry_date'] ?? '') ?>" class="form-control" required>
</div>
<div>
<label class="form-label">تاريخ الشحن (اختياري)</label>
......
......@@ -10,10 +10,13 @@
<?= csrf_field() ?>
<div style="display:grid;grid-template-columns:1fr 1fr;gap:15px;margin-bottom:15px;">
<?php if (!empty($guarantee['guarantee_number'])): ?>
<div>
<label class="form-label">رقم خطاب الضمان</label>
<input type="text" name="guarantee_number" value="<?= e($guarantee['guarantee_number'] ?? '') ?>" class="form-control" required>
<input type="text" value="<?= e($guarantee['guarantee_number']) ?>" class="form-control" disabled>
<small style="color:#6B7280;">مُولَّد تلقائيًا — لا يمكن تعديله</small>
</div>
<?php endif; ?>
<div>
<label class="form-label">نوع الضمان</label>
<select name="guarantee_type" class="form-select" required>
......
<?php
declare(strict_types=1);
/**
* bank_loans.interest_rate و letters_of_guarantee.commission_rate كانوا
* DECIMAL(5,4) — أقصى قيمة ٩.٩٩٩٩٪. أي قرض بسعر فايدة حقيقي (15%، 22%،
* إلخ — معدلات مصرية عادية) كان بيفشل بـ "Out of range value" عند الحفظ.
*/
return [
'up' => "
ALTER TABLE `bank_loans`
MODIFY COLUMN `interest_rate` DECIMAL(7,4) NOT NULL;
ALTER TABLE `letters_of_guarantee`
MODIFY COLUMN `commission_rate` DECIMAL(7,4) NOT NULL DEFAULT 0;
",
'down' => "
ALTER TABLE `bank_loans`
MODIFY COLUMN `interest_rate` DECIMAL(5,4) NOT NULL;
ALTER TABLE `letters_of_guarantee`
MODIFY COLUMN `commission_rate` DECIMAL(5,4) NOT NULL DEFAULT 0;
",
];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment