@extends('layouts.app')

@section('title', 'Payment Entry')

@section('breadcrumb')
    @include('components.breadcrumb', ['items' => ['Cash & Bank' => route('cash.index'), 'Payment Entry' => null]])
@endsection

@section('content')
<div class="max-w-2xl mx-auto">
    <div class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-6">
        <div>
            <h1 class="text-2xl font-bold text-slate-900 dark:text-white">Payment Entry</h1>
            <p class="text-sm text-slate-500 dark:text-slate-400 mt-1">Record money paid out</p>
        </div>
        <x-button variant="secondary" icon="history" :href="route('cash.index')">Transactions</x-button>
    </div>

    <x-card title="New Payment" icon="minus-circle">
        <form action="{{ route('cash.payment') }}" method="POST" class="space-y-5">
            @csrf

            <div class="grid grid-cols-1 sm:grid-cols-2 gap-5">
                <x-form-input name="voucher_date" label="Date" type="date" icon="calendar" :value="now()->format('Y-m-d')" required />
                <x-form-input name="mode" label="Payment Mode" type="select" icon="credit-card" :options="['cash' => 'Cash', 'bank_transfer' => 'Bank Transfer', 'cheque' => 'Cheque', 'mobile_banking' => 'Mobile Banking']" />
            </div>

            <x-form-input name="party_id" label="Paid To" type="select" icon="truck" :options="$suppliers->pluck('name', 'id')->toArray()" required />

            <x-form-input name="account_id" label="Paid From" type="select" icon="landmark" :options="$accounts->pluck('name', 'id')->toArray()" required />

            <x-form-input name="amount" label="Amount" type="number" icon="circle-dollar-sign" step="0.01" min="0.01" required />

            <div class="grid grid-cols-1 sm:grid-cols-2 gap-5">
                <x-form-input name="cheque_no" label="Cheque No" icon="hash" />
                <x-form-input name="cheque_date" label="Cheque Date" type="date" icon="calendar" />
            </div>

            <x-form-input name="description" label="Description / Remarks" type="textarea" icon="message-square" />

            <div class="flex justify-end gap-2 pt-2">
                <x-button variant="secondary" type="reset">Reset</x-button>
                <x-button variant="danger" icon="save" type="submit">Save Payment</x-button>
            </div>
        </form>
    </x-card>
</div>
@endsection
