Commit c6327cf7 authored by Mahmoud Aglan's avatar Mahmoud Aglan

Expand wizard payment step: all 7 methods, partial, split, transaction refs

Payment modes:
- Full (default): pays entire invoice amount
- Partial: enter amount paid now, remainder stays as balance due on invoice
- Split: two methods, amount1 + calculated remainder, both recorded as payments

All 7 PaymentMethod values now available:
- cash: no extra fields
- card: transaction_reference (required)
- bank_transfer: transaction_reference (required), bank_name (optional)
- online (Instapay/digital wallets): transaction_reference (required)
- wallet (club wallet): deducts from member balance
- cheque: cheque_number (required), bank_name (optional)
- other: notes field

Each payment recorded with gateway_data JSON (ref, cheque_number, bank_name)
Enrollment payment_status only set to 'paid' when full amount covered
Validation rules built dynamically from active mode + method combination
Co-Authored-By: 's avatarClaude Sonnet 4.6 <noreply@anthropic.com>
parent 2be39175
...@@ -78,6 +78,22 @@ class NewRegistrationWizard extends Component ...@@ -78,6 +78,22 @@ class NewRegistrationWizard extends Component
// Step 6: Payment // Step 6: Payment
public bool $pay_now = false; public bool $pay_now = false;
public string $payment_method = 'cash'; public string $payment_method = 'cash';
public string $payment_transaction_ref = ''; // for card/bank_transfer/online/cheque
public string $payment_cheque_number = ''; // cheque only
public string $payment_bank_name = ''; // cheque/bank_transfer
public string $payment_notes = '';
// Partial payment
public bool $partial_payment = false;
public string $partial_amount_input = ''; // EGP string from user (converted to piasters on save)
// Split payment (two methods)
public bool $split_payment = false;
public string $split_method2 = 'cash';
public string $split_amount1_input = ''; // amount for method 1
public string $split_transaction_ref2 = '';
public string $split_cheque_number2 = '';
public string $split_bank_name2 = '';
// Super-admin price override // Super-admin price override
public bool $priceOverrideEnabled = false; public bool $priceOverrideEnabled = false;
...@@ -283,9 +299,7 @@ private function rulesForStep(int $step): array ...@@ -283,9 +299,7 @@ private function rulesForStep(int $step): array
'selected_activity_id' => 'required|exists:activities,id', 'selected_activity_id' => 'required|exists:activities,id',
'selected_program_id' => 'required|exists:training_programs,id', 'selected_program_id' => 'required|exists:training_programs,id',
], ],
6 => [ 6 => $this->paymentStepRules(),
'payment_method' => 'required_if:pay_now,true|in:cash,card,wallet',
],
default => [], default => [],
}; };
} }
...@@ -314,9 +328,75 @@ public function messages(): array ...@@ -314,9 +328,75 @@ public function messages(): array
'selected_activity_id.exists' => 'النشاط المختار غير موجود', 'selected_activity_id.exists' => 'النشاط المختار غير موجود',
'selected_program_id.required' => 'يرجى اختيار البرنامج', 'selected_program_id.required' => 'يرجى اختيار البرنامج',
'selected_program_id.exists' => 'البرنامج المختار غير موجود', 'selected_program_id.exists' => 'البرنامج المختار غير موجود',
'payment_method.required_if' => 'يرجى اختيار طريقة الدفع', 'payment_method.required_if' => 'يرجى اختيار طريقة الدفع',
'payment_method.in' => 'طريقة الدفع غير صالحة', 'payment_method.in' => 'طريقة الدفع غير صالحة',
'payment_transaction_ref.required_if' => 'رقم المرجع / رقم العملية مطلوب لهذه الطريقة',
'payment_cheque_number.required_if' => 'رقم الشيك مطلوب',
'partial_amount_input.required_if' => 'المبلغ المدفوع مطلوب',
'partial_amount_input.numeric' => 'المبلغ يجب أن يكون رقماً',
'partial_amount_input.min' => 'المبلغ يجب أن يكون أكبر من صفر',
'split_amount1_input.required_if' => 'مبلغ الطريقة الأولى مطلوب',
'split_amount1_input.numeric' => 'المبلغ يجب أن يكون رقماً',
'split_amount1_input.min' => 'المبلغ يجب أن يكون أكبر من صفر',
'split_method2.required_if' => 'يرجى اختيار طريقة الدفع الثانية',
];
}
private function paymentStepRules(): array
{
if (!$this->pay_now) return [];
$methodsRequiringRef = ['card', 'bank_transfer', 'online'];
$rules = [
'payment_method' => 'required|in:cash,card,bank_transfer,wallet,online,cheque,other',
]; ];
if (in_array($this->payment_method, $methodsRequiringRef)) {
$rules['payment_transaction_ref'] = 'required|string|max:100';
}
if ($this->payment_method === 'cheque') {
$rules['payment_cheque_number'] = 'required|string|max:50';
}
if ($this->partial_payment && !$this->split_payment) {
$rules['partial_amount_input'] = 'required|numeric|min:0.01';
}
if ($this->split_payment) {
$rules['split_amount1_input'] = 'required|numeric|min:0.01';
$rules['split_method2'] = 'required|in:cash,card,bank_transfer,wallet,online,cheque,other';
if (in_array($this->split_method2, $methodsRequiringRef)) {
$rules['split_transaction_ref2'] = 'required|string|max:100';
}
if ($this->split_method2 === 'cheque') {
$rules['split_cheque_number2'] = 'required|string|max:50';
}
}
return $rules;
}
public function updatedPayNow(): void
{
if (!$this->pay_now) {
$this->partial_payment = false;
$this->split_payment = false;
}
}
public function updatedPartialPayment(): void
{
if ($this->partial_payment) {
$this->split_payment = false;
}
}
public function updatedSplitPayment(): void
{
if ($this->split_payment) {
$this->partial_payment = false;
// Pre-fill split amount 1 with half the total as a starting point
if (empty($this->split_amount1_input) && $this->effectiveTotal > 0) {
$this->split_amount1_input = number_format($this->effectiveTotal / 100 / 2, 2);
}
}
} }
public function checkDuplicates(): void public function checkDuplicates(): void
...@@ -832,25 +912,71 @@ public function confirm(): void ...@@ -832,25 +912,71 @@ public function confirm(): void
$this->invoice_number = $invoice->number; $this->invoice_number = $invoice->number;
$this->invoiceId = $invoice->id; $this->invoiceId = $invoice->id;
// 9. Record payment if paying now // 9. Record payment(s) if paying now
if ($this->pay_now) { if ($this->pay_now) {
$paymentService->recordPayment([ $basePaymentData = [
'academy_id' => app('current_academy')->id, 'academy_id' => app('current_academy')->id,
'branch_id' => $this->branchId, 'branch_id' => $this->branchId,
'invoice_id' => $invoice->id, 'invoice_id' => $invoice->id,
'reference' => 'PAY-' . now()->format('YmdHis') . '-' . $participant->id, 'direction' => 'inbound',
'direction' => 'inbound', 'payer_type' => Participant::class,
'method' => $this->payment_method, 'payer_id' => $participant->id,
'payer_type' => Participant::class, 'currency' => 'EGP',
'payer_id' => $participant->id,
'amount' => $invoice->total_amount,
'currency' => 'EGP',
'payment_date' => now()->toDateString(), 'payment_date' => now()->toDateString(),
'notes' => 'دفع اشتراك: ' . $program->name_ar, ];
], $actor);
if ($this->split_payment) {
// Two payments: amount1 + remainder
$amount1 = (int) round((float) $this->split_amount1_input * 100);
$amount2 = $invoice->total_amount - $amount1;
if ($amount1 > 0) {
$paymentService->recordPayment(array_merge($basePaymentData, [
'reference' => 'PAY-' . now()->format('YmdHis') . 'A-' . $participant->id,
'method' => $this->payment_method,
'amount' => $amount1,
'notes' => $this->buildPaymentNotes($this->payment_method, $this->payment_transaction_ref, $this->payment_cheque_number, $this->payment_bank_name, $program->name_ar),
'gateway_data' => $this->buildGatewayData($this->payment_method, $this->payment_transaction_ref, $this->payment_cheque_number, $this->payment_bank_name),
]), $actor);
}
if ($amount2 > 0) {
$paymentService->recordPayment(array_merge($basePaymentData, [
'reference' => 'PAY-' . now()->format('YmdHis') . 'B-' . $participant->id,
'method' => $this->split_method2,
'amount' => $amount2,
'notes' => $this->buildPaymentNotes($this->split_method2, $this->split_transaction_ref2, $this->split_cheque_number2, $this->split_bank_name2, $program->name_ar),
'gateway_data' => $this->buildGatewayData($this->split_method2, $this->split_transaction_ref2, $this->split_cheque_number2, $this->split_bank_name2),
]), $actor);
}
} elseif ($this->partial_payment) {
// One partial payment — balance stays on invoice
$paidAmount = (int) round((float) $this->partial_amount_input * 100);
if ($paidAmount > 0) {
$paymentService->recordPayment(array_merge($basePaymentData, [
'reference' => 'PAY-' . now()->format('YmdHis') . '-' . $participant->id,
'method' => $this->payment_method,
'amount' => $paidAmount,
'notes' => $this->buildPaymentNotes($this->payment_method, $this->payment_transaction_ref, $this->payment_cheque_number, $this->payment_bank_name, $program->name_ar),
'gateway_data' => $this->buildGatewayData($this->payment_method, $this->payment_transaction_ref, $this->payment_cheque_number, $this->payment_bank_name),
]), $actor);
}
} else {
// Full payment
$paymentService->recordPayment(array_merge($basePaymentData, [
'reference' => 'PAY-' . now()->format('YmdHis') . '-' . $participant->id,
'method' => $this->payment_method,
'amount' => $invoice->total_amount,
'notes' => $this->buildPaymentNotes($this->payment_method, $this->payment_transaction_ref, $this->payment_cheque_number, $this->payment_bank_name, $program->name_ar),
'gateway_data' => $this->buildGatewayData($this->payment_method, $this->payment_transaction_ref, $this->payment_cheque_number, $this->payment_bank_name),
]), $actor);
}
$this->payment_recorded = true; $this->payment_recorded = true;
$enrollment->update(['payment_status' => 'paid']); // Only mark enrollment paid if full amount covered
$paidSoFar = $invoice->fresh()->paid_amount ?? 0;
if ($paidSoFar >= $invoice->total_amount) {
$enrollment->update(['payment_status' => 'paid']);
}
} }
} }
...@@ -872,6 +998,25 @@ public function confirm(): void ...@@ -872,6 +998,25 @@ public function confirm(): void
} }
} }
private function buildPaymentNotes(string $method, string $ref, string $cheque, string $bank, string $programName): string
{
$parts = ['دفع اشتراك: ' . $programName];
if ($ref) $parts[] = 'رقم العملية: ' . $ref;
if ($cheque) $parts[] = 'رقم الشيك: ' . $cheque;
if ($bank) $parts[] = 'البنك: ' . $bank;
if ($this->payment_notes) $parts[] = $this->payment_notes;
return implode(' | ', $parts);
}
private function buildGatewayData(string $method, string $ref, string $cheque, string $bank): array
{
$data = [];
if ($ref) $data['transaction_reference'] = $ref;
if ($cheque) $data['cheque_number'] = $cheque;
if ($bank) $data['bank_name'] = $bank;
return $data;
}
private function resolveProgramFee(TrainingProgram $program): int private function resolveProgramFee(TrainingProgram $program): int
{ {
$query = BasePrice::where('priceable_type', TrainingProgram::class) $query = BasePrice::where('priceable_type', TrainingProgram::class)
......
...@@ -835,12 +835,13 @@ class="flex-1 sm:flex-none inline-flex items-center justify-center gap-2 px-6 py ...@@ -835,12 +835,13 @@ class="flex-1 sm:flex-none inline-flex items-center justify-center gap-2 px-6 py
{{-- ===================== STEP 6: PAYMENT ===================== --}} {{-- ===================== STEP 6: PAYMENT ===================== --}}
@if($currentStep === 6) @if($currentStep === 6)
<div> <div>
<h2 class="text-lg font-semibold text-gray-800 mb-6">{{ __('الدفع') }}</h2> <h2 class="text-lg font-semibold text-gray-800 mb-4">{{ __('الدفع') }}</h2>
{{-- Total Banner --}}
@if($this->effectiveTotal > 0) @if($this->effectiveTotal > 0)
<div class="p-4 bg-blue-50 border border-blue-200 rounded-xl mb-6"> <div class="p-4 bg-blue-50 border border-blue-200 rounded-xl mb-5">
<div class="flex items-center justify-between pt-2"> <div class="flex items-center justify-between">
<span class="text-blue-700 font-semibold">{{ __('الإجمالي المطلوب') }}</span> <span class="text-blue-700 font-semibold text-sm">{{ __('الإجمالي المطلوب') }}</span>
<span class="text-xl font-bold text-blue-800" dir="ltr"> <span class="text-xl font-bold text-blue-800" dir="ltr">
{{ number_format($this->effectiveTotal / 100, 2) }} {{ __('ج.م') }} {{ number_format($this->effectiveTotal / 100, 2) }} {{ __('ج.م') }}
</span> </span>
...@@ -850,57 +851,228 @@ class="flex-1 sm:flex-none inline-flex items-center justify-center gap-2 px-6 py ...@@ -850,57 +851,228 @@ class="flex-1 sm:flex-none inline-flex items-center justify-center gap-2 px-6 py
@endif @endif
</div> </div>
@else @else
<div class="p-4 bg-gray-50 border border-gray-200 rounded-xl mb-6"> <div class="p-4 bg-gray-50 border border-gray-200 rounded-xl mb-5">
<p class="text-gray-600 text-sm">{{ __('لا يوجد سعر محدد — سيتم التسجيل بدون فاتورة.') }}</p> <p class="text-gray-600 text-sm">{{ __('لا يوجد سعر محدد — سيتم التسجيل بدون فاتورة.') }}</p>
</div> </div>
@endif @endif
<div class="space-y-6"> <div class="space-y-5">
<div class="flex items-center gap-4">
<label class="relative cursor-pointer" dir="ltr"> {{-- Pay Now Toggle --}}
<input type="checkbox" wire:model.live="pay_now" class="peer sr-only"> @if($this->effectiveTotal > 0)
<div class="w-14 h-8 rounded-full bg-gray-300 peer-checked:bg-green-500 transition-colors after:content-[''] after:absolute after:top-1 after:left-1 after:w-6 after:h-6 after:bg-white after:rounded-full after:transition-all peer-checked:after:translate-x-6"></div> <div class="flex items-center gap-4">
<label class="relative cursor-pointer" dir="ltr">
<input type="checkbox" wire:model.live="pay_now" class="peer sr-only">
<div class="w-14 h-8 rounded-full bg-gray-300 peer-checked:bg-green-500 transition-colors after:content-[''] after:absolute after:top-1 after:left-1 after:w-6 after:h-6 after:bg-white after:rounded-full after:transition-all peer-checked:after:translate-x-6"></div>
</label>
<span class="text-base font-medium text-gray-700">{{ __('الدفع الآن') }}</span>
</div>
@endif
@if(!$pay_now)
<div class="p-4 bg-amber-50 border border-amber-200 rounded-xl">
<p class="text-amber-700 text-sm">{{ __('سيتم إنشاء فاتورة مستحقة. يمكن الدفع لاحقًا من شاشة تحصيل المدفوعات.') }}</p>
</div>
@endif
@if($pay_now)
{{-- Payment Mode Selector (full / partial / split) --}}
<div class="grid grid-cols-3 gap-2">
<button type="button"
wire:click="$set('partial_payment', false); $set('split_payment', false)"
class="py-2.5 px-3 rounded-lg border text-sm font-medium transition-colors
{{ !$partial_payment && !$split_payment ? 'bg-green-600 text-white border-green-600' : 'bg-white text-gray-600 border-gray-300 hover:border-gray-400' }}">
{{ __('كامل') }}
</button>
<button type="button"
wire:click="$set('partial_payment', true); $set('split_payment', false)"
class="py-2.5 px-3 rounded-lg border text-sm font-medium transition-colors
{{ $partial_payment ? 'bg-orange-500 text-white border-orange-500' : 'bg-white text-gray-600 border-gray-300 hover:border-gray-400' }}">
{{ __('جزئي') }}
</button>
<button type="button"
wire:click="$set('split_payment', true); $set('partial_payment', false)"
class="py-2.5 px-3 rounded-lg border text-sm font-medium transition-colors
{{ $split_payment ? 'bg-purple-600 text-white border-purple-600' : 'bg-white text-gray-600 border-gray-300 hover:border-gray-400' }}">
{{ __('مقسم') }}
</button>
</div>
{{-- ===== PARTIAL AMOUNT INPUT ===== --}}
@if($partial_payment)
<div class="p-4 bg-orange-50 border border-orange-200 rounded-xl space-y-3">
<p class="text-sm text-orange-700 font-medium">{{ __('أدخل المبلغ المدفوع الآن — الباقي يبقى مستحقاً على الفاتورة') }}</p>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">{{ __('المبلغ المدفوع') }} ({{ __('ج.م') }})</label>
<input type="number" step="0.01" min="0.01" wire:model.live="partial_amount_input"
class="w-full rounded-lg border-gray-300 focus:ring-orange-500 focus:border-orange-500"
placeholder="{{ number_format($this->effectiveTotal / 100, 2) }}" dir="ltr">
@error('partial_amount_input') <p class="mt-1 text-xs text-red-600">{{ $message }}</p> @enderror
</div>
@if($partial_amount_input && is_numeric($partial_amount_input) && $this->effectiveTotal > 0)
@php $remaining = $this->effectiveTotal - (int) round((float) $partial_amount_input * 100); @endphp
@if($remaining > 0)
<p class="text-xs text-orange-600">{{ __('المتبقي المستحق') }}: <strong dir="ltr">{{ number_format($remaining / 100, 2) }} {{ __('ج.م') }}</strong></p>
@endif
@endif
</div>
@endif
{{-- ===== SPLIT AMOUNT INPUT ===== --}}
@if($split_payment)
<div class="p-4 bg-purple-50 border border-purple-200 rounded-xl">
<p class="text-sm text-purple-700 font-medium mb-3">{{ __('ادفع بطريقتين مختلفتين — مجموعهما يساوي الإجمالي') }}</p>
<div class="mb-3">
<label class="block text-sm font-medium text-gray-700 mb-1">{{ __('مبلغ الطريقة الأولى') }} ({{ __('ج.م') }})</label>
<input type="number" step="0.01" min="0.01" wire:model.live="split_amount1_input"
class="w-full rounded-lg border-gray-300 focus:ring-purple-500"
dir="ltr">
@error('split_amount1_input') <p class="mt-1 text-xs text-red-600">{{ $message }}</p> @enderror
</div>
@if($split_amount1_input && is_numeric($split_amount1_input) && $this->effectiveTotal > 0)
@php $amount2 = $this->effectiveTotal - (int) round((float) $split_amount1_input * 100); @endphp
<p class="text-xs text-purple-600 mb-3">{{ __('الطريقة الثانية') }}: <strong dir="ltr">{{ number_format(max(0, $amount2) / 100, 2) }} {{ __('ج.م') }}</strong></p>
@endif
</div>
@endif
{{-- ===== METHOD PICKER (Method 1) ===== --}}
@php
$methods = [
'cash' => ['label' => 'نقدي', 'color' => 'green', 'icon' => 'M17 9V7a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2m2 4h10a2 2 0 002-2v-6a2 2 0 00-2-2H9a2 2 0 00-2 2v6a2 2 0 002 2zm7-5a2 2 0 11-4 0 2 2 0 014 0z'],
'card' => ['label' => 'بطاقة بنكية', 'color' => 'blue', 'icon' => 'M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z'],
'bank_transfer' => ['label' => 'تحويل بنكي', 'color' => 'sky', 'icon' => 'M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4'],
'online' => ['label' => 'إنستاباي / محافظ', 'color' => 'indigo', 'icon' => 'M12 18h.01M8 21h8a2 2 0 002-2V5a2 2 0 00-2-2H8a2 2 0 00-2 2v14a2 2 0 002 2z'],
'wallet' => ['label' => 'محفظة النادي', 'color' => 'purple', 'icon' => 'M3 10h18M3 6h18M3 14h18M3 18h18'],
'cheque' => ['label' => 'شيك', 'color' => 'yellow', 'icon' => 'M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z'],
'other' => ['label' => 'أخرى', 'color' => 'gray', 'icon' => 'M5 12h.01M12 12h.01M19 12h.01M6 12a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0z'],
];
$colorMap = [
'green' => ['checked' => 'peer-checked:border-green-500 peer-checked:bg-green-50 peer-checked:text-green-700'],
'blue' => ['checked' => 'peer-checked:border-blue-500 peer-checked:bg-blue-50 peer-checked:text-blue-700'],
'sky' => ['checked' => 'peer-checked:border-sky-500 peer-checked:bg-sky-50 peer-checked:text-sky-700'],
'indigo' => ['checked' => 'peer-checked:border-indigo-500 peer-checked:bg-indigo-50 peer-checked:text-indigo-700'],
'purple' => ['checked' => 'peer-checked:border-purple-500 peer-checked:bg-purple-50 peer-checked:text-purple-700'],
'yellow' => ['checked' => 'peer-checked:border-yellow-500 peer-checked:bg-yellow-50 peer-checked:text-yellow-700'],
'gray' => ['checked' => 'peer-checked:border-gray-500 peer-checked:bg-gray-100 peer-checked:text-gray-700'],
];
@endphp
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">
{{ $split_payment ? __('طريقة الدفع الأولى') : __('طريقة الدفع') }}
</label>
<div class="grid grid-cols-4 sm:grid-cols-7 gap-2">
@foreach($methods as $value => $meta)
<label class="relative cursor-pointer">
<input type="radio" wire:model.live="payment_method" value="{{ $value }}" class="peer sr-only">
<div class="p-2 min-h-[60px] flex flex-col items-center justify-center gap-1 border border-gray-300 rounded-xl transition-all hover:border-gray-400 {{ $colorMap[$meta['color']]['checked'] }}">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="{{ $meta['icon'] }}"/>
</svg>
<span class="text-xs font-medium text-center leading-tight">{{ $meta['label'] }}</span>
</div>
</label>
@endforeach
</div>
@error('payment_method') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
{{-- ===== METHOD-SPECIFIC FIELDS (Method 1) ===== --}}
@if(in_array($payment_method, ['card', 'bank_transfer', 'online']))
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">
{{ $payment_method === 'online' ? __('رقم العملية / كود الإنستاباي') : __('رقم العملية / المرجع') }}
<span class="text-red-500">*</span>
</label>
<input type="text" wire:model="payment_transaction_ref" dir="ltr"
class="w-full rounded-lg border-gray-300 focus:ring-blue-500"
placeholder="TXN-XXXX">
@error('payment_transaction_ref') <p class="mt-1 text-xs text-red-600">{{ $message }}</p> @enderror
</div>
@endif
@if($payment_method === 'cheque')
<div class="grid grid-cols-2 gap-3">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">{{ __('رقم الشيك') }} <span class="text-red-500">*</span></label>
<input type="text" wire:model="payment_cheque_number" dir="ltr"
class="w-full rounded-lg border-gray-300 focus:ring-yellow-500">
@error('payment_cheque_number') <p class="mt-1 text-xs text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">{{ __('اسم البنك') }}</label>
<input type="text" wire:model="payment_bank_name"
class="w-full rounded-lg border-gray-300 focus:ring-yellow-500">
</div>
</div>
@endif
@if($payment_method === 'bank_transfer')
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">{{ __('اسم البنك') }}</label>
<input type="text" wire:model="payment_bank_name"
class="w-full rounded-lg border-gray-300 focus:ring-sky-500">
</div>
@endif
{{-- ===== SPLIT: METHOD 2 ===== --}}
@if($split_payment)
<div class="border-t border-purple-200 pt-4 space-y-3">
<label class="block text-sm font-medium text-gray-700 mb-2">{{ __('طريقة الدفع الثانية') }}</label>
<div class="grid grid-cols-4 sm:grid-cols-7 gap-2">
@foreach($methods as $value => $meta)
<label class="relative cursor-pointer">
<input type="radio" wire:model.live="split_method2" value="{{ $value }}" class="peer sr-only">
<div class="p-2 min-h-[60px] flex flex-col items-center justify-center gap-1 border border-gray-300 rounded-xl transition-all hover:border-gray-400 {{ $colorMap[$meta['color']]['checked'] }}">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="{{ $meta['icon'] }}"/>
</svg>
<span class="text-xs font-medium text-center leading-tight">{{ $meta['label'] }}</span>
</div>
</label> </label>
<span class="text-base font-medium text-gray-700">{{ __('الدفع الآن') }}</span> @endforeach
</div> </div>
@error('split_method2') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror
@if($pay_now) @if(in_array($split_method2, ['card', 'bank_transfer', 'online']))
<div> <div>
<label class="block text-sm font-medium text-gray-700 mb-3">{{ __('طريقة الدفع') }}</label> <label class="block text-sm font-medium text-gray-700 mb-1">{{ __('رقم العملية') }} <span class="text-red-500">*</span></label>
<div class="grid grid-cols-3 gap-3"> <input type="text" wire:model="split_transaction_ref2" dir="ltr"
<label class="relative cursor-pointer"> class="w-full rounded-lg border-gray-300 focus:ring-blue-500" placeholder="TXN-XXXX">
<input type="radio" wire:model="payment_method" value="cash" class="peer sr-only"> @error('split_transaction_ref2') <p class="mt-1 text-xs text-red-600">{{ $message }}</p> @enderror
<div class="p-4 min-h-[64px] flex flex-col items-center justify-center gap-2 border border-gray-300 rounded-xl transition-all
peer-checked:border-green-500 peer-checked:bg-green-50 peer-checked:text-green-700 hover:border-gray-400">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 9V7a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2m2 4h10a2 2 0 002-2v-6a2 2 0 00-2-2H9a2 2 0 00-2 2v6a2 2 0 002 2zm7-5a2 2 0 11-4 0 2 2 0 014 0z"/></svg>
<span class="text-sm font-medium">{{ __('نقدي') }}</span>
</div>
</label>
<label class="relative cursor-pointer">
<input type="radio" wire:model="payment_method" value="card" class="peer sr-only">
<div class="p-4 min-h-[64px] flex flex-col items-center justify-center gap-2 border border-gray-300 rounded-xl transition-all
peer-checked:border-blue-500 peer-checked:bg-blue-50 peer-checked:text-blue-700 hover:border-gray-400">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"/></svg>
<span class="text-sm font-medium">{{ __('بطاقة') }}</span>
</div>
</label>
<label class="relative cursor-pointer">
<input type="radio" wire:model="payment_method" value="wallet" class="peer sr-only">
<div class="p-4 min-h-[64px] flex flex-col items-center justify-center gap-2 border border-gray-300 rounded-xl transition-all
peer-checked:border-purple-500 peer-checked:bg-purple-50 peer-checked:text-purple-700 hover:border-gray-400">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M3 6h18M3 14h18M3 18h18"/></svg>
<span class="text-sm font-medium">{{ __('محفظة') }}</span>
</div>
</label>
</div>
@error('payment_method') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror
</div> </div>
@else @endif
<div class="p-4 bg-amber-50 border border-amber-200 rounded-xl">
<p class="text-amber-700 text-sm">{{ __('سيتم إنشاء فاتورة مستحقة. يمكن الدفع لاحقًا من شاشة تحصيل المدفوعات.') }}</p> @if($split_method2 === 'cheque')
<div class="grid grid-cols-2 gap-3">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">{{ __('رقم الشيك') }} <span class="text-red-500">*</span></label>
<input type="text" wire:model="split_cheque_number2" dir="ltr"
class="w-full rounded-lg border-gray-300 focus:ring-yellow-500">
@error('split_cheque_number2') <p class="mt-1 text-xs text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">{{ __('اسم البنك') }}</label>
<input type="text" wire:model="split_bank_name2" class="w-full rounded-lg border-gray-300 focus:ring-yellow-500">
</div>
</div> </div>
@endif @endif
</div> </div>
@endif
{{-- Notes (optional, always available) --}}
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">{{ __('ملاحظات (اختياري)') }}</label>
<input type="text" wire:model="payment_notes"
class="w-full rounded-lg border-gray-300 focus:ring-gray-400"
placeholder="{{ __('أي ملاحظة تريد تسجيلها مع هذا الدفع') }}">
</div>
@endif {{-- end pay_now --}}
</div>{{-- end space-y-5 --}}
<div class="fixed bottom-0 start-0 end-0 bg-white border-t border-gray-200 p-4 safe-bottom sm:static sm:border-0 sm:p-0 sm:mt-8 flex justify-between gap-3 z-30"> <div class="fixed bottom-0 start-0 end-0 bg-white border-t border-gray-200 p-4 safe-bottom sm:static sm:border-0 sm:p-0 sm:mt-8 flex justify-between gap-3 z-30">
<button wire:click="previousStep" <button wire:click="previousStep"
......
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