diff --git a/resources/views/components/⚡create-payment.blade.php b/resources/views/components/⚡create-payment.blade.php new file mode 100644 index 0000000..87d89a7 --- /dev/null +++ b/resources/views/components/⚡create-payment.blade.php @@ -0,0 +1,135 @@ +with('client')->get()->sortBy('client.abbreviation'); + } + + #[Computed] + public function contacts() + { + if (!$this->invoice_id) { + return collect(); + } + $invoice = Invoice::find($this->invoice_id); + return $invoice?->client?->contacts ?? collect(); + } + + public function updatedInvoiceId(): void + { + $this->contact_id = null; // Reset when invoice changes + } + + + public function mount(?int $invoice_id = null): void + { + $this->invoice_id = $invoice_id; + $this->payment_date = now()->local()->format('Y-m-d'); + } + + public function save() + { + $this->validate(); + Payment::create([ + 'invoice_id' => $this->invoice_id, + 'contact_id'=> $this->contact_id, + 'payment_date' => $this->payment_date, + 'status' => $this->status, + 'payment_method' => $this->payment_method, + 'reference' => $this->reference, + 'amount' => $this->amount, + 'notes' => $this->notes, + ]); + + $this->reset(); + Flux::modal('create-payment')->close(); + $this->dispatch('payment-created'); + } + + +}; +?> + +
+ + + Create Payment + + + + +
+ Record Payment + + + + + + @foreach ($this->invoices as $invoice) + + @endforeach + + + + + @foreach($this->contacts as $contact) + {{ $contact->full_name }} + @endforeach + + + + @foreach(PaymentMethod::cases() as $method) + {{ $method->label() }} + @endforeach + + + + + + + + + Save Payment + +
+ +
diff --git a/resources/views/components/⚡payment-list.blade.php b/resources/views/components/⚡payment-list.blade.php new file mode 100644 index 0000000..7ba1e26 --- /dev/null +++ b/resources/views/components/⚡payment-list.blade.php @@ -0,0 +1,53 @@ +orderBy('created_at', 'desc')->get(); + } + + #[On('payment-created')] + #[On('payment-updated')] + public function refresh(): void + { + } + +}; +?> + +
+ Payments + + + + Payment Date + Invoice + Contact + Status + Payment Method
Reference
+ Fee Amount + Amount Paid +
+ + + @foreach ($this->payments as $payment) + + {{ $payment->payment_date->local()->format('m/d/Y') }} + {{ $payment->invoice->invoice_number }} + {{ $payment->contact->full_name }} + {{ $payment->status->label() }} + {{ $payment->payment_method->label() }}
{{ $payment->reference }}
+ {{ formatMoney($payment->fee_amount) }} + {{ formatMoney($payment->amount) }} +
+ @endforeach +
+
+